File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -34,6 +34,9 @@ function parallel::aggregate_test_results() {
3434 local snapshot=" ${result_line##*## ASSERTIONS_SNAPSHOT=} "
3535 snapshot=" ${snapshot%%##* } " ; snapshot=${snapshot:- 0}
3636
37+ local exit_code=" ${result_line##*## TEST_EXIT_CODE=} "
38+ exit_code=" ${exit_code%%##* } " ; exit_code=${exit_code:- 0}
39+
3740 # Add to the total counts
3841 total_failed=$(( total_failed + failed))
3942 total_passed=$(( total_passed + passed))
@@ -46,6 +49,11 @@ function parallel::aggregate_test_results() {
4649 continue
4750 fi
4851
52+ if [ " ${exit_code:- 0} " -ne 0 ]; then
53+ state::add_tests_failed
54+ continue
55+ fi
56+
4957 if [ " ${snapshot:- 0} " -gt 0 ]; then
5058 state::add_tests_snapshot
5159 continue
@@ -83,6 +91,7 @@ function parallel::must_stop_on_failure() {
8391function parallel::reset() {
8492 # shellcheck disable=SC2153
8593 rm -rf " $TEMP_DIR_PARALLEL_TEST_SUITE "
94+ mkdir -p " $TEMP_DIR_PARALLEL_TEST_SUITE "
8695 [ -f " $TEMP_FILE_PARALLEL_STOP_ON_FAILURE " ] && rm " $TEMP_FILE_PARALLEL_STOP_ON_FAILURE "
8796}
8897
Original file line number Diff line number Diff line change 1+ #! /usr/bin/env bash
2+
3+ function set_up_before_script() {
4+ TEST_ENV_FILE=" tests/acceptance/fixtures/.env.default"
5+ }
6+
7+ function test_parallel_and_sequential_results_match() {
8+ local file1=tests/acceptance/fixtures/test_bashunit_when_a_test_passes.sh
9+ local file2=tests/acceptance/fixtures/test_bashunit_when_a_test_fail.sh
10+ local file3=tests/acceptance/fixtures/test_bashunit_when_a_execution_error.sh
11+
12+ local sequential_output
13+ sequential_output=$( ./bashunit --no-parallel --env " $TEST_ENV_FILE " " $file1 " " $file2 " " $file3 " )
14+
15+ local parallel_output
16+ parallel_output=$( ./bashunit --parallel --env " $TEST_ENV_FILE " " $file1 " " $file2 " " $file3 " )
17+
18+ local sequential_summary
19+ sequential_summary=$( echo " $sequential_output " | grep -e " Tests:" -e " Assertions:" | tr ' \n' ' ' )
20+
21+ local parallel_summary
22+ parallel_summary=$( echo " $parallel_output " | grep -e " Tests:" -e " Assertions:" | tr ' \n' ' ' )
23+
24+ assert_equals " $sequential_summary " " $parallel_summary "
25+ }
You can’t perform that action at this time.
0 commit comments