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
_______________________________________________ Autoconf mailing list Autoconf@xxxxxxx https://lists.gnu.org/mailman/listinfo/autoconf