This patch looks a bit cleaner, it moves the system call into the function actually responsible for creating the same files. And it also fixes lstat self-tests.
/Simon diff --git a/ChangeLog b/ChangeLog index a5c7e46..5948b5f 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,14 @@ +2009-12-29 Simon Josefsson <si...@josefsson.org> + + * tests/test-areadlink.h (test_areadlink): Call rm here, without + ASSERT. + * tests/test-symlink.h (test_symlink): Likewise. + * tests/test-lstat.h (test_lstat_func): Don't ASSERT rm call. + * tests/test-areadlink-with-size.c (main): Don't call rm here. + * tests/test-areadlink.c (main): Likewise. + * tests/test-areadlinkat.c (main): Likewise. + * tests/test-symlink.c (main): Likewise. + 2009-12-28 Jim Meyering <meyer...@redhat.com> update-copyright: you may specify a max. line length other than 72 diff --git a/tests/test-areadlink-with-size.c b/tests/test-areadlink-with-size.c index 8b7ff63..dc3c488 100644 --- a/tests/test-areadlink-with-size.c +++ b/tests/test-areadlink-with-size.c @@ -38,8 +38,5 @@ int main (void) { - /* Remove any leftovers from a previous partial run. */ - ASSERT (system ("rm -rf " BASE "*") == 0); - return test_areadlink (areadlink_with_size, true); } diff --git a/tests/test-areadlink.c b/tests/test-areadlink.c index 2e8aaa5..3863714 100644 --- a/tests/test-areadlink.c +++ b/tests/test-areadlink.c @@ -45,8 +45,5 @@ do_areadlink (char const *name, size_t ignored _GL_UNUSED) int main (void) { - /* Remove any leftovers from a previous partial run. */ - ASSERT (system ("rm -rf " BASE "*") == 0); - return test_areadlink (do_areadlink, true); } diff --git a/tests/test-areadlink.h b/tests/test-areadlink.h index 57fdb7a..069c992 100644 --- a/tests/test-areadlink.h +++ b/tests/test-areadlink.h @@ -26,6 +26,9 @@ static int test_areadlink (char * (*func) (char const *, size_t), bool print) { + /* Remove any leftovers from a previous partial run. */ + system ("rm -rf " BASE "*"); + /* Sanity checks of failures. Mingw lacks symlink, but areadlink can still distinguish between various errors. */ errno = 0; diff --git a/tests/test-areadlinkat.c b/tests/test-areadlinkat.c index 54e0745..c524d8e 100644 --- a/tests/test-areadlinkat.c +++ b/tests/test-areadlinkat.c @@ -49,9 +49,6 @@ main (void) { int result; - /* Remove any leftovers from a previous partial run. */ - ASSERT (system ("rm -rf " BASE "*") == 0); - /* Basic tests. */ result = test_areadlink (do_areadlinkat, false); dfd = open (".", O_RDONLY); diff --git a/tests/test-lstat.h b/tests/test-lstat.h index 3828316..f90c0ed 100644 --- a/tests/test-lstat.h +++ b/tests/test-lstat.h @@ -29,7 +29,7 @@ test_lstat_func (int (*func) (char const *, struct stat *), bool print) struct stat st2; /* Remove any leftovers from a previous partial run. */ - ASSERT (system ("rm -rf " BASE "*") == 0); + system ("rm -rf " BASE "*"); /* Test for common directories. */ ASSERT (func (".", &st1) == 0); diff --git a/tests/test-symlink.c b/tests/test-symlink.c index c84b2bc..3247449 100644 --- a/tests/test-symlink.c +++ b/tests/test-symlink.c @@ -39,8 +39,5 @@ SIGNATURE_CHECK (symlink, int, (char const *, char const *)); int main (void) { - /* Remove any leftovers from a previous partial run. */ - ASSERT (system ("rm -rf " BASE "*") == 0); - return test_symlink (symlink, true); } diff --git a/tests/test-symlink.h b/tests/test-symlink.h index c083c6c..faf33d2 100644 --- a/tests/test-symlink.h +++ b/tests/test-symlink.h @@ -25,6 +25,9 @@ static int test_symlink (int (*func) (char const *, char const *), bool print) { + /* Remove any leftovers from a previous partial run. */ + system ("rm -rf " BASE "*"); + if (func ("nowhere", BASE "link1")) { if (print)