test: correct several bugs and robustness issues in coverage.sh.in#483
Merged
martin-belanger merged 1 commit intolinux-nvme:mainfrom Apr 6, 2026
Merged
Conversation
- SIGINT trap: replace `trap postrun_cleanup SIGINT` with
`trap 'exit 130' SIGINT` so that Ctrl+C actually stops the script
(the old handler ran cleanup but then resumed execution); the EXIT
trap already handles cleanup on exit.
- Silent unit test failures: run_unit_test now captures the exit code
and calls log_file_contents when non-zero, making test failures
visible in the terminal instead of silently discarded.
- Missing D-Bus name: the final sd_start "stafd" call was missing the
second argument, causing systemd-run to be invoked with an empty
BusName= under Type=dbus; fixed to pass @STAFD_DBUS_NAME@.
- Fragile argument passing in run_unit_test: replaced the args=$@/
"${args}" pattern with a proper array (local -a cov_cmd) and "$@",
which correctly handles arguments with spaces.
- Conditional __pycache__ chown: replaced unconditional chown of
__pycache__ directories (which fails silently on first run before
they exist) with `find -maxdepth 0 -type d | xargs -r chown`.
- Scratch file: replaced all hardcoded /tmp/output.txt references with
a SCRATCH_FILE variable for consistency and easier customisation.
Signed-off-by: Martin Belanger <martin.belanger@dell.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #483 +/- ##
=======================================
Coverage 60.64% 60.64%
=======================================
Files 16 16
Lines 2612 2612
=======================================
Hits 1584 1584
Misses 1028 1028 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
SIGINT trap: replace
trap postrun_cleanup SIGINTwithtrap 'exit 130' SIGINTso that Ctrl+C actually stops the script (the old handler ran cleanup but then resumed execution); the EXIT trap already handles cleanup on exit.Silent unit test failures: run_unit_test now captures the exit code and calls log_file_contents when non-zero, making test failures visible in the terminal instead of silently discarded.
Missing D-Bus name: the final sd_start "stafd" call was missing the second argument, causing systemd-run to be invoked with an empty BusName= under Type=dbus; fixed to pass @STAFD_DBUS_NAME@.
Fragile argument passing in run_unit_test: replaced the args=$@/ "${args}" pattern with a proper array (local -a cov_cmd) and "$@", which correctly handles arguments with spaces.
Conditional pycache chown: replaced unconditional chown of pycache directories (which fails silently on first run before they exist) with
find -maxdepth 0 -type d | xargs -r chown.Scratch file: replaced all hardcoded /tmp/output.txt references with a SCRATCH_FILE variable for consistency and easier customisation.