80
80
# clear all the collected reports
81
81
rm -f parallel_test_output-* .txt # in case it exists, remove it
82
82
83
-
84
83
status=0 # reset the script status
85
84
report=" " # final report
86
85
pids=() # array of PID for running tests
87
86
test_ids=() # array of indexes of running tests
87
+ failed_tests=() # array of failed tests
88
88
printf " Running $test_count tests in batches of $test_batch_size \n"
89
89
for i in " ${! tests[@]} " ; do
90
90
test=${tests[$i]}
@@ -112,8 +112,8 @@ for i in "${!tests[@]}"; do
112
112
# add row to the final report
113
113
report+=" Ran\t$test \t>> exit:$test_status \n"
114
114
if [[ $test_status != 0 ]]; then
115
- # show the output of the failed test
116
- cat " parallel_test_output- $i .txt "
115
+ # add the test to the failed tests array
116
+ failed_tests+=( $i )
117
117
# Process exited with a non-zero exit status
118
118
status=$test_status
119
119
fi
@@ -123,11 +123,27 @@ for i in "${!tests[@]}"; do
123
123
fi
124
124
done
125
125
126
- # echo test report
126
+ # print test report
127
127
printf ' =%.s' {1..80}
128
128
printf " \n$report "
129
129
printf ' =%.s' {1..80}
130
130
printf ' \n'
131
131
132
+ # print failed tests
133
+ if [[ ${# failed_tests[@]} -gt 0 ]]; then
134
+ printf " Failed tests:\n"
135
+ for i in " ${failed_tests[@]} " ; do
136
+ printf " \n\n"
137
+ pritf " =" * 80
138
+ printf " ${tests[$i]} \n"
139
+ pritf " -" * 80
140
+ # show the output of the failed test
141
+ cat " parallel_test_output-$i .txt"
142
+ pritf " =" * 80
143
+ done
144
+ else
145
+ printf " All tests passed!\n"
146
+ fi
147
+
132
148
# exit with the worse test result
133
149
exit $status
0 commit comments