Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Terminate background smoke tests on exit #153

Merged
merged 3 commits into from
Aug 10, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions test/run-smoke-tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,17 @@ TESTS_NAME=()
TESTS_PROJECT_PATH=()
TESTS_CONFIG_FILE=()

# Make sure background tests are torn down even if we don't get to `wait`
# for them (e.g. on ^C). Mainly for $RUN_PARALLEL.
terminate_jobs() {
local running=""
running="$(jobs -pr)"
if [ -n "$running" ]; then
kill "$running"
fi
}
trap 'terminate_jobs' SIGINT SIGTERM EXIT

for smoke_test in "${TESTS[@]}" ; do
if [ ${#EXCLUDE_TESTS[@]} -ne 0 ] && list_contains "$smoke_test" "${EXCLUDE_TESTS[@]}"; then
echo "Skipping test $smoke_test"
Expand Down
Loading