aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristian Goeschel Ndjomouo <cgoesc2@wgu.edu>2025-10-13 14:53:59 -0400
committerChristian Goeschel Ndjomouo <cgoesc2@wgu.edu>2025-10-13 14:53:59 -0400
commit95f3fbfc4f5584261e1ad91dba35c92673f03890 (patch)
tree205085c6f4b741ade52bffcf75489b4dbfd56cd9
parentdb0efab5c3e13794ae79fcb3db8371e3af510169 (diff)
downloadutil-linux-95f3fbfc4f5584261e1ad91dba35c92673f03890.tar.gz
tests: (libmount) improve explicit loop read-write mount check
Some kernel configurations will affect default mount behavior and add extra mount options. As a result, the $TS_OUTPUT will not reliably match on all kernels. Therefore it is better to simply test whether 'rw' is an option and not write the full options list to $TS_OUTPUT. Adresses: #3765 Signed-off-by: Christian Goeschel Ndjomouo <cgoesc2@wgu.edu>
-rw-r--r--tests/expected/libmount/loop-explicit-rw1
-rwxr-xr-xtests/ts/libmount/loop3
2 files changed, 2 insertions, 2 deletions
diff --git a/tests/expected/libmount/loop-explicit-rw b/tests/expected/libmount/loop-explicit-rw
index e7787c0590..35821117c8 100644
--- a/tests/expected/libmount/loop-explicit-rw
+++ b/tests/expected/libmount/loop-explicit-rw
@@ -1,2 +1 @@
-rw
Success
diff --git a/tests/ts/libmount/loop b/tests/ts/libmount/loop
index db807bd44a..72fd27f014 100755
--- a/tests/ts/libmount/loop
+++ b/tests/ts/libmount/loop
@@ -142,7 +142,8 @@ ts_finalize_subtest
ts_init_subtest "explicit-rw"
[ -d "$TS_MOUNTPOINT" ] || mkdir -p $TS_MOUNTPOINT
$TS_CMD_MOUNT -o rw "$BACKFILE" "$TS_MOUNTPOINT" >> $TS_OUTPUT 2>> $TS_ERRLOG
-$TS_CMD_FINDMNT -no FS-OPTIONS --mountpoint "$TS_MOUNTPOINT" >> $TS_OUTPUT 2>> $TS_ERRLOG
+FINDMNT_RES=$( $TS_CMD_FINDMNT -Q 'OPTIONS =~ "[,]?rw[,]?"' -no OPTIONS --mountpoint "$TS_MOUNTPOINT" )
+[ -n "$FINDMNT_RES" ] || ts_log "$TS_MOUNTPOINT not mounted as read-write"
$TS_CMD_UMOUNT "$TS_MOUNTPOINT" >> $TS_OUTPUT 2>> $TS_ERRLOG
udevadm settle
ts_log "Success"