diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 1667f395e..014f39251 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -49,6 +49,7 @@ jobs: env: MATRIX_LINUX_SETUP_COMMAND: "apt-get update -y -q && apt-get install -y -q lsof dnsutils netcat-openbsd net-tools curl jq" MATRIX_LINUX_COMMAND: "./scripts/integration_tests.sh" + MATRIX_LINUX_ENV_VARS_JSON: '{"NIO_ALLOC_COUNTER_TESTS_PARALLEL": "true"}' integration-tests: name: Integration tests diff --git a/.github/workflows/pull_request.yml b/.github/workflows/pull_request.yml index 8684bf8fe..00fc70c44 100644 --- a/.github/workflows/pull_request.yml +++ b/.github/workflows/pull_request.yml @@ -55,6 +55,7 @@ jobs: env: MATRIX_LINUX_SETUP_COMMAND: "apt-get update -y -q && apt-get install -y -q lsof dnsutils netcat-openbsd net-tools curl jq" MATRIX_LINUX_COMMAND: "./scripts/integration_tests.sh" + MATRIX_LINUX_ENV_VARS_JSON: '{"NIO_ALLOC_COUNTER_TESTS_PARALLEL": "true"}' integration-tests: name: Integration tests diff --git a/IntegrationTests/allocation-counter-tests-framework/run-allocation-counter.sh b/IntegrationTests/allocation-counter-tests-framework/run-allocation-counter.sh index 6d52c7c0d..97b771ea2 100755 --- a/IntegrationTests/allocation-counter-tests-framework/run-allocation-counter.sh +++ b/IntegrationTests/allocation-counter-tests-framework/run-allocation-counter.sh @@ -289,8 +289,33 @@ build_package \ set -eu cd "$working_dir" swift build "${build_opts[@]}" -for f in "${files[@]}"; do - echo "- $f" - swift run "${build_opts[@]}" "$(module_name_from_path "$f")" -done +bin_path=$(swift build "${build_opts[@]}" --show-bin-path) +if [[ "${NIO_ALLOC_COUNTER_TESTS_PARALLEL:-false}" == "true" ]]; then + out_dir=$(mktemp -d) + trap 'rm -rf "$out_dir"' EXIT + pids=() + for f in "${files[@]}"; do + module=$(module_name_from_path "$f") + "$bin_path/$module" > "$out_dir/$module" & + pids+=($!) + done + all_ok=true + for i in "${!pids[@]}"; do + module=$(module_name_from_path "${files[$i]}") + if wait "${pids[$i]}"; then + echo "- ${files[$i]}" + cat "$out_dir/$module" + else + all_ok=false + echo "- ${files[$i]} FAILED" >&2 + cat "$out_dir/$module" >&2 + fi + done + "$all_ok" +else + for f in "${files[@]}"; do + echo "- $f" + "$bin_path/$(module_name_from_path "$f")" + done +fi )