[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Automake-NG] [PATCH 1/6] [ng] coverage: testing with lots of test s
From: |
Akim Demaille |
Subject: |
Re: [Automake-NG] [PATCH 1/6] [ng] coverage: testing with lots of test scripts |
Date: |
Sun, 22 Jul 2012 10:49:44 +0200 |
Le 22 juil. 2012 à 09:58, Stefano Lattarini a écrit :
>> I personally use it extensively in my test suites, as I find this
>> much more legible:
>>
>> ! list_logs | grep .
>>
> Ah, but this doesn't do what you expect:
>
> $ bash -c '! echo x | grep .'; echo st = $?
> x
> st = 0
> $ bash -c '! echo | grep .'; echo st = $?
> st = 1
>
> To "deny" the pipeline, you need to enclose it in "()" or "{}":
>
> $ bash -c '! (echo x | grep .)'; echo st = $?
> x
> st = 1
> $ bash -c '! (echo | grep .)'; echo st = $?
> st = 0
>
> Which proves that my preferred idiom was actually clear :-)
Actually, you should display the exit status of the command, not
that of the shell. And really, that's brand new to me, and my
bash 3.2 does not seem to agree.
bash -c '! echo x | grep .'; echo st = $?
x
st = 1
The ! is about the exit status of the whole pipe. The doc reads:
A `pipeline' is a sequence of simple commands separated by `|'.
The format for a pipeline is
[`time' [`-p']] [`!'] COMMAND1 [`|' COMMAND2 …]
If the reserved word ! precedes a pipeline, the exit status of that
pipeline is the logical negation of the exit status as described above.
http://pubs.opengroup.org/onlinepubs/009695399/utilities/xcu_chap02.html
states the same. I don't understand how you have your first result.
[Automake-NG] [PATCH 3/6] [ng] check: use awk rather than grep+xargs to count test results, Stefano Lattarini, 2012/07/21
[Automake-NG] [PATCH 4/6] [ng] check: refactor for less duplication and better performances, Stefano Lattarini, 2012/07/21
[Automake-NG] [PATCH 5/6] [ng] coverage: recheck with many failed tests, Stefano Lattarini, 2012/07/21