From 1098e0974843da02ea8f51efb95a4716ec3ba3b3 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Thomas=20Wei=C3=9Fschuh?= Date: Mon, 24 Apr 2023 19:11:03 +0200 Subject: [PATCH] mount: (tests) test fallback codepaths MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Signed-off-by: Thomas Weißschuh --- tests/ts/mount/fallback | 42 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100755 tests/ts/mount/fallback diff --git a/tests/ts/mount/fallback b/tests/ts/mount/fallback new file mode 100755 index 0000000000..d8f3732efa --- /dev/null +++ b/tests/ts/mount/fallback @@ -0,0 +1,42 @@ +#!/bin/bash + +TS_TOPDIR="${0%/*}/../.." +TS_DESC="fstab-fallback" + +. "$TS_TOPDIR"/functions.sh +ts_init "$*" + +ts_check_test_command "$TS_HELPER_ENOSYS" +ts_check_test_command "$TS_CMD_MOUNT" +ts_check_test_command "$TS_CMD_UMOUNT" +ts_check_test_command "$TS_CMD_FINDMNT" + +ts_skip_nonroot + +test_mount_fallback() { + ts_init_subtest "$1" + + MY_SOURCE="${TS_MOUNTPOINT}-src" + + mkdir -p "$MY_SOURCE" + mkdir -p "$TS_MOUNTPOINT" + + "$TS_HELPER_ENOSYS" $2 -- "$TS_CMD_MOUNT" --bind "$MY_SOURCE" "$TS_MOUNTPOINT" \ + >> "$TS_OUTPUT" 2>> "$TS_ERRLOG" + [ "$?" = "0" ] || ts_log "error: mount $TS_MOUNTPOINT" + + "$TS_CMD_FINDMNT" --mountpoint "$TS_MOUNTPOINT" &> /dev/null + [ $? -eq 0 ] || ts_die "Not found target (mount failed?)" + + "$TS_CMD_UMOUNT" "$TS_MOUNTPOINT" || ts_die "Cannot umount $TS_MOUNTPOINT" + + ts_finalize_subtest +} + +test_mount_fallback "open_tree" "-s open_tree" +test_mount_fallback "fsopen" "-s fsopen" + +ts_fstab_clean + +ts_finalize + -- 2.47.3