From e52435b993beeeb36a69f044ef2d7053f9d195c9 Mon Sep 17 00:00:00 2001 From: Zach Brown Date: Mon, 22 May 2023 16:08:20 -0700 Subject: [PATCH] Add t_mount_opt Add a test helper that mounts with a mount option. Signed-off-by: Zach Brown --- tests/funcs/fs.sh | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/tests/funcs/fs.sh b/tests/funcs/fs.sh index 950e0e7e..b4442252 100644 --- a/tests/funcs/fs.sh +++ b/tests/funcs/fs.sh @@ -153,7 +153,27 @@ t_mount() test "$nr" -lt "$T_NR_MOUNTS" || \ t_fail "fs nr $nr invalid" - eval t_quiet mount -t scoutfs \$T_O$nr \$T_DB$nr \$T_M$nr + eval t_quiet mount -t scoutfs \$T_O$nr\$opt \$T_DB$nr \$T_M$nr +} + +# +# Mount with an optional mount option string. If the string is empty +# then the saved mount options are used. If the string has contents +# then it is appended to the end of the saved options with a separating +# comma. +# +# Unlike t_mount this won't inherently fail in t_quiet, errors are +# returned so bad options can be tested. +# +t_mount_opt() +{ + local nr="$1" + local opt="${2:+,$2}" + + test "$nr" -lt "$T_NR_MOUNTS" || \ + t_fail "fs nr $nr invalid" + + eval mount -t scoutfs \$T_O$nr\$opt \$T_DB$nr \$T_M$nr } t_umount()