From mboxrd@z Thu Jan 1 00:00:00 1970 From: Eric Schulte Subject: Re: Temp files from testing are permanent... Date: Sun, 19 Feb 2012 09:21:46 -0700 Message-ID: <87sji6g5ee.fsf@gmx.com> References: <8762f9w9l3.fsf@Rainer.invalid> <87sjidovpo.fsf@avasys.jp> <877gzof2e1.fsf@Rainer.invalid> <8762f7d2dp.fsf@avasys.jp> <87sjiay7aq.fsf@Rainer.invalid> <87aa4gqbk4.fsf@gmx.com> <877gzkc70m.fsf@Rainer.invalid> Mime-Version: 1.0 Content-Type: text/plain Return-path: Received: from eggs.gnu.org ([140.186.70.92]:36112) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Rz9Wo-0006ZI-1b for emacs-orgmode@gnu.org; Sun, 19 Feb 2012 11:22:23 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Rz9Wm-0004Av-KK for emacs-orgmode@gnu.org; Sun, 19 Feb 2012 11:22:21 -0500 Received: from mailout-us.gmx.com ([74.208.5.67]:40898) by eggs.gnu.org with smtp (Exim 4.71) (envelope-from ) id 1Rz9Wm-0004Ap-FA for emacs-orgmode@gnu.org; Sun, 19 Feb 2012 11:22:20 -0500 List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: Achim Gratz Cc: emacs-orgmode@gnu.org Achim Gratz writes: > Eric Schulte writes: >> It will be up to the authors of individual tests to remove tangled and >> exported files. Ideally we can patch each test to clean up after >> itself. Perhaps we should provide a test macro which accepts a list of >> file names and optionally removes them if the test exists successfully. >> e.g., >> >> (org-test-with-cleanup '("exported.html" "tangled.sh" etc...) >> ...test body...) > > Currently those files would have inpredictable names AFAICS, which would > defeat that purpose. I should have been more clear. I'm thinking that this would be a macro used /within/ unit tests so that testers could specify what files will be created (test writers should be able to predict the file names created by their tests) and then the macro will handle cleanup. Here's one implementation of such a macro (defmacro org-test-with-cleanup (files &rest body) "If BODY executes successfully delete FILES and return results of BODY." (declare (indent 1)) `(let ((result (progn ,@body))) (mapc (lambda (file) (when (file-exists-p file) (delete-file file))) files) result)) > I'm not sure where to do this, but it occurs to me that it would be > easier if those files only had a unique prefix that didn't change for > each invocation of the test suite (a timestamp would be OK, so it is > easier to see which files you're looking at). If the files always had > the same name, you would have to make sure that there was no > collision, either with existing files or results from earlier tests, > so that would be no good. If it is easier to always have the same > names for the files, one could just make the test directory name > unique. I think it is useful for debugging to be able to keep a few > generation of tests around. > I do like the idea of a single directory in which all output files may be collected. The only potential downside I see for this is that files will be generated both from within org files in the testing/examples directory as well as temporary files. > >> Even if the above is implemented this sounds like a good safeguard. > > Safeguards are in place in my Makefile fork. > > > Regards, > Achim. -- Eric Schulte http://cs.unm.edu/~eschulte/