> -----Original Message----- > From: David Marchand <david.march...@redhat.com> > Sent: Thursday 26 June 2025 09:33 > > The problem lies in the use of subshell and pipes and that a failure > is not propagated. > Adding a test only the the telemetry script would not catch other > errors (like for example, if the jq command starts to spew errors).
Yes, I agree. > The most elegant would be to use errtrace and pipefail options, but > the errtrace is a bashism (iow not POSIX), and pipefail is POSIX only > since 2022 and many shell (like dash in Ubuntu 22.04/24.04) don't > implement it. Yes, also true. > We could try something like: > > diff --git a/app/test/suites/test_telemetry.sh > b/app/test/suites/test_telemetry.sh > index ca6abe266e..a81b4add90 100755 > --- a/app/test/suites/test_telemetry.sh > +++ b/app/test/suites/test_telemetry.sh > @@ -15,7 +15,7 @@ call_all_telemetry() { > telemetry_script=$rootdir/usertools/dpdk-telemetry.py > echo >$tmpoutput > echo "Telemetry commands log:" >>$tmpoutput > - for cmd in $(echo / | $telemetry_script | jq -r '.["/"][]') > + echo / | $telemetry_script | jq -r '.["/"][]' | while read cmd > do > for input in $cmd $cmd,0 $cmd,z > do > @@ -25,4 +25,5 @@ call_all_telemetry() { > done > } > > -(sleep 1 && call_all_telemetry && echo quit) | $@ > +! set -o | grep -q pipefail || set -o pipefail > +(set -e; ! set -o | grep -q pipefail || set -o pipefail; sleep 1 && > call_all_telemetry && echo quit) | $@ I 100% agree with the idea, but sadly I'm not familiar with shell scripting enough to suggest or review this diff. Is `for cmd in` always equivalent to `while read cmd`? Is CI ever executing it in bash for our attempt to set pipefail to be justified? Is it idiomatic? I hope someone else here can help with this. Perhaps this should just be re-written in Python. It depends on a Python script anyway.