summaryrefslogtreecommitdiffstats
path: root/tests/ts/swapon
diff options
context:
space:
mode:
authorRuediger Meier2018-03-10 19:44:32 +0100
committerKarel Zak2018-03-19 11:46:11 +0100
commit9ca02cf52d70d56fc3f7e152c55154a15c62af6d (patch)
treeef005d92180afe8fbea8db7aa18079939de9f922 /tests/ts/swapon
parenttests: fix grep expressions for devices (diff)
downloadkernel-qcow2-util-linux-9ca02cf52d70d56fc3f7e152c55154a15c62af6d.tar.gz
kernel-qcow2-util-linux-9ca02cf52d70d56fc3f7e152c55154a15c62af6d.tar.xz
kernel-qcow2-util-linux-9ca02cf52d70d56fc3f7e152c55154a15c62af6d.zip
tests: consolidate ts_device_has UUID or LABEL
Regarding parallel root checks ... - fix: add a few missing "udevadm settle" where we are using LABELs or UUIDs - introduce ts_udevadm_settle(): * Still trivial implementation. The idea is to use it in future for all tests instead of directly calling "udevadm settle". So we could add debug messages, wait for specific events, add code for non-udev systems or even use "udevadm --{start,stop}-exec-queue" to be really sure what we are doing and why using udevadm at all. * The currently unused args may be used in future and show the code reader already now why we are calling "udevadm settle" at all. * So far this patch only affects swapon/, mount/, libmount/ tests, and is only about UUIDs and LABELs, but may be continued later for "partitions", "md devices", whatever. * We are calling ts_udevadm_settle() right *before* we need a LABEL or UUID, not just *after* we created one. This may be a bit better for speed and shows the code reader which command would fail without settle. - function ts_device_has_uuid() is unused now, we trust blkid(1). Renamed to ts_is_uuid() in case we would need it again. Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
Diffstat (limited to 'tests/ts/swapon')
-rwxr-xr-xtests/ts/swapon/label4
-rwxr-xr-xtests/ts/swapon/uuid6
2 files changed, 3 insertions, 7 deletions
diff --git a/tests/ts/swapon/label b/tests/ts/swapon/label
index 210a12c97..1bb5dbb3e 100755
--- a/tests/ts/swapon/label
+++ b/tests/ts/swapon/label
@@ -34,11 +34,9 @@ DEVICE=$TS_LODEV
$TS_CMD_MKSWAP -L $LABEL $DEVICE > /dev/null 2>> $TS_OUTPUT \
|| ts_die "Cannot make swap on $DEVICE"
-
-udevadm settle
-
ts_device_has "LABEL" $LABEL $DEVICE \
|| ts_die "Cannot find LABEL '$LABEL' on $DEVICE"
+ts_udevadm_settle "$DEVICE" "LABEL"
$TS_CMD_SWAPON -L $LABEL >> $TS_OUTPUT 2>&1
diff --git a/tests/ts/swapon/uuid b/tests/ts/swapon/uuid
index 65af6cb6d..70e62d7f9 100755
--- a/tests/ts/swapon/uuid
+++ b/tests/ts/swapon/uuid
@@ -33,10 +33,8 @@ DEVICE=$TS_LODEV
$TS_CMD_MKSWAP $DEVICE > /dev/null 2>> $TS_OUTPUT \
|| ts_die "Cannot make swap $DEVICE"
-
-ts_device_has_uuid $DEVICE || ts_die "Cannot find UUID on $DEVICE"
-
-UUID=$(ts_uuid_by_devname $DEVICE)
+UUID=$(ts_uuid_by_devname "$DEVICE") || ts_die "Cannot find UUID on $DEVICE"
+ts_udevadm_settle "$DEVICE" "UUID"
$TS_CMD_SWAPON -U $UUID >> $TS_OUTPUT 2>&1