mirror of
https://github.com/openembedded/meta-openembedded.git
synced 2026-06-05 02:50:46 +00:00
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 <nikhil.r@bmwtechworks.in> Signed-off-by: Khem Raj <raj.khem@gmail.com>
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user