diff --git a/.travis.yml b/.travis.yml index 0716dafdf..f221cd87a 100644 --- a/.travis.yml +++ b/.travis.yml @@ -16,6 +16,7 @@ env: - BROWSER_STACK_USERNAME=angularteam1 - BROWSER_STACK_ACCESS_KEY=BWCd4SynLzdDcv8xtzsB - BROWSER_PROVIDER_READY_FILE=/tmp/material-angular-io-build/readyfile + - BROWSER_PROVIDER_ERROR_FILE=/tmp/material-angular-io-build/errorfile matrix: - MODE=lint - MODE=e2e diff --git a/scripts/browserstack/block-tunnel.sh b/scripts/browserstack/block-tunnel.sh index cb2e7d153..23f26952e 100755 --- a/scripts/browserstack/block-tunnel.sh +++ b/scripts/browserstack/block-tunnel.sh @@ -1,10 +1,19 @@ #!/bin/bash +TUNNEL_LOG="$LOGS_DIR/browserstack-tunnel.log" # Wait for Connect to be ready before exiting # Time out if we wait for more than 2 minutes, so the process won't run forever. let "counter=0" +# Exit the process if there are errors reported. Print the tunnel log to the console. +if [ -f $BROWSER_PROVIDER_ERROR_FILE ]; then + echo + echo "An error occurred while starting the tunnel. See error:" + cat $TUNNEL_LOG + exit 5 +fi + while [ ! -f $BROWSER_PROVIDER_READY_FILE ]; do let "counter++" diff --git a/scripts/browserstack/start-tunnel.sh b/scripts/browserstack/start-tunnel.sh index 4d7783101..22e203b71 100755 --- a/scripts/browserstack/start-tunnel.sh +++ b/scripts/browserstack/start-tunnel.sh @@ -16,10 +16,10 @@ touch $TUNNEL_LOG cd $TUNNEL_DIR -# Download the saucelabs connect binaries. +# Download the browserstack local binaries. curl $TUNNEL_URL -o $TUNNEL_FILE 2> /dev/null 1> /dev/null -# Extract the saucelabs connect binaries from the tarball. +# Extract the browserstack local binaries from the tarball. mkdir -p browserstack-tunnel unzip -q $TUNNEL_FILE -d browserstack-tunnel @@ -43,7 +43,7 @@ function create_ready_file { # To be able to exit the tail properly we need to have a sub shell spawned, which is # used to track the state of tail. - sleep 120 & + { sleep 120; touch $BROWSER_PROVIDER_ERROR_FILE; } & TIMER_PID=$! @@ -56,6 +56,7 @@ function create_ready_file { tail -n0 -f $TUNNEL_LOG --pid $TIMER_PID | { sed '/Ctrl/q' && kill -9 $TIMER_PID; }; } &> /dev/null + echo echo "BrowserStack Tunnel ready" touch $BROWSER_PROVIDER_READY_FILE