From 71fbf8e6c50674c37a1c9ebe28e219916a8f92bc Mon Sep 17 00:00:00 2001 From: Carlos Rodriguez-Fernandez Date: Jul 08 2023 19:48:04 +0000 Subject: sysstat: print output when fails Signed-off-by: Carlos Rodriguez-Fernandez --- diff --git a/tests/p_sysstat/20-pidstat-basic.sh b/tests/p_sysstat/20-pidstat-basic.sh index 07da167..00b13a5 100755 --- a/tests/p_sysstat/20-pidstat-basic.sh +++ b/tests/p_sysstat/20-pidstat-basic.sh @@ -3,5 +3,10 @@ t_Log "Running $0 - pidstat test" -pidstat 1 1 > /dev/null 2>&1 -t_CheckExitStatus $? +output_file=$(mktemp) +trap "rm -f ${output_file}" EXIT + +if ! pidstat 1 1 > ${output_file} 2>&1; then + cat ${output_file} + exit 1 +fi diff --git a/tests/p_sysstat/25-sa-tests.sh b/tests/p_sysstat/25-sa-tests.sh index c93102d..87bae44 100755 --- a/tests/p_sysstat/25-sa-tests.sh +++ b/tests/p_sysstat/25-sa-tests.sh @@ -11,10 +11,14 @@ tests_in_order=( "/usr/lib64/sa/sa2 -A" ) +output_file=$(mktemp) +trap "rm -f ${output_file}" EXIT + for cmd in "${tests_in_order[@]}"; do t_Log "Running $0 - sa test: ${cmd}" - if ! eval "${cmd}" > /dev/null 2>&1; then + if ! eval "${cmd}" > ${output_file} 2>&1; then t_Log "FAIL: $0: sa test: ${cmd}" + cat ${output_file} exit 1 else t_Log "PASS: $0: sa test: ${cmd}"