diff options
author | Andrew Gallant <jamslam@gmail.com> | 2018-02-06 15:53:17 -0500 |
---|---|---|
committer | Andrew Gallant <jamslam@gmail.com> | 2018-02-06 17:24:31 -0500 |
commit | e1f1ede17d4dc0ebfc216fa5759dbd76f136924a (patch) | |
tree | 71a5cd38f44f36ffbbefd4354fb4bb008568e607 /ci | |
parent | 65539403288c984c5175a612c9519437742fc95c (diff) |
ci: test build outputs
This modifies CI to check that we generate completion files and a man
page.
We also enable tests on arm.
Diffstat (limited to 'ci')
-rwxr-xr-x | ci/script.sh | 47 | ||||
-rw-r--r-- | ci/utils.sh | 49 |
2 files changed, 76 insertions, 20 deletions
diff --git a/ci/script.sh b/ci/script.sh index e9f9bcb3..60d9a2d5 100755 --- a/ci/script.sh +++ b/ci/script.sh @@ -7,14 +7,49 @@ set -ex . "$(dirname $0)/utils.sh" main() { - # disable_cross_doctests + # Travis sometimes caches the target directory, which makes testing the + # output of cargo a little trickier. So just wipe it. + cargo clean + # Test a normal debug build. cargo build --target "${TARGET}" --verbose --all - if [ "$(architecture)" = "amd64" ] || [ "$(architecture)" = "i386" ]; then - cargo test --target "${TARGET}" --verbose --all - "$( dirname "${0}" )/test_complete.sh" - fi + + # Show the output of build.rs stderr. + set +x + find ./target/"$TARGET"/debug -name stderr | while read stderr; do + if [ -s "$stderr" ]; then + echo "===== $stderr =====" + cat "$stderr" + echo "=====" + fi + done + set -x + # sanity check the file type - file target/$TARGET/debug/rg + file target/"$TARGET"/debug/rg + + # Apparently tests don't work on arm, so just bail now. I guess we provide + # ARM releases on a best effort basis? + if is_arm; then + return 0 + fi + + # Test that zsh completions are in sync with ripgrep's actual args. + "$(dirname "${0}")/test_complete.sh" + + # Check that we've generated man page and other shell completions. + find ./target/"$TARGET"/debug/build/ripgrep-* -name 'out' | \ + while read outdir; do + file "$outdir/rg.bash" + file "$outdir/rg.fish" + file "$outdir/_rg.ps1" + # man page requires asciidoc, and we only install it on Linux x86. + if is_linux; then + file "$outdir/rg.1" + fi + done + + # Run tests for ripgrep and all sub-crates. + cargo test --target "${TARGET}" --verbose --all } main diff --git a/ci/utils.sh b/ci/utils.sh index 61428ecb..7a6e8fc9 100644 --- a/ci/utils.sh +++ b/ci/utils.sh @@ -13,17 +13,6 @@ host() { esac } -gcc_prefix() { - case "$TARGET" in - arm*-gnueabihf) - echo arm-linux-gnueabihf- - ;; - *) - return - ;; - esac -} - architecture() { case "$TARGET" in x86_64-*) @@ -41,9 +30,41 @@ architecture() { esac } +gcc_prefix() { + case "$(architecture)" in + armhf) + echo arm-linux-gnueabihf- + ;; + *) + return + ;; + esac +} + is_ssse3_target() { - case "$TARGET" in - x86_64*) return 0 ;; - *) return 1 ;; + case "$(architecture)" in + amd64) return 0 ;; + *) return 1 ;; + esac +} + +is_x86() { + case "$(architecture)" in + amd64|i386) return 0 ;; + *) return 1 ;; + esac +} + +is_arm() { + case "$(architecture)" in + armhf) return 0 ;; + *) return 1 ;; + esac +} + +is_linux() { + case "$TRAVIS_OS_NAME" in + linux) return 0 ;; + *) return 1 ;; esac } |