autoconf
[Top][All Lists]
Advanced

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

regression tests: AT_DATA that can copy files?


From: Frederik Heber
Subject: regression tests: AT_DATA that can copy files?
Date: Tue, 26 Apr 2011 15:50:11 +0200
User-agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.14) Gecko/20110223 Thunderbird/3.1.8

Hey folks,

I need a hand with my regression tests and hope you find some time to
help me on.

I have some executable, let's call it 'foo', that parses a file,
performs something, saves the file.

I have regression testsuites for this code, each in the following manner:

AT_SETUP([Some nifty test])
AT_CHECK([/bin/cp -f <test_path>/pre/test.bar test.bar], 0)
AT_CHECK([../../foo test.bar --do-something], 0, [ignore], [ignore])
AT_CHECK([file=test.bar; diff $file <test_path>/post/test.bar], 0)
AT_CLEANUP

where "test_path" is some path in the source tree. It contains in the
subfolders "pre" and "post" the source file to use and the target file
as it should come out after 'foo' processed the source file with
"do-something" to compare to.

Now to my first problem: I would rather like to use AT_DATA for setting
up the test stage but would then be rendered to have the contents of
test.bar within the testscript which I consider unclean and not easy to
manage. Having the test files in separate files and folders, as
described above, is more to my liking. AT_DATA as it is is good for e.g.
interactive programs that parse their input from a AT_DATA generated
file, e.g. AT_DATA(input, [q\nx]) and foo <input ... but not for larger
files.

And my second one: the problem with my construct above is: 'make
distcheck' fails here because files from source tree (included with
EXTRA_DIST in Makefile.am) are set to read-only (and rightly so to avoid
writing the source tree itself). Hence, 'foo' can't write the file and
the test fails.
Now, of course, I could add another line,
AT_CHECK([chmod u+w test.bar], 0),
but I already don't like the use of /bin/cp ...

So, is there something like AT_DATA that can copy a file and keeping
sensible permissions? I generally like the ansatz with AT_SETUP and
AT_DATA to prepare the test, AT_CHECK to do and AT_CLEANUP to end it.
However, AT_DATA falls a bit short. What about a binary file being
required? ...


Kind regards,

Frederik


P.S.: Maybe I should add the way how I built my test source tree:
tests/regression
    test1/
    test1/pre/somefiles
    test1/post/somefilestocompareto
    test1/testsuite-test1.at
    test2/...
    ...
    testsuite.at (includes all .at files from subdirs)
    Makefile.am (contains EXTRA_DIST of all subdirs)

-- 
Dipl.Phys. Frederik Heber
Wegelerstrasse 6/5.011, 53115 Bonn
Tel.: +49 228 73 3866
(Arbeitsgruppe Prof. Dr. M. Griebel)



reply via email to

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