From 632830ccf28d06444c50d14708240506e6a6d1fc Mon Sep 17 00:00:00 2001 From: Karel Zak Date: Tue, 20 Jan 2009 00:24:23 +0100 Subject: [PATCH] tests: cleanup ts/swapon Signed-off-by: Karel Zak --- tests/functions.sh | 16 ++++++++-------- tests/ts/swapon/devname | 8 +++----- tests/ts/swapon/label | 9 +++------ tests/ts/swapon/uuid | 8 +++----- 4 files changed, 17 insertions(+), 24 deletions(-) diff --git a/tests/functions.sh b/tests/functions.sh index 6dbbeb77..83af33cd 100644 --- a/tests/functions.sh +++ b/tests/functions.sh @@ -88,7 +88,7 @@ function ts_init { TS_VERBOSE=$(ts_has_option "verbose" "$*") TS_HAS_VOLUMEID="no" - BLKID_FILE="$TS_OUTDIR/${TS_NS}.blkidtab" + BLKID_FILE="$TS_OUTDIR/${TS_TESTNAME}.blkidtab" [ -d "$TS_OUTDIR" ] || mkdir -p "$TS_OUTDIR" [ -d "$TS_DIFFDIR" ] || mkdir -p "$TS_DIFFDIR" @@ -183,19 +183,19 @@ function ts_die { } function ts_device_init { - local IMAGE="$TS_OUTDIR/${TS_NS}.img" - local DEV="" + local img="$TS_OUTDIR/${TS_TESTNAME}.img" + local dev="" - dd if=/dev/zero of="$IMAGE" bs=1M count=5 &> /dev/null + dd if=/dev/zero of="$img" bs=1M count=5 &> /dev/null - DEV=$($TS_CMD_LOSETUP -s -f "$IMAGE") + dev=$($TS_CMD_LOSETUP -s -f "$img") - if [ -z "$DEV" ]; then - ts_device_deinit $DEV + if [ -z "$dev" ]; then + ts_device_deinit $dev return 1 # error fi - echo $DEV + echo $dev return 0 # succes } diff --git a/tests/ts/swapon/devname b/tests/ts/swapon/devname index 954af861..f6edd537 100755 --- a/tests/ts/swapon/devname +++ b/tests/ts/swapon/devname @@ -15,12 +15,10 @@ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # -. ./commands.sh -. ./functions.sh - -TS_COMPONENT="swapon" -TS_DESC="devname" +TS_TOPDIR="$(dirname $0)/../.." +TS_DESC="by devname" +. $TS_TOPDIR/functions.sh ts_init "$*" ts_skip_nonroot diff --git a/tests/ts/swapon/label b/tests/ts/swapon/label index 3ea30a96..299572c8 100755 --- a/tests/ts/swapon/label +++ b/tests/ts/swapon/label @@ -15,14 +15,11 @@ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # -. ./commands.sh -. ./functions.sh - -TS_COMPONENT="swapon" -TS_DESC="label" - +TS_TOPDIR="$(dirname $0)/../.." +TS_DESC="by label" LABEL="testSwapLabel" +. $TS_TOPDIR/functions.sh ts_init "$*" ts_skip_nonroot diff --git a/tests/ts/swapon/uuid b/tests/ts/swapon/uuid index 3b181fa0..3a9c1318 100755 --- a/tests/ts/swapon/uuid +++ b/tests/ts/swapon/uuid @@ -15,12 +15,10 @@ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # -. ./commands.sh -. ./functions.sh - -TS_COMPONENT="swapon" -TS_DESC="uuid" +TS_TOPDIR="$(dirname $0)/../.." +TS_DESC="by uuid" +. $TS_TOPDIR/functions.sh ts_init "$*" ts_skip_nonroot -- 2.39.5