From: Ruediger Meier Date: Thu, 13 Mar 2014 15:42:49 +0000 (+0100) Subject: tests: try hard to create swaplabel's test image X-Git-Tag: v2.25-rc1~411^2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=280855019f13e21c5e804f1cd8673a2d96066fb8;p=thirdparty%2Futil-linux.git tests: try hard to create swaplabel's test image Signed-off-by: Ruediger Meier --- diff --git a/tests/ts/misc/swaplabel b/tests/ts/misc/swaplabel index e8768741cc..ef0f0ff0bd 100755 --- a/tests/ts/misc/swaplabel +++ b/tests/ts/misc/swaplabel @@ -18,21 +18,29 @@ TS_DESC="swaplabel" . $TS_TOPDIR/functions.sh ts_init "$*" -#ts_check_test_command "$TS_CMD_FALLOCATE" -#ts_check_test_command "$TS_CMD_MKSWAP" -#ts_check_test_command "$TS_CMD_SWAPLABEL" +ts_check_test_command "$TS_CMD_MKSWAP" +ts_check_test_command "$TS_CMD_SWAPLABEL" + +# fallocate does not work on most file systems +function fallocate_or_skip() +{ + $TS_CMD_FALLOCATE -l $1 $2 2>/dev/null || \ + truncate -s $1 $2 || \ + ts_skip "no way to create test image" +} IMAGE=${TS_OUTDIR}/${TS_TESTNAME}.file rm -f $IMAGE -$TS_CMD_FALLOCATE -l 40959 $IMAGE > $TS_OUTPUT 2>&1 + +fallocate_or_skip 40959 $IMAGE $TS_CMD_MKSWAP \ --label 1234567890abcdef \ --uuid 12345678-abcd-abcd-abcd-1234567890ab \ $IMAGE >> $TS_OUTPUT 2>&1 rm -f $IMAGE -$TS_CMD_FALLOCATE -l 40960 $IMAGE >> $TS_OUTPUT 2>&1 +fallocate_or_skip 40960 $IMAGE $TS_CMD_MKSWAP \ --label 1234567890abcdef \ --uuid 12345678-abcd-abcd-abcd-1234567890ab \