diff mbox series

tst: Extend cross-test-ssh.sh to support passing glibc tunables

Message ID 20240909082914.1750885-1-yury.khrustalev@arm.com
State New
Headers show
Series tst: Extend cross-test-ssh.sh to support passing glibc tunables | expand

Commit Message

Yury Khrustalev Sept. 9, 2024, 8:29 a.m. UTC
From: Yury Khrustalev <yury.khrustalev@arm.com>

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.

---
Updated script has been tested manually with various combinations of env
variables and command line flags, and no regressions have been identified.

OK for master? Note, I don't have push rights yet, so will need someone
to push for me.

Thanks,
Yury

---
 scripts/cross-test-ssh.sh | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)

Comments

Arjun Shankar Sept. 12, 2024, 2:30 p.m. UTC | #1
Hi Yury,

> 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.
>
> ---
> Updated script has been tested manually with various combinations of env
> variables and command line flags, and no regressions have been identified.
>
> OK for master? Note, I don't have push rights yet, so will need someone
> to push for me.

This looks good to me.
Reviewed-by: Arjun Shankar <arjun@redhat.com>

Unless someone objects, I'll push this in a couple of days.

> ---
>  scripts/cross-test-ssh.sh | 18 ++++++++++++++++++
>  1 file changed, 18 insertions(+)
>
> diff --git a/scripts/cross-test-ssh.sh b/scripts/cross-test-ssh.sh
> index 6f5e027737..5103038d40 100755
> --- a/scripts/cross-test-ssh.sh
> +++ b/scripts/cross-test-ssh.sh
> @@ -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.
> +

OK. Document new flag.

>  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

OK. Pick up the exported env-var.

>  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"
> +      ;;
> +

OK. Flag value will override env-var.

>      "--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
> +

OK.

>  # 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
> --
> 2.39.2
>

I did a quick check and this does indeed propagate the tunable.
diff mbox series

Patch

diff --git a/scripts/cross-test-ssh.sh b/scripts/cross-test-ssh.sh
index 6f5e027737..5103038d40 100755
--- a/scripts/cross-test-ssh.sh
+++ b/scripts/cross-test-ssh.sh
@@ -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