diff mbox series

[meta-oe,9/9] hunspell: keep ptest failure diagnostics instead of discarding them

Message ID 20260821180211.423633-9-khem.raj@oss.qualcomm.com
State New
Headers show
Series [meta-oe,1/9] xdg-dbus-proxy: use VIRTUAL-RUNTIME_dbus for ptest RDEPENDS | expand

Commit Message

Khem Raj Aug. 21, 2026, 6:02 p.m. UTC
From: Khem Raj <raj.khem@gmail.com>

run-ptest ran each case as "./test.sh $test > /dev/null 2>&1", throwing
away the only thing that explains a failure: test.sh prints which check
failed and which words were misrecognised, e.g.

  Fail in base.good. Good words recognised as wrong:
  <words>

Without it a failing hunspell ptest reports a bare "FAIL: <name>" and
gives no way to tell a packaging problem from a real defect when the
suite runs on target.

Capture the output and print it, indented, under the FAIL line, and
take test.sh's exit status directly rather than reading $? inside the
else branch of the if that consumed it.

Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
 .../recipes-support/hunspell/files/run-ptest  | 21 ++++++++++++-------
 1 file changed, 13 insertions(+), 8 deletions(-)
diff mbox series

Patch

diff --git a/meta-oe/recipes-support/hunspell/files/run-ptest b/meta-oe/recipes-support/hunspell/files/run-ptest
index d2671c9d4e..bccf23506f 100644
--- a/meta-oe/recipes-support/hunspell/files/run-ptest
+++ b/meta-oe/recipes-support/hunspell/files/run-ptest
@@ -16,15 +16,20 @@  for test in $tests; do
     if echo "$SKIP_TESTS" | grep -qw "$test"; then
         continue
     fi
-
-    if ./test.sh "$test" > /dev/null 2>&1; then
+
+    # Capture test.sh output rather than discarding it: on failure it
+    # reports which check failed and which words were misrecognised,
+    # which is the only usable diagnostic when running on target.
+    output=$(./test.sh "$test" 2>&1)
+    status=$?
+
+    if [ $status -eq 0 ]; then
         echo "PASS: $test"
+    elif [ $status -eq 3 ]; then
+        echo "SKIP: $test"
     else
-        status=$?
-        if [ $status -eq 3 ]; then
-            echo "SKIP: $test"
-        else
-            echo "FAIL: $test"
-        fi
+        echo "FAIL: $test"
+        # Indent so ptest-runner does not mistake diagnostics for results.
+        printf '%s\n' "$output" | sed 's/^/    /'
     fi
 done