diff mbox series

[2/2] travis.yml: Detach build and test steps

Message ID 20191230184327.2800-3-wainersm@redhat.com
State New
Headers show
Series travis: Improve log browseability | expand

Commit Message

Wainer dos Santos Moschetta Dec. 30, 2019, 6:43 p.m. UTC
Currently build and test commands are a single step in a
Travis's `script` block. In order to see the output
of the tests one needs to scroll down the log to find where
the build messages ended and the limit is not clear. If
they were in different steps then Travis would print the
result build command, which can be easily grep'ed.

So this change is made to detach those commands
to ease the visualization of the output.

Note that all steps on the `script` block is executed regardless
if one previous has failed. To overcome it, let's save the
return code of the build then check whether succeed or failed on
the test step.

Signed-off-by: Wainer dos Santos Moschetta <wainersm@redhat.com>
---
 .travis.yml | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

Comments

Philippe Mathieu-Daudé Dec. 31, 2019, 5:10 p.m. UTC | #1
On 12/30/19 7:43 PM, Wainer dos Santos Moschetta wrote:
> Currently build and test commands are a single step in a
> Travis's `script` block. In order to see the output
> of the tests one needs to scroll down the log to find where
> the build messages ended and the limit is not clear. If
> they were in different steps then Travis would print the
> result build command, which can be easily grep'ed.
> 
> So this change is made to detach those commands
> to ease the visualization of the output.
> 
> Note that all steps on the `script` block is executed regardless
> if one previous has failed. To overcome it, let's save the
> return code of the build then check whether succeed or failed on
> the test step.

Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>

Tested with a broken test:
https://travis-ci.org/philmd/qemu/jobs/631341382

Tested-by: Philippe Mathieu-Daudé <philmd@redhat.com>

> 
> Signed-off-by: Wainer dos Santos Moschetta <wainersm@redhat.com>
> ---
>   .travis.yml | 3 ++-
>   1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/.travis.yml b/.travis.yml
> index e7fdcb238c..fcc9de368b 100644
> --- a/.travis.yml
> +++ b/.travis.yml
> @@ -94,7 +94,8 @@ before_script:
>     - mkdir -p ${BUILD_DIR} && cd ${BUILD_DIR}
>     - ${SRC_DIR}/configure ${BASE_CONFIG} ${CONFIG} || { cat config.log && exit 1; }
>   script:
> -  - make -j3 && travis_retry ${TEST_CMD}
> +  - BUILD_RC=0 && make -j3 || BUILD_RC=$?
> +  - if [ "$BUILD_RC" -eq 0 ] ; then travis_retry ${TEST_CMD} ; else $(exit $BUILD_RC); fi
>   after_script:
>     - if command -v ccache ; then ccache --show-stats ; fi
>   
>
diff mbox series

Patch

diff --git a/.travis.yml b/.travis.yml
index e7fdcb238c..fcc9de368b 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -94,7 +94,8 @@  before_script:
   - mkdir -p ${BUILD_DIR} && cd ${BUILD_DIR}
   - ${SRC_DIR}/configure ${BASE_CONFIG} ${CONFIG} || { cat config.log && exit 1; }
 script:
-  - make -j3 && travis_retry ${TEST_CMD}
+  - BUILD_RC=0 && make -j3 || BUILD_RC=$?
+  - if [ "$BUILD_RC" -eq 0 ] ; then travis_retry ${TEST_CMD} ; else $(exit $BUILD_RC); fi
 after_script:
   - if command -v ccache ; then ccache --show-stats ; fi