diff options
author | Donna Dionne <donnadionne@google.com> | 2015-02-02 15:06:42 -0800 |
---|---|---|
committer | Donna Dionne <donnadionne@google.com> | 2015-02-02 15:06:42 -0800 |
commit | 851f591956ee908347d64bf2ed6d137b963e4d9b (patch) | |
tree | 1e775cfe425600d1bcf39cdd54eb1c167b99edd7 /tools/gce_setup | |
parent | bff9f49579fa03ff281792c497a17c9edc739f62 (diff) |
Adding timeout for each test run so that failed tests do not block the running of the rest of the tests.
Diffstat (limited to 'tools/gce_setup')
-rwxr-xr-x | tools/gce_setup/interop_test_runner.sh | 42 |
1 files changed, 34 insertions, 8 deletions
diff --git a/tools/gce_setup/interop_test_runner.sh b/tools/gce_setup/interop_test_runner.sh index 1c0d82095c..8ad5e82f1e 100755 --- a/tools/gce_setup/interop_test_runner.sh +++ b/tools/gce_setup/interop_test_runner.sh @@ -1,4 +1,33 @@ #!/bin/bash +thisfile=$(readlink -ne "${BASH_SOURCE[0]}") + +run_test() { + local test_case=$1 + shift + local client=$1 + shift + local server=$1 + if grpc_interop_test $test_case grpc-docker-testclients $client grpc-docker-server $server + then + echo "$test_case $client $server passed" >> /tmp/interop_result.txt + else + echo "$test_case $client $server failed" >> /tmp/interop_result.txt + fi +} + +time_out() { + local test_case=$1 + shift + local client=$1 + shift + local server=$1 + if [[ "${BASH_SOURCE[0]}" == "${0}" ]]; then + if ! timeout 20s bash -l -c "source $thisfile && run_test $test_case $client $server" + then + echo "$test_case $client $server timed out" >> /tmp/interop_result.txt + fi + fi +} main() { source grpc_docker.sh @@ -11,17 +40,14 @@ main() { do for server in "${servers[@]}" do - if grpc_interop_test $test_case grpc-docker-testclients $client grpc-docker-server $server - then - echo "$test_case $client $server passed" >> /tmp/interop_result.txt - else - echo "$test_case $client $server failed" >> /tmp/interop_result.txt - fi + time_out $test_case $client $server done done done - gsutil cp /tmp/interop_result.txt gs://stoked-keyword-656-output/interop_result.txt - rm /tmp/interop_result.txt + if [[ "${BASH_SOURCE[0]}" == "${0}" ]]; then + gsutil cp /tmp/interop_result.txt gs://stoked-keyword-656-output/interop_result.txt + rm /tmp/interop_result.txt + fi } set -x |