autoconf
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Why my AT_CHECK() can't work?


From: Eric Blake
Subject: Re: Why my AT_CHECK() can't work?
Date: Wed, 9 Aug 2017 09:32:34 -0500
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.2.1

On 08/09/2017 04:15 AM, Sam wrote:
> Hi all,
> 
> I'm using autotest to test ovs, and I write a new *.at file using only one
> AT_CHECK sentence like this:
> 
> AT_CHECK([ovs-appctl dpdk/bond-show dpdkb2], [0], [stdout])
>> AT_CHECK([[sed '/ACTIVE/p' stdout | head -4]], [0], [[LACP actor_state

Note - this invocation of sed will print EVERY line, as well as printing
the lines that contain ACTIVE a second time.

Also, 'head -4' is obsolete syntax that is not portable to all machines;
'sed -n4' is newer (and given your use of ovs-appctl, probably works on
all machines that you care about).

You probably meant to use [[sed -n '/ACTIVE/p' stdout | head -n4]] or
even [[grep ACTIVE stdout | head -n4]]

>> ACTIVE AGGREGATION SYNC COLLECTING DISTRIBUTING
>>      partner_state ACTIVE AGGREGATION SYNC COLLECTING DISTRIBUTING
>> LACP actor_state ACTIVE AGGREGATION SYNC COLLECTING DISTRIBUTING
>>      partner_state ACTIVE AGGREGATION SYNC COLLECTING DISTRIBUTING]])
> 

>> ./netdev-dpdk.at:28: sed '/ACTIVE/p' stdout | head -4
>> --- -   2017-08-09 16:59:18.802810195 +0800
>> +++ /home/gangyewei-3/mvs/mvs/tests/testsuite.dir/at-groups/789/stdout
>>  2017-08-09 16:59:18.801176471 +0800
>> @@ -1,4 +1,5 @@
>> -LACP actor_state ACTIVE AGGREGATION SYNC COLLECTING DISTRIBUTING
>> -     partner_state ACTIVE AGGREGATION SYNC COLLECTING DISTRIBUTING
>> -LACP actor_state ACTIVE AGGREGATION SYNC COLLECTING DISTRIBUTING
>> -     partner_state ACTIVE AGGREGATION SYNC COLLECTING DISTRIBUTING
>> +---- dpdkb2 ----
>> +bond_mode: 4
>> +
>> +slave 0:
>> +
>> 789. netdev-dpdk.at:23: 789. netdev-dpdk - dpdk/bond-show (
>> netdev-dpdk.at:23): FAILED (netdev-dpdk.at:28)
> 
> 
> 1. I don't know what "+" "-" means, and why there are "+" and "-"?

That is the output of 'diff'.  '-' lines are what you EXPECTED the
output to contain, '+' lines are what the output ACTUALLY contained.

> 2. I run `ovs-appctl dpdk/bond-show dpdkb2 | sed -n '/ACTIVE/p' | head -4`,
> result is:

Notice that what you ran by hand limited the sed output to just the
interesting lines, rather than the first four lines where lines
containing ACTIVE were doubled.

> That's exactly what I matched in AT_CHECK, why it fails?

No, it's not exactly what you passed to AT_CHECK ;)

-- 
Eric Blake, Principal Software Engineer
Red Hat, Inc.           +1-919-301-3266
Virtualization:  qemu.org | libvirt.org

Attachment: signature.asc
Description: OpenPGP digital signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]