diff mbox series

[ovs-dev] ovn-nbctl test: Add different search string for getopt BSD variant

Message ID 20180816154325.15524-1-aserdean@ovn.org
State Changes Requested
Headers show
Series [ovs-dev] ovn-nbctl test: Add different search string for getopt BSD variant | expand

Commit Message

Alin-Gabriel Serdean Aug. 16, 2018, 3:43 p.m. UTC
2714. ovn-nbctl.at:1443: testing ovn-nbctl - commands parser error paths

fails due to:
ovn-nbctl.at:1443: ovn-nbctl --if-exists=foo list Logical_Switch
stderr:
ovn-nbctl: option '--if-exists=foo' requires an argument
./ovn-nbctl.at:1443: grep 'option .* doesn'\''t allow an argument' stderr
stdout:
./ovn-nbctl.at:1443: exit code was 1, expected 0

This is due to the difference between getopt BSD and GNU variant.

Signed-off-by: Alin Gabriel Serdean <aserdean@ovn.org>
---
 tests/ovn-nbctl.at | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Ben Pfaff Aug. 16, 2018, 3:58 p.m. UTC | #1
On Thu, Aug 16, 2018 at 06:43:25PM +0300, Alin Gabriel Serdean wrote:
> 2714. ovn-nbctl.at:1443: testing ovn-nbctl - commands parser error paths
> 
> fails due to:
> ovn-nbctl.at:1443: ovn-nbctl --if-exists=foo list Logical_Switch
> stderr:
> ovn-nbctl: option '--if-exists=foo' requires an argument
> ./ovn-nbctl.at:1443: grep 'option .* doesn'\''t allow an argument' stderr
> stdout:
> ./ovn-nbctl.at:1443: exit code was 1, expected 0
> 
> This is due to the difference between getopt BSD and GNU variant.
> 
> Signed-off-by: Alin Gabriel Serdean <aserdean@ovn.org>
> ---
>  tests/ovn-nbctl.at | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/tests/ovn-nbctl.at b/tests/ovn-nbctl.at
> index 725665b76..d10fbb10d 100644
> --- a/tests/ovn-nbctl.at
> +++ b/tests/ovn-nbctl.at
> @@ -1484,7 +1484,7 @@ AT_CHECK([grep 'missing argument to .* option' stderr], [0], [ignore])
>  
>  dnl Unexpected option argument
>  AT_CHECK([ovn-nbctl --if-exists=foo list Logical_Switch], [1], [], [stderr])
> -AT_CHECK([grep 'option .* doesn'\''t allow an argument' stderr], [0], [ignore])
> +AT_CHECK([grep 'option .* doesn'\''t allow an argument\|option .* requires an argument' stderr], [0], [ignore])

Thanks for the fix.

I think that \| is a GNU extension to grep.  I would change grep to
egrep and then change \| to plain |.

With that:

Acked-by: Ben Pfaff <blp@ovn.org>
diff mbox series

Patch

diff --git a/tests/ovn-nbctl.at b/tests/ovn-nbctl.at
index 725665b76..d10fbb10d 100644
--- a/tests/ovn-nbctl.at
+++ b/tests/ovn-nbctl.at
@@ -1484,7 +1484,7 @@  AT_CHECK([grep 'missing argument to .* option' stderr], [0], [ignore])
 
 dnl Unexpected option argument
 AT_CHECK([ovn-nbctl --if-exists=foo list Logical_Switch], [1], [], [stderr])
-AT_CHECK([grep 'option .* doesn'\''t allow an argument' stderr], [0], [ignore])
+AT_CHECK([grep 'option .* doesn'\''t allow an argument\|option .* requires an argument' stderr], [0], [ignore])
 
 AT_CHECK([ovn-nbctl -- --if-exists=foo list Logical_Switch], [1], [], [stderr])
 AT_CHECK([grep 'option on .* does not accept an argument' stderr], [0], [ignore])