diff mbox series

[meta-networking,3/3] python3-scapy: keep UTscapy failure diagnostics in the ptest output

Message ID 20260819235718.3372843-3-khem.raj@oss.qualcomm.com
State New
Headers show
Series [meta-networking,1/3] openl2tp: do not clobber the ptest-runner RRECOMMENDS | expand

Commit Message

Khem Raj Aug. 19, 2026, 11:57 p.m. UTC
From: Khem Raj <raj.khem@gmail.com>

UTscapy writes its detailed report, including the traceback of every
failing test, to a file under ${PTEST_PATH}. Under testimage that path
only exists inside the ephemeral image, which is discarded as soon as the
run finishes, so a failure left nothing behind but a bare

    FAIL: 000.01s Emulate interact()

line and diagnosing it required rebuilding the image by hand.

Pass -F so the report expands only the failed tests, and cat it to stdout
when there is one, where ptest-runner records it. A clean run is
unaffected.

Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
 .../python/python3-scapy/run-ptest                | 15 +++++++++++++--
 1 file changed, 13 insertions(+), 2 deletions(-)
diff mbox series

Patch

diff --git a/meta-networking/recipes-devtools/python/python3-scapy/run-ptest b/meta-networking/recipes-devtools/python/python3-scapy/run-ptest
index 79e435a5ac..058bcea8a0 100644
--- a/meta-networking/recipes-devtools/python/python3-scapy/run-ptest
+++ b/meta-networking/recipes-devtools/python/python3-scapy/run-ptest
@@ -6,6 +6,17 @@  if ! nslookup example.com; then
   trap "mv /etc/resolv.conf.bak /etc/resolv.conf" INT EXIT
 fi

-python3 UTscapy.py -t regression.uts -f text -l -C -K skipped_ptest \
-    -o @PTEST_PATH@/scapy_ptest_$(date +%Y%m%d-%H%M%S).log \
+UTSCAPY_LOG=@PTEST_PATH@/scapy_ptest_$(date +%Y%m%d-%H%M%S).log
+
+# -F expands only the failed tests in the report, keeping it small while still
+# recording the traceback of anything that failed.
+python3 UTscapy.py -t regression.uts -f text -l -C -F -K skipped_ptest \
+    -o $UTSCAPY_LOG \
     2>&1 | sed -e 's/^passed None/PASS:/' -e 's/^failed None/FAIL:/'
+
+# The report only exists inside the ephemeral test image, so echo the details of
+# any failure to stdout, where ptest-runner records them.
+if grep -qE '^###.*=\[(failed|interrupted)\]' $UTSCAPY_LOG 2>/dev/null; then
+    echo "--- UTscapy failure details ---"
+    cat $UTSCAPY_LOG
+fi