From 0df97c8891860a2082db8b53cbc1dfc7ac73e4d1 Mon Sep 17 00:00:00 2001 From: Carlos Rodriguez-Fernandez Date: Jul 08 2023 19:47:31 +0000 Subject: libbpf-tools: print output when fails Signed-off-by: Carlos Rodriguez-Fernandez --- diff --git a/tests/p_libbpf-tools/libbpf-tools_tests.sh b/tests/p_libbpf-tools/libbpf-tools_tests.sh index 6704200..a5862d6 100755 --- a/tests/p_libbpf-tools/libbpf-tools_tests.sh +++ b/tests/p_libbpf-tools/libbpf-tools_tests.sh @@ -104,12 +104,16 @@ tracing_tests=( "bpf-wakeuptime 1" ) +output_file=$(mktemp) +trap "rm -f ${output_file}" EXIT + one_failed=0 for cmd in "${version_tests[@]}"; do t_Log "Running $0 - libbpf-tools test: ${cmd}" - if ! eval "${cmd}" > /dev/null 2>&1; then + if ! eval "${cmd}" > ${output_file} 2>&1; then t_Log "FAIL: $0: libbpf-tools test: ${cmd}" + cat ${output_file} one_failed=1 else t_Log "PASS: $0: libbpf-tools test: ${cmd}" @@ -118,8 +122,9 @@ done for cmd in "${tracing_tests[@]}"; do t_Log "Running $0 - libbpf-tools test: ${cmd}" - if ! eval "${cmd}" > /dev/null 2>&1; then + if ! eval "${cmd}" > ${output_file} 2>&1; then t_Log "FAIL: $0: libbpf-tools test: ${cmd}" + cat ${output_file} one_failed=1 else t_Log "PASS: $0: libbpf-tools test: ${cmd}"