aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/test
diff options
context:
space:
mode:
authorGravatar philwo <philwo@google.com>2017-11-23 08:30:07 -0800
committerGravatar Copybara-Service <copybara-piper@google.com>2017-11-23 08:33:18 -0800
commitb24a6f96b1e405568eb7895e4242e76fd5bcb719 (patch)
tree8c9572f73d31bed68e5e60934e15dfdb6c65a762 /src/test
parente14dcc37eb688da8881a782cc689907fd985f0c5 (diff)
PiperOrigin-RevId: 176774887
Diffstat (limited to 'src/test')
-rwxr-xr-xsrc/test/shell/integration/test_test.sh27
1 files changed, 27 insertions, 0 deletions
diff --git a/src/test/shell/integration/test_test.sh b/src/test/shell/integration/test_test.sh
index 5a35ababa7..d288fefa17 100755
--- a/src/test/shell/integration/test_test.sh
+++ b/src/test/shell/integration/test_test.sh
@@ -101,4 +101,31 @@ EOF
expect_log 'were skipped'
}
+# Regression test for b/67463263: Tests that spawn subprocesses must not block
+# if those subprocesses never finish. If this test fails, because the "my_test"
+# test is timing out, it means that Bazel is waiting for the "sleep" to finish,
+# which it shouldn't.
+function test_process_spawned_by_test_doesnt_block_test_from_completing() {
+ mkdir -p dir
+
+ cat > dir/BUILD <<'EOF'
+java_test(
+ name = "my_test",
+ main_class = "MyTest",
+ srcs = ["MyTest.java"],
+ timeout = "short",
+ use_testrunner = 0,
+)
+EOF
+ cat > dir/MyTest.java <<'EOF'
+public class MyTest {
+ public static void main(String[] args) throws Exception {
+ new ProcessBuilder("sleep", "300").inheritIO().start();
+ }
+}
+EOF
+
+ bazel test //dir:my_test &> $TEST_log || fail "expected test to pass"
+}
+
run_suite "test tests"