| Q | A |
|---|
| OS | macOS / Linux / Windows |
| Shell | sh / bash / ... |
| bashunit version | 0.17 - beta/main |
Summary
I recently implemented parallel tests here #358
however, the stop on failure flag is not working properly as each test is running on its own (child)process.
Option 1
There is a trap inside main::exec_tests()
# Trap SIGINT (Ctrl-C) and call the cleanup functiontrap main::cleanup SIGINT
and this is responsible to kill all child prcesses:
functionmain::cleanup() {
printf"%sCaught Ctrl-C, killing all child processes...%s\n""${_COLOR_SKIPPED}""${_COLOR_DEFAULT}"# Kill all child processes of this script
pkill -P $$
cleanup_temp_files
exit 1
}Option 2
Store in a temp file (that all child processes can read) if there was any error at all. Touching/creating a file would be enough.
Then check if (running parallel) && (that file exists) then stop running more tests from their side.
Expected behavior
When running tests in parallel, the -S|--stop-on-failure flag should work similarly as a Ctrl-C behaviour, stopping all
https://bashunit.typeddevs.com/command-line#stop-on-failure
Summary
I recently implemented parallel tests here #358
however, the stop on failure flag is not working properly as each test is running on its own (child)process.
Option 1
There is a trap inside
main::exec_tests()and this is responsible to kill all child prcesses:
Option 2
Store in a temp file (that all child processes can read) if there was any error at all. Touching/creating a file would be enough.
Then check if (running parallel) && (that file exists) then stop running more tests from their side.
Expected behavior
When running tests in parallel, the
-S|--stop-on-failureflag should work similarly as a Ctrl-C behaviour, stopping all