File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -46,6 +46,10 @@ echo "Using Bazel in ${BAZEL_BIN}"
4646echo " ================================================================"
4747
4848bazel_args=(" --test_output=errors" " --verbose_failures=true" " --keep_going" )
49+ if [[ -n " ${RUNS_PER_TEST} " ]]; then
50+ bazel_args+=(" --runs_per_test=${RUNS_PER_TEST} " )
51+ fi
52+
4953if [[ -n " ${BAZEL_CONFIG} " ]]; then
5054 bazel_args+=(" --config" " ${BAZEL_CONFIG} " )
5155fi
Original file line number Diff line number Diff line change @@ -145,6 +145,11 @@ _EOF_
145145 fi
146146fi
147147
148+ ctest_args=(" --output-on-failure" )
149+ if [[ -n " ${RUNS_PER_TEST} " ]]; then
150+ ctest_args+=(" --repeat-until-fail" " ${RUNS_PER_TEST} " )
151+ fi
152+
148153if [[ " ${BUILD_TESTING:- } " = " yes" ]]; then
149154 # When the user does a super-build the tests are hidden in a subdirectory.
150155 # We can tell that ${BINARY_DIR} does not have the tests by checking for this
@@ -155,7 +160,7 @@ if [[ "${BUILD_TESTING:-}" = "yes" ]]; then
155160 echo
156161 echo " ${COLOR_YELLOW} Running unit tests $( date) ${COLOR_RESET} "
157162 echo
158- (cd " ${BINARY_DIR} " && ctest --output-on-failure )
163+ (cd " ${BINARY_DIR} " && ctest " ${ctest_args[@]} " )
159164
160165 echo
161166 echo " ${COLOR_YELLOW} Completed unit tests $( date) ${COLOR_RESET} "
Original file line number Diff line number Diff line change @@ -391,6 +391,10 @@ docker_flags=(
391391 # produces properly colorized error messages.
392392 " --env" " TERM=${TERM:- dumb} "
393393
394+ # If set, add a flag --runs_per_test=<value> to bazel or --repeat-until-fail
395+ # to ctest.
396+ " --env" " RUNS_PER_TEST=${RUNS_PER_TEST:- } "
397+
394398 # Tells scripts whether they are running as part of a CI or not.
395399 " --env" " RUNNING_CI=${RUNNING_CI:- no} "
396400
You can’t perform that action at this time.
0 commit comments