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

Khem Raj <[email protected]>
Newsgroups org.openembedded.lists.openembedded-devel
Message-ID <[email protected]>
From: Khem Raj <[email protected]>

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 <[email protected]>
---
 .../recipes-support/hunspell/files/run-ptest  | 21 ++++++++++++-------
 1 file changed, 13 insertions(+), 8 deletions(-)

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
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.