travis: skip tests when the build fails

If the build fails, most tests will fail due to lack of tshark.
Terminate early to avoid this. The "before_install" and "before_script"
stages exit immediately with the first failing command, but "script" and
"after_script" stages do not. This is due to "assert: false" in [1].
Explicitly call [2] to achieve the same exit-on-failure behavior.

 [1]: https://github.com/travis-ci/travis-build/blob/master/lib/travis/build/stages.rb
 [2]: https://github.com/travis-ci/travis-build/blob/master/lib/travis/build/bash/travis_assert.bash

Remove unnecessary "cd" while at it, it only existed to workaround a bug
with the cache directory on Windows.

Change-Id: Iabdffc26d55bd5c08d27e400a67657d5e69a5c60
Reviewed-on: https://code.wireshark.org/review/37013
Reviewed-by: Dario Lombardo <lomato@gmail.com>
Reviewed-by: Peter Wu <peter@lekensteyn.nl>
This commit is contained in:
Peter Wu 2020-05-01 23:38:14 +02:00
parent be63a17e54
commit 6341185a49
1 changed files with 1 additions and 3 deletions

View File

@ -73,12 +73,10 @@ before_script:
- cd build
- cmake -GNinja ..
script:
- ninja
- ninja || travis_assert
- ninja test-programs
- if [ "$TRAVIS_OS_NAME" == "linux" ]; then sudo setcap cap_net_raw,cap_net_admin+eip run/dumpcap; fi
- pytest
- cd ..
after_script:
- cd build
- if [ -f run/tshark ]; then run/tshark --version; fi
- ../test/travis-upload-artifacts.sh