]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
whereis: extend test case
authorSamanta Navarro <ferivoz@riseup.net>
Wed, 4 Nov 2020 11:39:00 +0000 (11:39 +0000)
committerSamanta Navarro <ferivoz@riseup.net>
Wed, 4 Nov 2020 11:43:09 +0000 (11:43 +0000)
Previous commits are covered with these test cases.

Removed dependency on system layout.

Signed-off-by: Samanta Navarro <ferivoz@riseup.net>
tests/expected/misc/whereis
tests/ts/misc/whereis

index 2e9ba477f89e86c5bbc86c0516283f59d8f6e178..69d1a6ef2c7a63a44d695bed4040d3417f9141f8 100644 (file)
@@ -1 +1,5 @@
-success
+fsck success
+fsck.ext4 success
+python success
+python3 success
+python3.8 success
index ee7ec2701935aad2b8a16c6590d8b2204562879f..44643aefa6335781b99ea1197388cd180c03a1de 100755 (executable)
@@ -20,11 +20,31 @@ ts_init "$*"
 
 ts_check_test_command "$TS_CMD_WHEREIS"
 
-LS_COUNT=$($TS_CMD_WHEREIS ls | wc -w)
-if [ $LS_COUNT -lt 2 ]; then
-       echo "ls binary nor manual not found?" > $TS_OUTPUT
-else
-       echo "success" > $TS_OUTPUT
-fi
+BIN_DIR="$(mktemp -d "${TS_OUTDIR}/binXXXXXXXXXXXXX")"
+MAN_DIR="$(mktemp -d "${TS_OUTDIR}/manXXXXXXXXXXXXX")"
+touch "$BIN_DIR/fsck"
+touch "$MAN_DIR/fsck.8.zst"
+touch "$BIN_DIR/fsck.ext4"
+touch "$MAN_DIR/fsck.ext4.8.zst"
+touch "$BIN_DIR/fsck.minix"
+touch "$BIN_DIR/python"
+touch "$MAN_DIR/python.1.gz"
+touch "$BIN_DIR/python3"
+touch "$MAN_DIR/python3.1"
+touch "$BIN_DIR/python3.8"
+touch "$BIN_DIR/python3.8-config"
+touch "$MAN_DIR/python3.8.1"
+
+for COMMAND in fsck fsck.ext4 python python3 python3.8
+do
+       COUNT=$($TS_CMD_WHEREIS -B $BIN_DIR -M $MAN_DIR -f $COMMAND | wc -w)
+       if [ $COUNT -eq 3 ]; then
+               echo "$COMMAND success" >> $TS_OUTPUT
+       else
+               echo "$COMMAND failure" >> $TS_OUTPUT
+       fi
+done
+
+rm -rf "$BIN_DIR" "$MAN_DIR"
 
 ts_finalize