diff options
author | 2015-10-08 13:16:08 +0000 | |
---|---|---|
committer | 2015-10-09 14:39:54 +0000 | |
commit | fd3de864878e4a273cc7dd9407d0111676e0a168 (patch) | |
tree | 094882656005a1bd1564fee5c955bdf71d2ea41a /src | |
parent | 90178f4471d67799b2dbaa07f19809d1b00b91d2 (diff) |
Slight tweakings to process-wrapper_test.sh on my quest to find the cause of its flakyness.
--
MOS_MIGRATED_REVID=104955920
Diffstat (limited to 'src')
-rwxr-xr-x | src/test/shell/bazel/process-wrapper_test.sh | 31 |
1 files changed, 20 insertions, 11 deletions
diff --git a/src/test/shell/bazel/process-wrapper_test.sh b/src/test/shell/bazel/process-wrapper_test.sh index 231b9e52ce..dba3120f9c 100755 --- a/src/test/shell/bazel/process-wrapper_test.sh +++ b/src/test/shell/bazel/process-wrapper_test.sh @@ -41,47 +41,56 @@ function assert_output() { } function test_basic_functionality() { - $WRAPPER -1 0 $OUT $ERR /bin/echo hi there || fail + $WRAPPER -1 0 $OUT $ERR /bin/echo hi there &> $TEST_log || fail assert_output "hi there" "" } function test_to_stderr() { - $WRAPPER -1 0 $OUT $ERR /bin/bash -c "/bin/echo hi there >&2" || fail + $WRAPPER -1 0 $OUT $ERR /bin/bash -c "/bin/echo hi there >&2" &> $TEST_log || fail assert_output "" "hi there" } function test_exit_code() { - $WRAPPER -1 0 $OUT $ERR /bin/bash -c "exit 71" || code=$? + local code=0 + $WRAPPER -1 0 $OUT $ERR /bin/bash -c "exit 71" &> $TEST_log || code=$? assert_equals 71 "$code" } function test_signal_death() { - $WRAPPER -1 0 $OUT $ERR /bin/bash -c 'kill -ABRT $$' || code=$? + local code=0 + $WRAPPER -1 0 $OUT $ERR /bin/bash -c 'kill -ABRT $$' &> $TEST_log || code=$? assert_equals 134 "$code" # SIGNAL_BASE + SIGABRT = 128 + 6 } function test_signal_catcher() { - $WRAPPER 2 3 $OUT $ERR /bin/bash -c \ - 'trap "echo later; exit 0" SIGINT SIGTERM SIGALRM; sleep 1000' || code=$? + set -x + local code=0 + $WRAPPER 1 2 $OUT $ERR /bin/bash -c \ + 'trap "echo later; exit 0" SIGINT SIGTERM SIGALRM; sleep 10' &> $TEST_log || code=$? assert_equals 142 "$code" # SIGNAL_BASE + SIGALRM = 128 + 14 assert_stdout "later" + set +x } function test_basic_timeout() { - $WRAPPER 3 3 $OUT $ERR /bin/bash -c "echo before; sleep 1000; echo after" && fail + $WRAPPER 1 2 $OUT $ERR /bin/bash -c "echo before; sleep 10; echo after" &> $TEST_log && fail assert_stdout "before" } function test_timeout_grace() { - $WRAPPER 2 3 $OUT $ERR /bin/bash -c \ - 'trap "echo -n before; sleep 1; echo -n after; exit 0" SIGINT SIGTERM SIGALRM; sleep 1000' || code=$? + local code=0 + $WRAPPER 1 2 $OUT $ERR /bin/bash -c \ + 'trap "echo -n before; sleep 1; echo after; exit 0" SIGINT SIGTERM SIGALRM; sleep 10' \ + &> $TEST_log || code=$? assert_equals 142 "$code" # SIGNAL_BASE + SIGALRM = 128 + 14 assert_stdout "beforeafter" } function test_timeout_kill() { - $WRAPPER 2 3 $OUT $ERR /bin/bash -c \ - 'trap "echo before; sleep 1000; echo after; exit 0" SIGINT SIGTERM SIGALRM; sleep 1000' || code=$? + local code=0 + $WRAPPER 1 2 $OUT $ERR /bin/bash -c \ + 'trap "echo before; sleep 10; echo after; exit 0" SIGINT SIGTERM SIGALRM; sleep 10' \ + &> $TEST_log || code=$? assert_equals 142 "$code" # SIGNAL_BASE + SIGALRM = 128 + 14 assert_stdout "before" } |