[PATCH] testsuite: handle /bin/false being busybox in the start-stop-daemon tests

ross.burton at arm.com ross.burton at arm.com
Tue Aug 8 18:02:09 UTC 2023


From: Ross Burton <ross.burton at arm.com>

It's known that the final start-stop-daemon test fails if /bin/false is
actually a busybox symlink.  Instead of failing, check if false is
busybox and adapt the expected output to match.

Signed-off-by: Ross Burton <ross.burton at arm.com>
---
 testsuite/start-stop-daemon.tests | 17 +++++++++++++----
 1 file changed, 13 insertions(+), 4 deletions(-)

diff --git a/testsuite/start-stop-daemon.tests b/testsuite/start-stop-daemon.tests
index 0757b1288..a699c3ca1 100755
--- a/testsuite/start-stop-daemon.tests
+++ b/testsuite/start-stop-daemon.tests
@@ -26,11 +26,20 @@ testing "start-stop-daemon without -x and -a" \
 # Unfortunately, this does not actually check argv[0] correctness,
 # but at least it checks that pathname to exec() is correct
 #
-# NB: this fails if /bin/false is a busybox symlink:
-# busybox looks at argv[0] and says "qwerty: applet not found"
+# Note that if /bin/false is busybox the expected output needs to
+# be different, as busybox looks at argv[0] and says
+# "qwerty: applet not found".
+case $(readlink /bin/false) in
+	*busybox*)
+		EXPECTED="qwerty: applet not found\n127\n"
+		;;
+	*)
+		EXPECTED="1\n"
+		;;
+esac
+
 testing "start-stop-daemon with both -x and -a" \
 	'start-stop-daemon -S -x /bin/false -a qwerty false 2>&1; echo $?' \
-	"1\n" \
-	"" ""
+	"$EXPECTED"	"" ""
 
 exit $FAILCOUNT
-- 
2.34.1



More information about the busybox mailing list