[ovs-dev] [PATCH] tests: Make compatible with FreeBSD's xargs

Ed Maste emaste at freebsd.org
Tue Jul 31 03:10:23 UTC 2012


On 30 July 2012 20:16, Ben Pfaff <blp at nicira.com> wrote:
> On Mon, Jul 30, 2012 at 07:23:48PM -0400, Ed Maste wrote:
>> The FreeBSD version of xargs does not run the utility argument on empty
>> input, while GNU xargs runs it at least once, even with empty input.  As
>> a result on FreeBSD VSCTL_CHECK_FIND returned no output for an empty
>> bridge list while on Linux it returned a single blank line.  Add a new
>> VSCTL_CHECK_FIND_EMPTY to explicitly match an empty bridge list.
>>
>> Signed-off-by: Ed Maste <emaste at freebsd.org>
>
> I think that we could avoid the need for VSCTL_CHECK_FIND_EMPTY by
> changing
>         | sort | xargs echo
> in VSCTL_CHECK_FDIN to
>         m4_if([$2], [], [], [| sort | xargs echo])

I tried it and it doesn't work - I think because ovs-vsctl is
producing no output and the AT_CHECK requires a newline.  It's a bit
hackish but can make work with echo `...` - what do you think?

--- a/tests/ovs-vsctl.at
+++ b/tests/ovs-vsctl.at
@@ -769,7 +769,7 @@ AT_CHECK(

 ])
 m4_define([VSCTL_CHECK_FIND],
-  [AT_CHECK([ovs-vsctl --bare --timeout=5 --no-wait -vreconnect:emer
--db=unix:socket -- --columns=name find bridge '$1' | sort | xargs
echo], [0], [$2
+  [AT_CHECK([echo `ovs-vsctl --bare --timeout=5 --no-wait
-vreconnect:emer --db=unix:socket -- --columns=name find bridge '$1' |
sort`], [0], [$2
 ])])

 # Arithmetic relational operators without keys.



More information about the dev mailing list