[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: paying for the sin of no unit tests: useless-if-before-free bug
From: |
Jim Meyering |
Subject: |
Re: paying for the sin of no unit tests: useless-if-before-free bug |
Date: |
Thu, 01 May 2008 21:27:02 +0200 |
Bruno Haible <address@hidden> wrote:
> Jim Meyering wrote:
>> Actually this seems more appropriately run from a checked-out
>> gnulib directory, e.g., as part of a "make check" rule.
>
> I would much prefer if the gnulib/Makefile "check" rule be reserved
> to platform independent checks on the gnulib code. Tests of some programs
> belong in the test module of that program, IMO, so that
> - the test is also performed when we test a gnulib testdir on various
> platforms,
> - gnulib/Makefile doesn't become a random collection of things, like
> the "system.h" a few years ago.
...
>> $u --name=z <(printf 'if(p)z(p);') > /dev/null
>> test $$($u --name=z <(printf 'if(p)z(p);if(p)z(p);')|wc -l) = 2
>
> This is not too hard to put into the common shape of gnulib tests:
Scripts like useless-if-before-free and vc-list-files are in a different
class than the rest of gnulib, since they're expected to run only via
rules like "make distcheck" and "make syntax-check" and we have always
said that those rules are expected to work only in very restricted
(i.e. modern) environments, and with the latest tools.
Tests are necessary, but I don't want to be bothered about test failures
on involving environments where the scripts would never be used otherwise.
So, the obvious solution is to write a regular, gnulib-style test that
gets distributed and run by everyone, but that is skipped unless there
are modern enough versions of bash, perl, etc.
I'll do that, though not today ;-)