summaryrefslogtreecommitdiffstats
path: root/tests/ts/swapon
diff options
context:
space:
mode:
authorRuediger Meier2018-03-09 18:27:44 +0100
committerKarel Zak2018-03-19 11:46:11 +0100
commitec182d8b9da7596809aab9aab4fc931e9ccb7494 (patch)
tree5b5127ff66d0d027da6238e105eb3dfa5bbfc3b3 /tests/ts/swapon
parenttests: handle xargs errors and invalid args (diff)
downloadkernel-qcow2-util-linux-ec182d8b9da7596809aab9aab4fc931e9ccb7494.tar.gz
kernel-qcow2-util-linux-ec182d8b9da7596809aab9aab4fc931e9ccb7494.tar.xz
kernel-qcow2-util-linux-ec182d8b9da7596809aab9aab4fc931e9ccb7494.zip
tests: fix grep expressions for devices
ts_is_mounted "/dev/loop1" returned true if /dev/loop17 was mounted. A very annoying source of sporadic failures since many years. This issue became more visible since running the checks in parallel, which increases the probability to get bigger loop device numbers. Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
Diffstat (limited to 'tests/ts/swapon')
-rwxr-xr-xtests/ts/swapon/devname2
-rwxr-xr-xtests/ts/swapon/fixpgsz2
-rwxr-xr-xtests/ts/swapon/fixsig2
-rwxr-xr-xtests/ts/swapon/label2
-rwxr-xr-xtests/ts/swapon/uuid2
5 files changed, 5 insertions, 5 deletions
diff --git a/tests/ts/swapon/devname b/tests/ts/swapon/devname
index de9a5f20c..7469dcb18 100755
--- a/tests/ts/swapon/devname
+++ b/tests/ts/swapon/devname
@@ -38,7 +38,7 @@ ts_device_has "TYPE" "swap" $DEVICE || ts_die "Cannot find swap on $DEVICE"
$TS_CMD_SWAPON $DEVICE >> $TS_OUTPUT 2>&1
-grep -q $DEVICE /proc/swaps || ts_die "Cannot find $DEVICE in /proc/swaps"
+grep -q "^$DEVICE\b" /proc/swaps || ts_die "Cannot find $DEVICE in /proc/swaps"
$TS_CMD_SWAPOFF $DEVICE
diff --git a/tests/ts/swapon/fixpgsz b/tests/ts/swapon/fixpgsz
index 01b2e9aff..4479cd8f9 100755
--- a/tests/ts/swapon/fixpgsz
+++ b/tests/ts/swapon/fixpgsz
@@ -40,7 +40,7 @@ ts_device_has "TYPE" "swap" $DEVICE || ts_die "Cannot find swap on $DEVICE"
#
$TS_CMD_SWAPON --fixpgsz $DEVICE &> /dev/null
-grep -q $DEVICE /proc/swaps || ts_die "Cannot find $DEVICE in /proc/swaps"
+grep -q "^$DEVICE\b" /proc/swaps || ts_die "Cannot find $DEVICE in /proc/swaps"
$TS_CMD_SWAPOFF $DEVICE
diff --git a/tests/ts/swapon/fixsig b/tests/ts/swapon/fixsig
index 3f9e3ff84..c3104a23e 100755
--- a/tests/ts/swapon/fixsig
+++ b/tests/ts/swapon/fixsig
@@ -41,7 +41,7 @@ ts_device_has "TYPE" "swsuspend" $DEVICE || ts_die "Cannot find swsuspend on $DE
#
$TS_CMD_SWAPON $DEVICE &> /dev/null
-grep -q $DEVICE /proc/swaps || ts_die "Cannot find $DEVICE in /proc/swaps"
+grep -q "^$DEVICE\b" /proc/swaps || ts_die "Cannot find $DEVICE in /proc/swaps"
$TS_CMD_SWAPOFF $DEVICE
diff --git a/tests/ts/swapon/label b/tests/ts/swapon/label
index 056953a29..210a12c97 100755
--- a/tests/ts/swapon/label
+++ b/tests/ts/swapon/label
@@ -42,7 +42,7 @@ ts_device_has "LABEL" $LABEL $DEVICE \
$TS_CMD_SWAPON -L $LABEL >> $TS_OUTPUT 2>&1
-grep -q $DEVICE /proc/swaps || ts_die "Cannot find $DEVICE in /proc/swaps"
+grep -q "^$DEVICE\b" /proc/swaps || ts_die "Cannot find $DEVICE in /proc/swaps"
$TS_CMD_SWAPOFF $DEVICE
diff --git a/tests/ts/swapon/uuid b/tests/ts/swapon/uuid
index 9f244f39a..65af6cb6d 100755
--- a/tests/ts/swapon/uuid
+++ b/tests/ts/swapon/uuid
@@ -40,7 +40,7 @@ UUID=$(ts_uuid_by_devname $DEVICE)
$TS_CMD_SWAPON -U $UUID >> $TS_OUTPUT 2>&1
-grep -q $DEVICE /proc/swaps || ts_die "Cannot find $DEVICE in /proc/swaps"
+grep -q "^$DEVICE\b" /proc/swaps || ts_die "Cannot find $DEVICE in /proc/swaps"
$TS_CMD_SWAPOFF $DEVICE