Achim Gratz <strom...@nexgo.de> writes: > Olaf Meeuwissen <olaf.meeuwis...@avasys.jp> 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 clean-local: -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 http://www.fsf.org/jf?referrer=1962