]> git.ipfire.org Git - thirdparty/glibc.git/commitdiff
tst: Extend cross-test-ssh.sh to support passing glibc tunables
authorYury Khrustalev <yury.khrustalev@arm.com>
Mon, 9 Sep 2024 08:29:14 +0000 (09:29 +0100)
committerArjun Shankar <arjun@redhat.com>
Sat, 14 Sep 2024 10:54:18 +0000 (12:54 +0200)
This patch adds new flag --glibctunables to the cross-test-ssh.sh script
to pass Glibc tunables to the system on which tests are executed.

The value to pass can be also provided via the GLIBC_TUNABLES environment
variable.

This works similar to the TIMEOUTFACTOR variable.

Sometimes it is useful to cross test glibc with some non-default tunable,
and a global environment variable is the easiest way to inject some
tunable value into most tests. With this patch using cross-test-ssh.sh
script becomes very similar to running a test natively on the local host
when using non-default tunable is important.
Reviewed-by: Arjun Shankar <arjun@redhat.com>
scripts/cross-test-ssh.sh

index 6f5e027737505977b3a3e968f3b4d80d344ce456..5103038d406c585337486b85206b410df4a85d09 100755 (executable)
@@ -32,6 +32,9 @@ instead of ordinary 'ssh'.
 If the '--timeoutfactor FACTOR' flag is present, set TIMEOUTFACTOR on
 the remote machine to the specified FACTOR.
 
+If the '--glibctunables VALUE' flag is present, set GLIBC_TUNABLES on
+the remote machine to the specified VALUE.
+
 If the '--allow-time-setting' flag is present, set
 GLIBC_TEST_ALLOW_TIME_SETTING on the remote machine to indicate that
 time can be safely adjusted (e.g. on a virtual machine).
@@ -66,6 +69,7 @@ appropriately."
 
 ssh='ssh'
 timeoutfactor=$TIMEOUTFACTOR
+glibctunables=$GLIBC_TUNABLES
 while [ $# -gt 0 ]; do
   case "$1" in
 
@@ -85,6 +89,14 @@ while [ $# -gt 0 ]; do
       timeoutfactor="$1"
       ;;
 
+    "--glibctunables")
+      shift
+      if [ $# -lt 1 ]; then
+        break
+      fi
+      glibctunables="$1"
+      ;;
+
     "--allow-time-setting")
       settimeallowed="1"
       ;;
@@ -135,6 +147,12 @@ if [ "$timeoutfactor" ]; then
 ${command}"
 fi
 
+# Add command to set glibc tunables, if required.
+if [ "$glibctunables" ]; then
+  command="export GLIBC_TUNABLES=$(bourne_quote "$glibctunables")
+${command}"
+fi
+
 # Add command to set the info that time on target can be adjusted,
 # if required.
 # Serialize execution of this script on target to prevent from unintended