inotify-tools: improve ptest result handling
PATCH 1/1 inotify-tools: improve ptest result handling
The run-ptest script determines success by grepping for "0 failed" in the test output. This could incorrectly report success for cases like "10 failed" or "100 failed".
Update the script to rely on the test binary's exit status instead, while still capturing and printing full test output for logging.
This makes the ptest behavior more robust and consistent
Signed-off-by Nikhil R <[email protected]>
--- .../recipes-support/inotify-tools/files/run-ptest | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-)
meta-oe/recipes-support/inotify-tools/files/run-ptest +7 -7
@@ -4,18 +4,18 @@ set -e # Run the test binary and capture output -output=$(./test) +output=$(./test 2>&1) +status=$? # Print the output for logging echo "$output" -# Extract the summary line -summary=$(echo "$output" | tail -n 1) - -# Check if any tests failed -if echo "$summary" | grep -q "0 failed"; then +# Evaluate result based on exit code +if [ $status -eq 0 ]; then + echo "All tests passed successfully." exit 0 else - echo "Some tests failed!" + echo "Test program exited with status $status." + echo "Some tests may have failed. See output above for details." exit 1 fi
Signature · 1 line
2.34.1