public inbox for ltp@lists.linux.it
 help / color / mirror / Atom feed
* [LTP] [RFC] [PATCH] commands/which01.sh: Fix test for debian.
@ 2017-05-03 14:50 Cyril Hrubis
  2017-05-04 19:07 ` Jan Stancek
  0 siblings, 1 reply; 3+ messages in thread
From: Cyril Hrubis @ 2017-05-03 14:50 UTC (permalink / raw)
  To: ltp

The which binary on Debian comes from debianutils package and not from
the which package (like it is on the most of the distros). It does not
support most of the options, which is fine, since the test produces
TCONF for these but also returns relative path instead of absolute one.

So this patch adds alternate version for the expected path and the test
passes if at least one of them matches.

Fixes #151.

Signed-off-by: Cyril Hrubis <chrubis@suse.cz>
---
 testcases/commands/which/which01.sh | 13 +++++++++----
 1 file changed, 9 insertions(+), 4 deletions(-)

diff --git a/testcases/commands/which/which01.sh b/testcases/commands/which/which01.sh
index 579ac5b..eb87095 100755
--- a/testcases/commands/which/which01.sh
+++ b/testcases/commands/which/which01.sh
@@ -42,8 +42,13 @@ which_verify()
 {
 	until [ -z "$1" ]
 	do
-		grep -q "$1" temp
-		if [ $? -ne 0 ]; then
+		found="no"
+		for i in $1; do
+			if grep -q "$i" temp; then
+				found="yes"
+			fi
+		done
+		if [ "$found" != "yes" ]; then
 			echo "'$1' not found in:"
 			cat temp
 			echo
@@ -93,9 +98,9 @@ which_test()
 do_test()
 {
 	case $1 in
-	1) which_test "" "pname" "$PWD/pname";;
+	1) which_test "" "pname" "$PWD/pname ./pname";;
 	2) which_test "--all" "pname" "$PWD/bin/pname" "$PWD/pname";;
-	3) which_test "-a" "pname" "$PWD/bin/pname" "$PWD/pname";;
+	3) which_test "-a" "pname" "$PWD/bin/pname ./bin/pname" "$PWD/pname ./pname";;
 	4) which_test "--read-alias" "pname" "pname='pname -i'" "$PWD/pname";;
 	5) which_test "-i" "pname" "pname='pname -i'" "$PWD/pname";;
 	6) alias which='which --read-alias';
-- 
2.10.2


^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2017-05-05  9:18 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-05-03 14:50 [LTP] [RFC] [PATCH] commands/which01.sh: Fix test for debian Cyril Hrubis
2017-05-04 19:07 ` Jan Stancek
2017-05-05  9:18   ` Cyril Hrubis

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox