diff options
| author | Nikhil R <nikhil.r@bmwtechworks.in> | 2025-10-27 15:08:01 +0530 |
|---|---|---|
| committer | Khem Raj <raj.khem@gmail.com> | 2025-10-28 23:31:29 -0700 |
| commit | 17012bc181b1aa26dd8e791e8378dd762ad21350 (patch) | |
| tree | 50d296ab593d04aa06316211ec9425abda1f688a | |
| parent | a992e7d222cc177ec651c94964b0ea075bd541bb (diff) | |
| download | meta-openembedded-17012bc181b1aa26dd8e791e8378dd762ad21350.tar.gz | |
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>
| -rw-r--r-- | meta-oe/recipes-support/inotify-tools/files/run-ptest | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/meta-oe/recipes-support/inotify-tools/files/run-ptest b/meta-oe/recipes-support/inotify-tools/files/run-ptest index f3b23d86f0..1bd51248d8 100644 --- a/meta-oe/recipes-support/inotify-tools/files/run-ptest +++ b/meta-oe/recipes-support/inotify-tools/files/run-ptest | |||
| @@ -4,18 +4,18 @@ | |||
| 4 | set -e | 4 | set -e |
| 5 | 5 | ||
| 6 | # Run the test binary and capture output | 6 | # Run the test binary and capture output |
| 7 | output=$(./test) | 7 | output=$(./test 2>&1) |
| 8 | status=$? | ||
| 8 | 9 | ||
| 9 | # Print the output for logging | 10 | # Print the output for logging |
| 10 | echo "$output" | 11 | echo "$output" |
| 11 | 12 | ||
| 12 | # Extract the summary line | 13 | # Evaluate result based on exit code |
| 13 | summary=$(echo "$output" | tail -n 1) | 14 | if [ $status -eq 0 ]; then |
| 14 | 15 | echo "All tests passed successfully." | |
| 15 | # Check if any tests failed | ||
| 16 | if echo "$summary" | grep -q "0 failed"; then | ||
| 17 | exit 0 | 16 | exit 0 |
| 18 | else | 17 | else |
| 19 | echo "Some tests failed!" | 18 | echo "Test program exited with status $status." |
| 19 | echo "Some tests may have failed. See output above for details." | ||
| 20 | exit 1 | 20 | exit 1 |
| 21 | fi | 21 | fi |
