@@ -7,6 +7,12 @@ runner=$(get_test_runner "${1:-local}")
7
7
8
8
PERSISTENT_WORKER_FLAGS=" --strategy=Scalac=worker --worker_sandboxing"
9
9
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
+
10
16
test_persistent_worker_success () {
11
17
# shellcheck disable=SC2086
12
18
bazel build //test:ScalaBinary $PERSISTENT_WORKER_FLAGS
@@ -17,9 +23,8 @@ test_persistent_worker_failure() {
17
23
}
18
24
19
25
test_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"
23
28
24
29
RESPONSE_CODE=$?
25
30
if [ $RESPONSE_CODE -ne 0 ]; then
@@ -28,6 +33,19 @@ test_persistent_worker_handles_exception_in_macro_invocation() {
28
33
fi
29
34
}
30
35
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
+
31
48
$runner test_persistent_worker_success
32
49
$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