diff --git a/contrib/test_jenkins.sh b/contrib/test_jenkins.sh index f5d7d60735d..7b4ae3634f5 100755 --- a/contrib/test_jenkins.sh +++ b/contrib/test_jenkins.sh @@ -1119,7 +1119,19 @@ run_tests() { do_distributed_task 0 4 run_nt_buffer_transfer_tests } +error_handler() { + set +x + local exit_code=$? + local test_name="$1" + local flag="$2" + + azure_log_error "$test_name failed" + azure_log_error "To debug, rerun with: $flag $0" + exit $exit_code +} + run_test_proto_disable() { + trap 'error_handler "Proto V1 test" "PROTO_ENABLE=no"' ERR # build for devel tests and gtest build devel --enable-gtest @@ -1130,11 +1142,13 @@ run_test_proto_disable() { } run_asan_check() { + trap 'error_handler "AddressSanitizer check" "ASAN_CHECK=yes"' ERR build devel --enable-gtest --enable-asan --without-valgrind run_gtest "default" } run_valgrind_check() { + trap 'error_handler "Valgrind check" "VALGRIND_CHECK=yes"' ERR if [[ $(uname -m) =~ "aarch" ]] || [[ $(uname -m) =~ "ppc" ]]; then echo "==== Skip valgrind tests on `uname -m` ====" return @@ -1161,26 +1175,11 @@ then set_ucx_common_test_env if [[ "$PROTO_ENABLE" == "no" ]]; then - run_test_proto_disable || { - set +x - azure_log_error "Proto V1 test failed" - azure_log_error "To debug, rerun with: PROTO_ENABLE=no $0" - exit 1 - } + run_test_proto_disable elif [[ "$ASAN_CHECK" == "yes" ]]; then - run_asan_check || { - set +x - azure_log_error "AddressSanitaizer check failed" - azure_log_error "To debug, rerun with: ASAN_CHECK=yes $0" - exit 1 - } + run_asan_check elif [[ "$VALGRIND_CHECK" == "yes" ]]; then - run_valgrind_check || { - set +x - azure_log_error "Valgrind test failed" - azure_log_error "To debug, rerun with: VALGRIND_CHECK=yes $0" - exit 1 - } + run_valgrind_check else run_tests fi