From b24a6f96b1e405568eb7895e4242e76fd5bcb719 Mon Sep 17 00:00:00 2001 From: philwo Date: Thu, 23 Nov 2017 08:30:07 -0800 Subject: Add regression test for breakage caused by https://github.com/bazelbuild/bazel/commit/0ebb3e54fc890946ae6b3d059ecbd50e4b5ec840. PiperOrigin-RevId: 176774887 --- src/test/shell/integration/test_test.sh | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) 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" -- cgit v1.2.3