diff mbox series

[1/2] libpcap: show TESTrun errors in ptest log

Message ID 20261126162516.93141-2-jaipaul.cheernam@est.tech
State New
Headers show
Series libpcap ptest log fix and upgrade | expand

Commit Message

Jaipaul Cheernam Nov. 26, 2026, 4:25 p.m. UTC
Replace awk with sed in run-ptest to preserve TESTrun error
output. Report FAIL: libpcap when TESTrun exits non-zero.

For example, with fcodetest (split out of filtertest in 1.11.1)
missing from the image, ptest-runner.log only showed:

  BEGIN: /usr/lib/libpcap/ptest
  DURATION: 0
  END: /usr/lib/libpcap/ptest

and now with change shows:

  BEGIN: /usr/lib/libpcap/ptest
  ERROR: './testprogs/fcodetest -h' exit status was not 0.
  FAIL: libpcap
  DURATION: 1
  END: /usr/lib/libpcap/ptest

Signed-off-by: Jaipaul Cheernam <jaipaul.cheernam@est.tech>
---
 .../libpcap/files/run-ptest                   | 19 ++++---------------
 1 file changed, 4 insertions(+), 15 deletions(-)
diff mbox series

Patch

diff --git a/meta/recipes-connectivity/libpcap/files/run-ptest b/meta/recipes-connectivity/libpcap/files/run-ptest
index c4b869d541e..d6c76f52a81 100644
--- a/meta/recipes-connectivity/libpcap/files/run-ptest
+++ b/meta/recipes-connectivity/libpcap/files/run-ptest
@@ -8,18 +8,7 @@  ENUMERATETEST_BIN="./enumeratetest"
 CONFIG_H="../config.h"
 export FILTERTEST_BIN TRANSLATETEST_BIN ENUMERATETEST_BIN CONFIG_H
 
-./TESTrun --passed --skipped 2>&1 | awk '
-    /^Passed tests:/  { section = "PASS"; next }
-    /^Skipped tests:/ { section = "SKIP"; next }
-    /^Failed tests:/  { section = "FAIL"; next }
-    /^-+$/            { section = ""; next }
-    section != "" && /^    / {
-        c = index($0, ": ")
-        if (c >= 45) {
-            label = substr($0, 5, c - 5)
-            sub(/[[:space:]]+$/, "", label)
-            if (label != "")
-                print section ": " label
-        }
-    }
-'
+{ ./TESTrun --passed --skipped 2>&1 || echo "FAIL: libpcap"; } | sed \
+    -e '/^Passed tests:$/,/^$/ s/^    \([^ ][^ ]*\) *: .*/PASS: \1/' \
+    -e '/^Skipped tests:$/,/^$/ s/^    \([^ ][^ ]*\) *: .*/SKIP: \1/' \
+    -e '/^Failed tests:$/,/^INFO: / s/^    \([^ ][^ ]*\) *: .*/FAIL: \1/'