hunspell: keep ptest failure diagnostics instead of discarding them

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>
This commit is contained in:
Khem Raj
2026-08-18 03:55:33 +02:00
committed by Khem Raj
parent 5094e3aedf
commit 7af0bdb0fe
@@ -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