From 2f9549470754a958a8151e000ee881f84015634c Mon Sep 17 00:00:00 2001 From: Ruediger Meier Date: Thu, 15 May 2014 13:20:31 +0200 Subject: tests, add function ts_mount We want to generalize mounts similar to how we do it already in minix/mkfs. Currently most of our other checks just fail if "fs not supported". Note that the new function checks a bit stronger than before in minix/mkfs. It respects mount's return value and stderr goes to $TS_OUTPUT too. It's a bit ugly that we write to $TS_OUTPUT from inside of the function. But if the caller would do it then we couldn't ts_skip and the whole function would be pointless. Signed-off-by: Ruediger Meier --- tests/ts/minix/mkfs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'tests/ts') diff --git a/tests/ts/minix/mkfs b/tests/ts/minix/mkfs index f94cb0a4d..f664e3525 100755 --- a/tests/ts/minix/mkfs +++ b/tests/ts/minix/mkfs @@ -37,8 +37,7 @@ ts_log "create mountpoint dir" [ -d "$TS_MOUNTPOINT" ] || mkdir -p $TS_MOUNTPOINT ts_log "mount the filesystem" -($TS_CMD_MOUNT $DEVICE $TS_MOUNTPOINT 2>&1 >> $TS_OUTPUT || true) \ - | grep -q "unknown filesystem type" && ts_skip "mkfs: minix fs not supported by kernel" +ts_mount $DEVICE $TS_MOUNTPOINT # check it ts_is_mounted $DEVICE || ts_die "Cannot find $DEVICE in /proc/mounts" $DEVICE -- cgit v1.2.3-55-g7522 From d2cc2ba722d5fd0775855bf6ae977bb66a31c09c Mon Sep 17 00:00:00 2001 From: Ruediger Meier Date: Thu, 15 May 2014 16:56:18 +0200 Subject: tests: ts_mount knows which fs is expected Signed-off-by: Ruediger Meier --- tests/functions.sh | 4 +++- tests/ts/minix/mkfs | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) (limited to 'tests/ts') diff --git a/tests/functions.sh b/tests/functions.sh index cc3dc054a..384fccdc8 100644 --- a/tests/functions.sh +++ b/tests/functions.sh @@ -496,6 +496,8 @@ function ts_mount { local result local msg local fs + local fs_exp=$1 + shift out=$($TS_CMD_MOUNT "$@" 2>&1) result=$? @@ -506,7 +508,7 @@ function ts_mount { then # skip only if reported fs correctly and if it's not available fs=$(echo "$msg" | sed -n "s/.*type '\(.*\)'$/\1/p") - [ -n "$fs" ] \ + [ "$fs" = "fs_exp" ] \ && grep -qe "[[:space:]]${fs}$" /proc/filesystems &>/dev/null \ || ts_skip "$msg" fi diff --git a/tests/ts/minix/mkfs b/tests/ts/minix/mkfs index f664e3525..86230f77c 100755 --- a/tests/ts/minix/mkfs +++ b/tests/ts/minix/mkfs @@ -37,7 +37,7 @@ ts_log "create mountpoint dir" [ -d "$TS_MOUNTPOINT" ] || mkdir -p $TS_MOUNTPOINT ts_log "mount the filesystem" -ts_mount $DEVICE $TS_MOUNTPOINT +ts_mount "minix" $DEVICE $TS_MOUNTPOINT # check it ts_is_mounted $DEVICE || ts_die "Cannot find $DEVICE in /proc/mounts" $DEVICE -- cgit v1.2.3-55-g7522 From cf6784deeb092e44ca732e3d77dfa06745f69aa9 Mon Sep 17 00:00:00 2001 From: Ruediger Meier Date: Thu, 15 May 2014 17:01:00 +0200 Subject: tests: use ts_mount for cramfs Signed-off-by: Ruediger Meier --- tests/ts/cramfs/doubles | 2 +- tests/ts/cramfs/mkfs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'tests/ts') diff --git a/tests/ts/cramfs/doubles b/tests/ts/cramfs/doubles index 7393fc7dc..43fc60330 100755 --- a/tests/ts/cramfs/doubles +++ b/tests/ts/cramfs/doubles @@ -46,7 +46,7 @@ ts_log "create cramfs image" $TS_CMD_MKCRAMFS $IMAGE_SRC $IMAGE_PATH 2>&1 >> $TS_OUTPUT [ -s "$IMAGE_PATH" ] || ts_die "Cannot create $IMAGE_PATH" -$TS_CMD_MOUNT -r $IMAGE_PATH $TS_MOUNTPOINT 2>&1 >> $TS_OUTPUT +ts_mount "cramfs" -r $IMAGE_PATH $TS_MOUNTPOINT # check it ts_is_mounted $TS_MOUNTPOINT || ts_die "Cannot find $TS_MOUNTPOINT in /proc/mounts" diff --git a/tests/ts/cramfs/mkfs b/tests/ts/cramfs/mkfs index 70c827591..06cdfbd32 100755 --- a/tests/ts/cramfs/mkfs +++ b/tests/ts/cramfs/mkfs @@ -77,7 +77,7 @@ ts_device_has "TYPE" "cramfs" $DEVICE [ "$?" == "0" ] || ts_die "Cannot find cramfs on $DEVICE" $DEVICE ts_log "mount the image" -$TS_CMD_MOUNT -r -L $LABEL $TS_MOUNTPOINT 2>&1 >> $TS_OUTPUT +ts_mount "cramfs" -r -L $LABEL $TS_MOUNTPOINT # check it ts_is_mounted $DEVICE || ts_die "Cannot find $DEVICE in /proc/mounts" $DEVICE -- cgit v1.2.3-55-g7522