From e89f68d59ea3e8dc2a267be1061dba677e825b95 Mon Sep 17 00:00:00 2001 From: Daniel Hilst <392820+dhilst@users.noreply.github.com> Date: Thu, 5 Nov 2026 16:53:11 -0300 Subject: [PATCH] test(xcat-core): the Genesis bats helper accepts only the GNU form of a signalled exit run_genesis in xCAT-test/bats/helpers/genesis_sandbox.bash compared the status of "timeout 20 /bin/bash /run/script" with one exact number. GNU coreutils timeout reports a child that a signal killed as 128+signal, so genesis_discovery_uuid.bats expects 143 for SIGTERM. The uutils coreutils of Ubuntu 26.04 reports the signal number alone, 15, so the same outcome fails the assertion there. run_genesis now accepts the expected status or, when that status is above 128, the signal number alone. A caller that expects 0 keeps one accepted value, and an unrelated failure is still a failure. The comment names the two conventions. Evidence: a four-case bats file drives run_genesis with a controlled status. With the change, 143 and 15 both pass against an expected 143, while status 1 against 143 and status 15 against 0 still fail. Without the change only the 15 case flips to "Expected exit 143, got 15"; the control and both discriminators are unchanged. The five "= 143" comparisons in genesis_openembedded_runtime.bats stay as they are: terminate_after reads its status from the bash wait builtin, which computes 128+signal itself and does not call timeout. Signed-off-by: Daniel Hilst <392820+dhilst@users.noreply.github.com> --- xCAT-test/bats/helpers/genesis_sandbox.bash | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/xCAT-test/bats/helpers/genesis_sandbox.bash b/xCAT-test/bats/helpers/genesis_sandbox.bash index 2501343d96..e29bd68787 100644 --- a/xCAT-test/bats/helpers/genesis_sandbox.bash +++ b/xCAT-test/bats/helpers/genesis_sandbox.bash @@ -45,11 +45,18 @@ setup_genesis_sandbox() run_genesis() { - local expected_status=$1 + local expected_status=$1 alternate_status shift + # GNU timeout reports a child that a signal killed as 128+signal. The uutils timeout of + # Ubuntu 26.04 reports the signal number alone, so one SIGTERM is 143 or 15 by platform. + alternate_status=$expected_status + if [ "$expected_status" -gt 128 ]; then + alternate_status=$((expected_status - 128)) + fi run "${sandbox[@]}" "$@" timeout 20 /bin/bash /run/script &2 + if [ "$status" -ne "$expected_status" ] && [ "$status" -ne "$alternate_status" ]; then + printf 'Expected exit %s or %s, got %s\n%s\n' \ + "$expected_status" "$alternate_status" "$status" "$output" >&2 return 1 fi }