tests bsim: run_parallel: Print how long tests take

To give an idea of which tests are taking
too long either on CI or locally.

Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
This commit is contained in:
Alberto Escolar Piedras 2024-03-26 10:05:25 +01:00 committed by David Leach
commit b0339136c1

View file

@ -77,9 +77,12 @@ echo -n "" > $tmp_res_file
if [ `command -v parallel` ]; then
parallel '
echo "<testcase name=\"{}\" time=\"0\">"
start=$(date +%s%N)
{} $@ &> {#}.log
dur=$(($(date +%s%N) - $start))
dur_s=$(awk -vdur=$dur "BEGIN { printf(\"%0.3f\", dur/1000000000)}")
if [ $? -ne 0 ]; then
(>&2 echo -e "\e[91m{} FAILED\e[39m")
(>&2 echo -e "\e[91m{} FAILED\e[39m ($dur_s s)")
(>&2 cat {#}.log)
echo "<failure message=\"failed\" type=\"failure\">"
cat {#}.log | eval $CLEAN_XML
@ -88,7 +91,7 @@ if [ `command -v parallel` ]; then
echo "</testcase>"
exit 1
else
(>&2 echo -e "{} PASSED")
(>&2 echo -e "{} PASSED ($dur_s s)")
rm {#}.log
echo "</testcase>"
fi