[Top][All Lists]

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

Re: [O] Temp files from testing are permanent...

From: Olaf Meeuwissen
Subject: Re: [O] Temp files from testing are permanent...
Date: Thu, 16 Feb 2012 09:54:10 +0900
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/23.3 (gnu/linux)

Achim Gratz <address@hidden> writes:

> Olaf Meeuwissen <address@hidden> writes:
>> If running `make check` (or similar) creates these files, `make clean`
>> (or similar) should clean them up.
> I was asking that question to decide whether I do need to extend my
> Makefile fork to handle the cleanup or if the testsuite needs to be
> called differently to avoid leaving these stale files.  If you'd take a
> look, you can see that the files are obviously made with a function that
> ensures they're unique, most likely make-temp-file.  If so, it would
> seem logical that the testsuite should remove them after each test
> (since it is the only instance to know the complete filename).  It would
> also seem logical that for debugging purposes one could leave the files
> around.

Successful tests can clean up after themselves but failed tests should
not so you can debug.  The decision to remove these files should be left
to whoever runs the test suite.  That implies that even successful tests
don't really have to bother cleaning up after themselves.

I normally instruct my tests to create files in a dedicated directory
with a fixed name somewhere below $(top_builddir).  Then a `make clean`
can just remove the whole directory.

If you use `make check` to run the test suite, you can easily set TMPDIR
via the TESTS_ENVIRONMENT Makefile variable (assuming that that variable
is taken into account when making unique file names).  Something like

  TESTS_ENVIRONMENT = TMPDIR=$(builddir)/test-outputs

and then add a clean-local target like

        -rm -rf $(builddir)/test-outputs

See [[info:automake-1.11#Simple%20Tests][info:automake-1.11#Simple
Tests]] and [[info:automake-1.11#Extending]] for details.

Hope this helps,
Olaf Meeuwissen, LPIC-2           FLOSS Engineer -- AVASYS CORPORATION
FSF Associate Member #1962               Help support software freedom

reply via email to

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