Skip to contentSkip to conversation

travis.yml: Prevent 'script' from premature exit

PATCH In review Wainer dos Santos Moschetta 2 participants 2 messages Jan 15, 2020 KVM

lore
Share & tools
lore
#0 lore raw

PATCH v3 1/1 travis.yml: Prevent 'script' from premature exit

The 'script' section finishes its execution prematurely whenever a shell's exit is called. If the intention is to force Travis to flag a build/test failure then the correct approach is erroring any command statement. In this change, it combines the grep's in a single AND statement that in case of false Travis will interpret as a build error.

---
Changes v2 to v3:
- Do not grep for SKIP, it needs at least one PASS [thuth]
Changes v1 to v2:
- Simplify the grep's in a single statement [thuth]
- Also grep for SKIP (besides PASS) [myself]

 .travis.yml | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
.travis.yml +1 -2
index 091d071..f0cfc82 100644
@@ -119,5 +119,4 @@ before_script:
 script:
   - make -j3
   - ACCEL="${ACCEL:-tcg}" ./run_tests.sh -v $TESTS | tee results.txt
-  - if grep -q FAIL results.txt ; then exit 1 ; fi
-  - if ! grep -q PASS results.txt ; then exit 1 ; fi
+  - grep -q PASS results.txt && ! grep -q FAIL results.txt
Signature · 1 line
2.23.0
Reviewed-by on v3 1/1
#1 lore raw
Quoted 22 lines · Wainer dos Santos Moschetta

The 'script' section finishes its execution prematurely whenever a shell's exit is called. If the intention is to force Travis to flag a build/test failure then the correct approach is erroring any command statement. In this change, it combines the grep's in a single AND statement that in case of false Travis will interpret as a build error.

---
Changes v2 to v3:
- Do not grep for SKIP, it needs at least one PASS [thuth]
Changes v1 to v2:
- Simplify the grep's in a single statement [thuth]
- Also grep for SKIP (besides PASS) [myself]

 .travis.yml | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
.travis.yml +0 -0
index 091d071..f0cfc82 100644

.travis.yml before_script: · line 122

Quoted 6 lines
.travis.yml +1 -2
@@ -119,5 +119,4 @@ before_script:
 script:
   - make -j3
   - ACCEL="${ACCEL:-tcg}" ./run_tests.sh -v $TESTS | tee results.txt
-  - if grep -q FAIL results.txt ; then exit 1 ; fi
-  - if ! grep -q PASS results.txt ; then exit 1 ; fi
+  - grep -q PASS results.txt && ! grep -q FAIL results.txt