bug-gnulib
[Top][All Lists]
Advanced

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

Re: tests: temporary files may be left behind


From: Bruno Haible
Subject: Re: tests: temporary files may be left behind
Date: Sun, 15 Nov 2009 02:40:26 +0100 (MET)

Hi Jim,

> I noticed that when the test-c-stack2.sh test is skipped,
> it leaves behind its temporary file.
> 
> I propose to fix it by adding a trap ... 0.

I would prefer the attached patch, because it's simpler (straightforward)
and avoids the 'trap ... 0' command which
  1. has portability problems, as Ralf pointed out,
  2. forces a review of all calls to 'exit' in the same shell script.

> A welcome side-effect is that with this change, you remove
> temporary files from only one place: the trap, rather
> than just prior to every other exit point.

For me, a very important property of the test files is that one can execute
them step by step, line by line, by copying the lines into an interactive bash.

Does your proposed patch introduce a behaviour change of test-atexit.sh
... test-uc_width2.sh (excluding test-c-stack2.sh)?

If no, then I object against the change, because it would be introducing
tricky code into files that already work perfectly fine.

If yes, i.e. if it causes the temporary files to be cleaned up in some border
cases that were not handled previously, then
  - I find your suggestion good.
  - However, I don't like the code duplication. So I would propose to have a
    "tests/cleanup.sh" script that contains the necessary 'trap' commands,
    together with a couple of comments, and modify the test-*.sh files only
    through the addition of a single line:
      . "${srcdir}/cleanup.sh"
  - In particular, I'm in favour of leaving the "rm -rf $tmpfiles" before the 
final
    exit statement in place, so that it is not forgotten when copying the lines
    into an interactive bash, line by line.

Bruno

Attachment: gnulib-patch1
Description: Binary data


reply via email to

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