From: Thomas Weißschuh Date: Sat, 22 Apr 2023 15:48:58 +0000 (+0200) Subject: tests: (functions.sh) create variable for test fstab location X-Git-Tag: v2.40-rc1~469^2~3 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=ed3d33faff17fb702a3acfca2f9f24e69f4920de;p=thirdparty%2Futil-linux.git tests: (functions.sh) create variable for test fstab location Signed-off-by: Thomas Weißschuh --- diff --git a/tests/functions.sh b/tests/functions.sh index e47b78ac9d..4f72a19629 100644 --- a/tests/functions.sh +++ b/tests/functions.sh @@ -386,6 +386,7 @@ function ts_init_env { TS_ENABLE_UBSAN="yes" fi + TS_FSTAB="/etc/fstab" BLKID_FILE="$TS_OUTDIR/${TS_TESTNAME}.blkidtab" declare -a TS_SUID_PROGS @@ -824,12 +825,12 @@ function ts_is_mounted { } function ts_fstab_open { - echo "# " >> /etc/fstab - sync /etc/fstab 2>/dev/null + echo "# -->" >> "$TS_FSTAB" + sync "$TS_FSTAB" 2>/dev/null } function ts_fstab_addline { @@ -838,7 +839,7 @@ function ts_fstab_addline { local FS=${3:-"auto"} local OPT=${4:-"defaults"} - echo "$SPEC $MNT $FS $OPT 0 0" >> /etc/fstab + echo "$SPEC $MNT $FS $OPT 0 0" >> "$TS_FSTAB" } function ts_fstab_lock { @@ -862,9 +863,9 @@ function ts_fstab_clean { ba } s/# //; -/^$/d" /etc/fstab +/^$/d" "$TS_FSTAB" - sync /etc/fstab 2>/dev/null + sync "$TS_FSTAB" 2>/dev/null ts_unlock "fstab" } diff --git a/tests/ts/mount/fstab-broken b/tests/ts/mount/fstab-broken index 131d5c1d75..fb85fe3c8d 100755 --- a/tests/ts/mount/fstab-broken +++ b/tests/ts/mount/fstab-broken @@ -33,7 +33,7 @@ mkdir -p $MNT ts_fstab_lock ts_fstab_open -echo "tmpd $MNT tmpfs" >> /etc/fstab +echo "tmpd $MNT tmpfs" >> "$TS_FSTAB" ts_fstab_close ts_init_subtest "mount"