From: Masatake YAMATO Date: Sat, 2 Mar 2024 21:51:15 +0000 (+0900) Subject: tests: (lsfd::mkfds-inotify) consider environments not having / as a mount point X-Git-Tag: v2.42-start~496^2 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=121b37036cce04f5d6bf590d6eef13ecf8a09265;p=thirdparty%2Futil-linux.git tests: (lsfd::mkfds-inotify) consider environments not having / as a mount point Close #2819. In the original test case, test_mkfds monitored / and /etc/fstab. As reported in #2819, if a test platform doesn't have / as a mount point, the test case doesn't work. So we use /proc and /proc/cmdnline instead. Signed-off-by: Masatake YAMATO Acked-by: Chris Hofstaedtler --- diff --git a/tests/expected/lsfd/mkfds-inotify b/tests/expected/lsfd/mkfds-inotify index cb55f9669..6fc0d1291 100644 --- a/tests/expected/lsfd/mkfds-inotify +++ b/tests/expected/lsfd/mkfds-inotify @@ -1,4 +1,4 @@ INOTIFY.INODES.RAW: 0 -INOTIFY.INODES.RAW == FSTAB\x0aROOT +INOTIFY.INODES.RAW == CMDLINE\x0aPROC INOTIFY.INODES.RAW (JSON): 0 INOTIFY.INODES.RAW == EXPECTED_JSON diff --git a/tests/ts/lsfd/mkfds-inotify b/tests/ts/lsfd/mkfds-inotify index 3f26849dd..a44fd77d1 100755 --- a/tests/ts/lsfd/mkfds-inotify +++ b/tests/ts/lsfd/mkfds-inotify @@ -29,20 +29,22 @@ ts_cd "$TS_OUTDIR" PID= FD=3 -ROOT="$(stat -c %i /)"@"$($TS_CMD_FINDMNT --raw --noheadings -oMAJ:MIN --target /)" -FSTAB="$(stat -c %i /etc/fstab)"@"$($TS_CMD_FINDMNT --raw --noheadings -oMAJ:MIN --target /etc/fstab)" +dir=/proc +file=/proc/cmdline +PROC="$(stat -c %i $dir)"@"$($TS_CMD_FINDMNT --raw --noheadings -oMAJ:MIN --target $dir)" +CMDLINE="$(stat -c %i $file)"@"$($TS_CMD_FINDMNT --raw --noheadings -oMAJ:MIN --target $file)" { - coproc MKFDS { "$TS_HELPER_MKFDS" inotify $FD; } + coproc MKFDS { "$TS_HELPER_MKFDS" inotify $FD dir=$dir file=$file ; } if read -u ${MKFDS[0]} PID; then EXPR='(PID == '"${PID}"') and (FD == '"$FD"')' INODES_RAW=$(${TS_CMD_LSFD} --raw -n -o INOTIFY.INODES.RAW -Q "${EXPR}") echo "INOTIFY.INODES.RAW": $? - if [[ "$INODES_RAW" == "${FSTAB}"'\x0a'"${ROOT}" ]]; then - echo "INOTIFY.INODES.RAW" == FSTAB'\x0a'ROOT + if [[ "$INODES_RAW" == "${CMDLINE}"'\x0a'"${PROC}" ]]; then + echo "INOTIFY.INODES.RAW" == CMDLINE'\x0a'PROC else echo "INOTIFY.INODES.RAW": "$INODES_RAW" - echo "FSTAB": "$FSTAB" - echo "ROOT": "$ROOT" + echo "CMDLINE": "$CMDLINE" + echo "PROC": "$PROC" fi INODES_RAW_JSON=$(${TS_CMD_LSFD} -J --raw -n -o INOTIFY.INODES.RAW -Q "${EXPR}") echo "INOTIFY.INODES.RAW (JSON)": $? @@ -51,7 +53,7 @@ FSTAB="$(stat -c %i /etc/fstab)"@"$($TS_CMD_FINDMNT --raw --noheadings -oMAJ:MIN "lsfd": [ { "inotify.inodes.raw": [ - "$FSTAB", "$ROOT" + "$CMDLINE", "$PROC" ] } ]