From 4597a0eb49f27af8d754ad9225565e32874b24ce Mon Sep 17 00:00:00 2001 From: Adam Roben Date: Mon, 2 Feb 2015 12:33:13 -0500 Subject: [PATCH 1/3] Shrink test output in CI Travis CI won't display build logs longer than 10,000 lines. Since we have so many tests, our CI logs get truncated and you can't see the test failures down at the end of the log. Instead of printing each test on its own line, we now just print out a single character for each test indiciating success (.), failure (F), or that the test was ignored (I). Failing tests are still printed in full at the end of the test run. --- .travis.yml | 2 +- scripts/shrink-test-output.py | 38 +++++++++++++++++++++++++++++++++++ 2 files changed, 39 insertions(+), 1 deletion(-) create mode 100755 scripts/shrink-test-output.py diff --git a/.travis.yml b/.travis.yml index 27600aff..8b8b64b6 100644 --- a/.travis.yml +++ b/.travis.yml @@ -11,7 +11,7 @@ script: - mkdir build - cd build - ../configure - - make check docs for_c + - make check docs for_c | ../scripts/shrink-test-output.py after_script: - cd /home/travis/build/servo/html5ever/target - curl http://www.rust-ci.org/artifacts/put?t=$RUSTCI_TOKEN | sh diff --git a/scripts/shrink-test-output.py b/scripts/shrink-test-output.py new file mode 100755 index 00000000..74be7b3b --- /dev/null +++ b/scripts/shrink-test-output.py @@ -0,0 +1,38 @@ +#!/usr/bin/env python +# Copyright 2015 The html5ever Project Developers. See the +# COPYRIGHT file at the top-level directory of this distribution. +# +# Licensed under the Apache License, Version 2.0 or the MIT license +# , at your +# option. This file may not be copied, modified, or distributed +# except according to those terms. + +import re +import sys + + +REPLACEMENTS = { + 'ok': '.', + 'FAILED': 'F', + 'ignored': 'I', +} +TEST_RESULT_RE = re.compile( + r'^test .* \.\.\. ({0})$'.format('|'.join(REPLACEMENTS.keys()))) + + +def main(): + while True: + line = sys.stdin.readline() + if len(line) is 0: + break + match = TEST_RESULT_RE.match(line) + if match: + sys.stdout.write(REPLACEMENTS[match.group(1)]) + else: + sys.stdout.write(line) + sys.stdout.flush() + + +if __name__ == '__main__': + sys.exit(main()) From d8140df65c298c0c2d4b7a9f7184b85cad315d89 Mon Sep 17 00:00:00 2001 From: Adam Roben Date: Tue, 3 Feb 2015 10:15:56 -0500 Subject: [PATCH 2/3] Move Travis build steps to a separate script --- .travis.yml | 6 +----- scripts/travis-build.sh | 16 ++++++++++++++++ 2 files changed, 17 insertions(+), 5 deletions(-) create mode 100755 scripts/travis-build.sh diff --git a/.travis.yml b/.travis.yml index 8b8b64b6..b21c7ee3 100644 --- a/.travis.yml +++ b/.travis.yml @@ -7,11 +7,7 @@ env: global: - secure: uytPp0Fs+LT3QDEhDM3LJWiLvT2AHbdWnXrPEs+bYshQwt9wST+KQnYLyRfBuGg2ux3pkZwsRUFexvN8pQ3ab4aU2P21Xo98TzdXRwXurNYePgk/3tykEH+JrL52DfjCWB1VsjzzFrP02XU0XtB30qWC/n+fxeMWT7JT2GVh/OE= language: rust -script: - - mkdir build - - cd build - - ../configure - - make check docs for_c | ../scripts/shrink-test-output.py +script: scripts/travis-build.sh after_script: - cd /home/travis/build/servo/html5ever/target - curl http://www.rust-ci.org/artifacts/put?t=$RUSTCI_TOKEN | sh diff --git a/scripts/travis-build.sh b/scripts/travis-build.sh new file mode 100755 index 00000000..5c98ad8b --- /dev/null +++ b/scripts/travis-build.sh @@ -0,0 +1,16 @@ +#!/bin/bash +# Copyright 2015 The html5ever Project Developers. See the +# COPYRIGHT file at the top-level directory of this distribution. +# +# Licensed under the Apache License, Version 2.0 or the MIT license +# , at your +# option. This file may not be copied, modified, or distributed +# except according to those terms. + +set -ex + +mkdir build +cd build +../configure +make check docs for_c | ../scripts/shrink-test-output.py From 6382bda2b1b2156275165976da38518163ce7681 Mon Sep 17 00:00:00 2001 From: Adam Roben Date: Tue, 3 Feb 2015 10:16:07 -0500 Subject: [PATCH 3/3] Make sure the Travis build fails when compiling fails Piping `make`'s output through `shrink-test-output.py` was swallowing `make`'s exit code. Now we explicitly use its exit code for the overall result of the build. --- scripts/travis-build.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/scripts/travis-build.sh b/scripts/travis-build.sh index 5c98ad8b..8a0148c1 100755 --- a/scripts/travis-build.sh +++ b/scripts/travis-build.sh @@ -14,3 +14,4 @@ mkdir build cd build ../configure make check docs for_c | ../scripts/shrink-test-output.py +exit ${PIPESTATUS[0]}