Skip to content

test: correct several bugs and robustness issues in coverage.sh.in#483

Merged
martin-belanger merged 1 commit intolinux-nvme:mainfrom
martin-belanger:minor-fixes-coverage.sh
Apr 6, 2026
Merged

test: correct several bugs and robustness issues in coverage.sh.in#483
martin-belanger merged 1 commit intolinux-nvme:mainfrom
martin-belanger:minor-fixes-coverage.sh

Conversation

@martin-belanger
Copy link
Copy Markdown
Collaborator

  • 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.

- 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>
@martin-belanger martin-belanger merged commit 570bafc into linux-nvme:main Apr 6, 2026
8 checks passed
@codecov
Copy link
Copy Markdown

codecov Bot commented Apr 6, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 60.64%. Comparing base (c813dcf) to head (3d408ec).
⚠️ Report is 3 commits behind head on main.

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.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@martin-belanger martin-belanger deleted the minor-fixes-coverage.sh branch April 6, 2026 23:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant