KVM Archive on lore.kernel.org
 help / color / Atom feed
* [kvm-unit-tests] travis.yml: Prevent 'script' section from premature exit
@ 2020-01-13 19:51 Wainer dos Santos Moschetta
  2020-01-14 16:48 ` Thomas Huth
  0 siblings, 1 reply; 3+ messages in thread
From: Wainer dos Santos Moschetta @ 2020-01-13 19:51 UTC (permalink / raw)
  To: kvm; +Cc: pbonzini, thuth

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 build command. In this change, it executes a
sub-shell process and exit 1, so that Travis capture the return
code and interpret it as a build error.

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

diff --git a/.travis.yml b/.travis.yml
index 091d071..a4405c3 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -119,5 +119,5 @@ 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
+  - if grep -q FAIL results.txt ; then $(exit 1) ; fi
+  - if ! grep -q PASS results.txt ; then $(exit 1) ; fi
-- 
2.23.0


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [kvm-unit-tests] travis.yml: Prevent 'script' section from premature exit
  2020-01-13 19:51 [kvm-unit-tests] travis.yml: Prevent 'script' section from premature exit Wainer dos Santos Moschetta
@ 2020-01-14 16:48 ` Thomas Huth
  2020-01-14 17:47   ` Wainer dos Santos Moschetta
  0 siblings, 1 reply; 3+ messages in thread
From: Thomas Huth @ 2020-01-14 16:48 UTC (permalink / raw)
  To: Wainer dos Santos Moschetta, kvm; +Cc: pbonzini

On 13/01/2020 20.51, Wainer dos Santos Moschetta wrote:
> 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 build command. In this change, it executes a
> sub-shell process and exit 1, so that Travis capture the return
> code and interpret it as a build error.
> 
> Signed-off-by: Wainer dos Santos Moschetta <wainersm@redhat.com>
> ---
>  .travis.yml | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/.travis.yml b/.travis.yml
> index 091d071..a4405c3 100644
> --- a/.travis.yml
> +++ b/.travis.yml
> @@ -119,5 +119,5 @@ 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
> +  - if grep -q FAIL results.txt ; then $(exit 1) ; fi
> +  - if ! grep -q PASS results.txt ; then $(exit 1) ; fi

Basically a good idea, but I think we can even simplify these two lines
into:

 grep -q PASS results.txt && ! grep -q FAIL results.txt

If you agree, could you update your patch and send a v2?

 Thanks,
  Thomas


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [kvm-unit-tests] travis.yml: Prevent 'script' section from premature exit
  2020-01-14 16:48 ` Thomas Huth
@ 2020-01-14 17:47   ` Wainer dos Santos Moschetta
  0 siblings, 0 replies; 3+ messages in thread
From: Wainer dos Santos Moschetta @ 2020-01-14 17:47 UTC (permalink / raw)
  To: Thomas Huth, kvm; +Cc: pbonzini


On 1/14/20 2:48 PM, Thomas Huth wrote:
> On 13/01/2020 20.51, Wainer dos Santos Moschetta wrote:
>> 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 build command. In this change, it executes a
>> sub-shell process and exit 1, so that Travis capture the return
>> code and interpret it as a build error.
>>
>> Signed-off-by: Wainer dos Santos Moschetta <wainersm@redhat.com>
>> ---
>>   .travis.yml | 4 ++--
>>   1 file changed, 2 insertions(+), 2 deletions(-)
>>
>> diff --git a/.travis.yml b/.travis.yml
>> index 091d071..a4405c3 100644
>> --- a/.travis.yml
>> +++ b/.travis.yml
>> @@ -119,5 +119,5 @@ 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
>> +  - if grep -q FAIL results.txt ; then $(exit 1) ; fi
>> +  - if ! grep -q PASS results.txt ; then $(exit 1) ; fi
> Basically a good idea, but I think we can even simplify these two lines
> into:
>
>   grep -q PASS results.txt && ! grep -q FAIL results.txt

Indeed this is a better idea.

>
> If you agree, could you update your patch and send a v2?

Sure, I will send the v2 with your proposed changes. Thanks!

- Wainer

>
>   Thanks,
>    Thomas


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, back to index

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-01-13 19:51 [kvm-unit-tests] travis.yml: Prevent 'script' section from premature exit Wainer dos Santos Moschetta
2020-01-14 16:48 ` Thomas Huth
2020-01-14 17:47   ` Wainer dos Santos Moschetta

KVM Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/kvm/0 kvm/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 kvm kvm/ https://lore.kernel.org/kvm \
		kvm@vger.kernel.org
	public-inbox-index kvm

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kernel.vger.kvm


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git