Skip to contentSkip to conversation

python3-cbor2: return correct error code from run-ptest

PATCH New Gyorgy Sarvari 1 participant 1 message Apr 13

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 python3-cbor2: return correct error code from run-ptest

In case the test fails to even start executing, and there is no output on stdout, there are no logs stored of the test run, so the test log parser will not report a failure.
Also, since the run-ptest command is a piped script, by default the last command's return code is set as the exit code, which is always 0.

To report the result correctly return the test executions's return code as the exit code (instead of the last command in the pipe), and redirect the error output to standard out, to create a logfile that can be parsed after the execution.

---
 meta-python/recipes-devtools/python/python3-cbor2/run-ptest | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
meta-python/recipes-devtools/python/python3-cbor2/run-ptest +2 -1
index b63c4de0d9..c951b418c5 100644
@@ -1,3 +1,4 @@
 #!/bin/sh
 
-pytest -o log_cli=true -o log_cli_level=INFO | sed -e 's/\[...%\]//g'| sed -e 's/PASSED/PASS/g'| sed -e 's/FAILED/FAIL/g'|sed -e 's/SKIPPED/SKIP/g'| awk '{if ($NF=="PASS" || $NF=="FAIL" || $NF=="SKIP" || $NF=="XFAIL" || $NF=="XPASS"){printf "%s: %s\n", $NF, $0}else{print}}'| awk '{if ($NF=="PASS" || $NF=="FAIL" || $NF=="SKIP" || $NF=="XFAIL" || $NF=="XPASS") {$NF="";print $0}else{print}}'
+pytest -o log_cli=true -o log_cli_level=INFO 2>&1 | sed -e 's/\[...%\]//g'| sed -e 's/PASSED/PASS/g'| sed -e 's/FAILED/FAIL/g'|sed -e 's/SKIPPED/SKIP/g'| awk '{if ($NF=="PASS" || $NF=="FAIL" || $NF=="SKIP" || $NF=="XFAIL" || $NF=="XPASS"){printf "%s: %s\n", $NF, $0}else{print}}'| awk '{if ($NF=="PASS" || $NF=="FAIL" || $NF=="SKIP" || $NF=="XFAIL" || $NF=="XPASS") {$NF="";print $0}else{print}}'
+exit ${PIPESTATUS[0]}