From: Christian Goeschel Ndjomouo Date: Mon, 13 Oct 2025 18:53:59 +0000 (-0400) Subject: tests: (libmount) improve explicit loop read-write mount check X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=95f3fbfc4f5584261e1ad91dba35c92673f03890;p=thirdparty%2Futil-linux.git 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 --- diff --git a/tests/expected/libmount/loop-explicit-rw b/tests/expected/libmount/loop-explicit-rw index e7787c059..35821117c 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 db807bd44..72fd27f01 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"