[LTP] [PATCH v3 2/4] Add support for mixing C and shell code
Cyril Hrubis
chrubis@suse.cz
Fri Sep 6 15:28:37 CEST 2024
Hi!
> The difference is that /bin/sh links to dash in debian. But as you
> pointed out even if all /bin/sh is changed to /bin/bash in the scripts
> the tests stil fails.
>
> It looks like on RPi alias with variables does not work at all.
So it looks like aliases may not be expanded on non-interactive shells
unless it's enabled explicitely.
This patch uses shopt to enable that and also works around dash that
does not support $LINENO:
diff --git a/testcases/lib/tst_env.sh b/testcases/lib/tst_env.sh
index 67ba80744..bb0c586d7 100644
--- a/testcases/lib/tst_env.sh
+++ b/testcases/lib/tst_env.sh
@@ -6,6 +6,16 @@
tst_script_name=$(basename $0)
+# bash does not expand aliases in non-iteractive mode, enable it
+if [ -n "$BASH_VERSION" ]; then
+ shopt -s expand_aliases
+fi
+
+# dash does not support line numbers even though this is mandated by POSIX
+if [ -z "$LINENO" ]; then
+ LINENO=-1
+fi
+
if [ -z "$LTP_IPC_PATH" ]; then
echo "This script has to be executed from a LTP loader!"
exit 1
--
Cyril Hrubis
chrubis@suse.cz
More information about the ltp
mailing list