@@ -7,6 +7,12 @@ runner=$(get_test_runner "${1:-local}")
77
88PERSISTENT_WORKER_FLAGS=" --strategy=Scalac=worker --worker_sandboxing"
99
10+ check_persistent_worker_failure () {
11+ command=$1
12+ output=$( bazel ${command} 2>&1 )
13+ ! (echo " $output " | grep -q -- " ---8<---8<---" ) && echo " $output "
14+ }
15+
1016test_persistent_worker_success () {
1117 # shellcheck disable=SC2086
1218 bazel build //test:ScalaBinary $PERSISTENT_WORKER_FLAGS
@@ -17,9 +23,8 @@ test_persistent_worker_failure() {
1723}
1824
1925test_persistent_worker_handles_exception_in_macro_invocation () {
20- command=" bazel build //test_expect_failure/scalac_exceptions:bad_macro_invocation $PERSISTENT_WORKER_FLAGS "
21- output=$( ${command} 2>&1 )
22- ! (echo " $output " | grep -q -- " ---8<---8<---" ) && (echo " $output " | grep -q " Build failure during macro expansion" )
26+ command=" build //test_expect_failure/scalac_exceptions:bad_macro_invocation $PERSISTENT_WORKER_FLAGS "
27+ check_persistent_worker_failure " $command " | grep -q " Build failure during macro expansion"
2328
2429 RESPONSE_CODE=$?
2530 if [ $RESPONSE_CODE -ne 0 ]; then
@@ -28,6 +33,19 @@ test_persistent_worker_handles_exception_in_macro_invocation() {
2833 fi
2934}
3035
36+ test_persistent_worker_handles_stack_overflow_exception () {
37+ command=" build //test_expect_failure/scalac_exceptions:stack_overflow_macro_invocation $PERSISTENT_WORKER_FLAGS "
38+ check_persistent_worker_failure " $command " | grep -q " Build failure with StackOverflowError"
39+
40+ RESPONSE_CODE=$?
41+ if [ $RESPONSE_CODE -ne 0 ]; then
42+ echo -e " ${RED} Scalac persistent worker does not handle StackOverflowError in macro expansion. $NC "
43+ exit 1
44+ fi
45+ }
46+
47+
3148$runner test_persistent_worker_success
3249$runner test_persistent_worker_failure
33- $runner test_persistent_worker_handles_exception_in_macro_invocation
50+ $runner test_persistent_worker_handles_exception_in_macro_invocation
51+ $runner test_persistent_worker_handles_stack_overflow_exception
0 commit comments