[Top][All Lists]

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

Re: AT_CHECK within for loop

From: Eric Blake
Subject: Re: AT_CHECK within for loop
Date: Fri, 28 Jan 2011 07:47:16 -0700
User-agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv: Gecko/20101209 Fedora/3.1.7-0.35.b3pre.fc14 Lightning/1.0b3pre Mnenhy/0.8.3 Thunderbird/3.1.7

On 01/27/2011 05:20 PM, Daily, Jeff A wrote:
> In a nutshell, I've written a drop-in replacement of another tool and would 
> like to test that it functions identical to the original.  All you need to 
> know about these tools is that they take as input one or more binary files 
> and produce a single binary file.  Of course they do more than that, but the 
> details aren't important.  Also, in order to compare the binary output files, 
> I've written another tool "pgcmp".
> The input files are stored in a data directory.  The number of files in this 
> directory can change.  It'd like to perform the same tests against every 
> input file in the data directory, but have the ability to skep files which 
> might not meet some sort of criteria.  Something like:
> AT_SETUP([testing $file, no arguments])
> for file in $datadir/*
> do
>       AS_IF([bad $file], [continue])
>       AT_CHECK([replacement $file -o replacement.out])
>       AT_CHECK([original $file -o original.out])
>       AT_CHECK([pgcmp replacement.out original.out])
> done
> Is this allowed/okay?

Absolutely!  AT_CHECK is just a macro that expands to shell code; it is
perfectly legal to surround it by additional shell code that adds
conditions on whether the AT_CHECK will be reached.

Eric Blake   address@hidden    +1-801-349-2682
Libvirt virtualization library

Attachment: signature.asc
Description: OpenPGP digital signature

reply via email to

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