]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
tests: (functions.sh) create variable for test fstab location
authorThomas Weißschuh <thomas@t-8ch.de>
Sat, 22 Apr 2023 15:48:58 +0000 (17:48 +0200)
committerThomas Weißschuh <thomas@t-8ch.de>
Sun, 14 May 2023 19:51:23 +0000 (21:51 +0200)
Signed-off-by: Thomas Weißschuh <thomas@t-8ch.de>
tests/functions.sh
tests/ts/mount/fstab-broken

index e47b78ac9da7329ac0a922701ce0a4e2a4034bb1..4f72a196296de5ca887b49aaa8dd8614d2b79036 100644 (file)
@@ -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 "# <!-- util-linux test entry" >> /etc/fstab
+       echo "# <!-- util-linux test entry" >> "$TS_FSTAB"
 }
 
 function ts_fstab_close {
-       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/# <!-- util-linux.*-->//;
-/^$/d" /etc/fstab
+/^$/d" "$TS_FSTAB"
 
-       sync /etc/fstab 2>/dev/null
+       sync "$TS_FSTAB" 2>/dev/null
        ts_unlock "fstab"
 }
 
index 131d5c1d75fea2ede38aed95b41e17750126db5e..fb85fe3c8d29926223fbf0c947262e727ae7210a 100755 (executable)
@@ -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"