[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 1/3] tests: Allow GL_RM_RF-macro as a fallback for rm, e.g., DEL
From: |
Jan Nieuwenhuizen |
Subject: |
[PATCH 1/3] tests: Allow GL_RM_RF-macro as a fallback for rm, e.g., DEL on Windows. |
Date: |
Fri, 25 Feb 2011 14:26:48 +0100 |
From: Jan Nieuwenhuizen <address@hidden>
2011-02-25 Jan Nieuwenhuizen <address@hidden>
* tests/macros.h (GL_RM_RF): New macro: fallback for `rm -rf'.
* tests/test-*.c: Use it.
---
ChangeLog | 5 +++++
tests/macros.h | 8 ++++++++
tests/test-areadlink-with-size.c | 2 +-
tests/test-areadlink.c | 2 +-
tests/test-areadlinkat-with-size.c | 2 +-
tests/test-areadlinkat.c | 2 +-
tests/test-canonicalize-lgpl.c | 2 +-
tests/test-canonicalize.c | 2 +-
tests/test-chown.c | 2 +-
tests/test-fchownat.c | 2 +-
tests/test-fdutimensat.c | 2 +-
tests/test-fstatat.c | 2 +-
tests/test-futimens.c | 2 +-
tests/test-lchown.c | 2 +-
tests/test-link.c | 2 +-
tests/test-linkat.c | 2 +-
tests/test-lstat.c | 2 +-
tests/test-mkdir.c | 2 +-
tests/test-mkdirat.c | 2 +-
tests/test-mkfifo.c | 2 +-
tests/test-mkfifoat.c | 2 +-
tests/test-mknod.c | 2 +-
tests/test-readlink.c | 2 +-
tests/test-readlinkat.c | 2 +-
tests/test-remove.c | 2 +-
tests/test-rename.c | 2 +-
tests/test-renameat.c | 2 +-
tests/test-rmdir.c | 2 +-
tests/test-symlink.c | 2 +-
tests/test-symlinkat.c | 2 +-
tests/test-unlink.c | 2 +-
tests/test-unlinkat.c | 2 +-
tests/test-utimens.c | 2 +-
tests/test-utimensat.c | 2 +-
34 files changed, 45 insertions(+), 32 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index e40fe97..059c538 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2011-02-25 Jan Nieuwenhuizen <address@hidden>
+
+ * tests/macros.h (GL_RM_RF): New macro: fallback for `rm -rf'.
+ * tests/test-*.c: Use it.
+
2011-02-24 Paul Eggert <address@hidden>
filenamecat: remove unnecessary dependency on dirname-lgpl
diff --git a/tests/macros.h b/tests/macros.h
index 8922675..1236a0c 100644
--- a/tests/macros.h
+++ b/tests/macros.h
@@ -62,3 +62,11 @@
*not* work for function parameters of array type, because they are actually
parameters of pointer type. */
#define SIZEOF(array) (sizeof (array) / sizeof (array[0]))
+
+/* Define GL_RM_RF as a fallback for `rm -rf'. For example, when
+ targeting Windows, one can use CPPFLAGS='-DRM_RF="del /r/q"' and
+ run tests in Wine. For debugging purposes, something like
+ CPPFLAGS=-DRM_RF='":"' may be used. */
+#ifndef GL_RM_RF
+#define GL_RM_RF "rm -rf"
+#endif
diff --git a/tests/test-areadlink-with-size.c b/tests/test-areadlink-with-size.c
index 92e456a..a0b7221 100644
--- a/tests/test-areadlink-with-size.c
+++ b/tests/test-areadlink-with-size.c
@@ -40,7 +40,7 @@ int
main (void)
{
/* Remove any leftovers from a previous partial run. */
- ignore_value (system ("rm -rf " BASE "*"));
+ ignore_value (system (GL_RM_RF " " BASE "*"));
return test_areadlink (areadlink_with_size, true);
}
diff --git a/tests/test-areadlink.c b/tests/test-areadlink.c
index 8e950b1..1182fd2 100644
--- a/tests/test-areadlink.c
+++ b/tests/test-areadlink.c
@@ -47,7 +47,7 @@ int
main (void)
{
/* Remove any leftovers from a previous partial run. */
- ignore_value (system ("rm -rf " BASE "*"));
+ ignore_value (system (GL_RM_RF " " BASE "*"));
return test_areadlink (do_areadlink, true);
}
diff --git a/tests/test-areadlinkat-with-size.c
b/tests/test-areadlinkat-with-size.c
index 4f6b7aa..e0bf0b0 100644
--- a/tests/test-areadlinkat-with-size.c
+++ b/tests/test-areadlinkat-with-size.c
@@ -51,7 +51,7 @@ main (void)
int result;
/* Remove any leftovers from a previous partial run. */
- ignore_value (system ("rm -rf " BASE "*"));
+ ignore_value (system (GL_RM_RF " " BASE "*"));
/* Basic tests. */
result = test_areadlink (do_areadlinkat_with_size, false);
diff --git a/tests/test-areadlinkat.c b/tests/test-areadlinkat.c
index 97a6215..6e95ec2 100644
--- a/tests/test-areadlinkat.c
+++ b/tests/test-areadlinkat.c
@@ -51,7 +51,7 @@ main (void)
int result;
/* Remove any leftovers from a previous partial run. */
- ignore_value (system ("rm -rf " BASE "*"));
+ ignore_value (system (GL_RM_RF " " BASE "*"));
/* Basic tests. */
result = test_areadlink (do_areadlinkat, false);
diff --git a/tests/test-canonicalize-lgpl.c b/tests/test-canonicalize-lgpl.c
index 17cdff0..f020393 100644
--- a/tests/test-canonicalize-lgpl.c
+++ b/tests/test-canonicalize-lgpl.c
@@ -56,7 +56,7 @@ main (void)
any leftovers from a previous partial run. */
{
int fd;
- ignore_value (system ("rm -rf " BASE " ise"));
+ ignore_value (system (GL_RM_RF " " BASE " ise"));
ASSERT (mkdir (BASE, 0700) == 0);
fd = creat (BASE "/tra", 0600);
ASSERT (0 <= fd);
diff --git a/tests/test-canonicalize.c b/tests/test-canonicalize.c
index a095e0e..dd45ff5 100644
--- a/tests/test-canonicalize.c
+++ b/tests/test-canonicalize.c
@@ -47,7 +47,7 @@ main (void)
any leftovers from a previous partial run. */
{
int fd;
- ignore_value (system ("rm -rf " BASE " ise"));
+ ignore_value (system (GL_RM_RF " " BASE " ise"));
ASSERT (mkdir (BASE, 0700) == 0);
fd = creat (BASE "/tra", 0600);
ASSERT (0 <= fd);
diff --git a/tests/test-chown.c b/tests/test-chown.c
index b2b68c8..94e0a80 100644
--- a/tests/test-chown.c
+++ b/tests/test-chown.c
@@ -43,7 +43,7 @@ int
main (void)
{
/* Remove any leftovers from a previous partial run. */
- ignore_value (system ("rm -rf " BASE "*"));
+ ignore_value (system (GL_RM_RF " " BASE "*"));
return test_chown (chown, true);
}
diff --git a/tests/test-fchownat.c b/tests/test-fchownat.c
index c09694c..90674e8 100644
--- a/tests/test-fchownat.c
+++ b/tests/test-fchownat.c
@@ -64,7 +64,7 @@ main (void)
int result2; /* Skip because of no lchown support. */
/* Clean up any trash from prior testsuite runs. */
- ignore_value (system ("rm -rf " BASE "*"));
+ ignore_value (system (GL_RM_RF " " BASE "*"));
/* Basic tests. */
result1 = test_chown (do_chown, true);
diff --git a/tests/test-fdutimensat.c b/tests/test-fdutimensat.c
index 39d6778..4740997 100644
--- a/tests/test-fdutimensat.c
+++ b/tests/test-fdutimensat.c
@@ -98,7 +98,7 @@ main (void)
int fd;
/* Clean up any trash from prior testsuite runs. */
- ignore_value (system ("rm -rf " BASE "*"));
+ ignore_value (system (GL_RM_RF " " BASE "*"));
/* Basic tests. */
result1 = test_utimens (do_utimens, true);
diff --git a/tests/test-fstatat.c b/tests/test-fstatat.c
index 839dad6..8fba879 100644
--- a/tests/test-fstatat.c
+++ b/tests/test-fstatat.c
@@ -63,7 +63,7 @@ main (void)
int result;
/* Remove any leftovers from a previous partial run. */
- ignore_value (system ("rm -rf " BASE "*"));
+ ignore_value (system (GL_RM_RF " " BASE "*"));
result = test_stat_func (do_stat, false);
ASSERT (test_lstat_func (do_lstat, false) == result);
diff --git a/tests/test-futimens.c b/tests/test-futimens.c
index 8398230..5e4c55a 100644
--- a/tests/test-futimens.c
+++ b/tests/test-futimens.c
@@ -45,7 +45,7 @@ int
main (void)
{
/* Clean up any trash from prior testsuite runs. */
- ignore_value (system ("rm -rf " BASE "*"));
+ ignore_value (system (GL_RM_RF " " BASE "*"));
return test_futimens (futimens, true);
}
diff --git a/tests/test-lchown.c b/tests/test-lchown.c
index f39fa10..f68bda8 100644
--- a/tests/test-lchown.c
+++ b/tests/test-lchown.c
@@ -43,7 +43,7 @@ int
main (void)
{
/* Remove any leftovers from a previous partial run. */
- ignore_value (system ("rm -rf " BASE "*"));
+ ignore_value (system (GL_RM_RF " " BASE "*"));
return test_lchown (lchown, true);
}
diff --git a/tests/test-link.c b/tests/test-link.c
index cbb4e0b..80d7d6b 100644
--- a/tests/test-link.c
+++ b/tests/test-link.c
@@ -41,7 +41,7 @@ int
main (void)
{
/* Remove any garbage left from previous partial runs. */
- ignore_value (system ("rm -rf " BASE "*"));
+ ignore_value (system (GL_RM_RF " " BASE "*"));
return test_link (link, true);
}
diff --git a/tests/test-linkat.c b/tests/test-linkat.c
index 8d179e2..01efc24 100644
--- a/tests/test-linkat.c
+++ b/tests/test-linkat.c
@@ -94,7 +94,7 @@ main (void)
int result;
/* Clean up any trash from prior testsuite runs. */
- ignore_value (system ("rm -rf " BASE "*"));
+ ignore_value (system (GL_RM_RF " " BASE "*"));
/* Test basic link functionality, without mentioning symlinks. */
result = test_link (do_link, true);
diff --git a/tests/test-lstat.c b/tests/test-lstat.c
index 372e056..cdd229d 100644
--- a/tests/test-lstat.c
+++ b/tests/test-lstat.c
@@ -54,7 +54,7 @@ int
main (void)
{
/* Remove any leftovers from a previous partial run. */
- ignore_value (system ("rm -rf " BASE "*"));
+ ignore_value (system (GL_RM_RF " " BASE "*"));
return test_lstat_func (do_lstat, true);
}
diff --git a/tests/test-mkdir.c b/tests/test-mkdir.c
index 86e6f8b..36d0f1f 100644
--- a/tests/test-mkdir.c
+++ b/tests/test-mkdir.c
@@ -41,7 +41,7 @@ int
main (void)
{
/* Clean up any trash from prior testsuite runs. */
- ignore_value (system ("rm -rf " BASE "*"));
+ ignore_value (system (GL_RM_RF " " BASE "*"));
return test_mkdir (mkdir, true);
}
diff --git a/tests/test-mkdirat.c b/tests/test-mkdirat.c
index 89dfafc..6692f4c 100644
--- a/tests/test-mkdirat.c
+++ b/tests/test-mkdirat.c
@@ -52,7 +52,7 @@ main (void)
int result;
/* Clean up any trash from prior testsuite runs. */
- ignore_value (system ("rm -rf " BASE "*"));
+ ignore_value (system (GL_RM_RF " " BASE "*"));
/* Test basic mkdir functionality. */
result = test_mkdir (do_mkdir, false);
diff --git a/tests/test-mkfifo.c b/tests/test-mkfifo.c
index 1c6d0c5..496e3c0 100644
--- a/tests/test-mkfifo.c
+++ b/tests/test-mkfifo.c
@@ -41,7 +41,7 @@ int
main (void)
{
/* Remove any leftovers from a previous partial run. */
- ignore_value (system ("rm -rf " BASE "*"));
+ ignore_value (system (GL_RM_RF " " BASE "*"));
return test_mkfifo (mkfifo, true);
}
diff --git a/tests/test-mkfifoat.c b/tests/test-mkfifoat.c
index fe086fd..c278675 100644
--- a/tests/test-mkfifoat.c
+++ b/tests/test-mkfifoat.c
@@ -73,7 +73,7 @@ main (void)
int result;
/* Remove any leftovers from a previous partial run. */
- ignore_value (system ("rm -rf " BASE "*"));
+ ignore_value (system (GL_RM_RF " " BASE "*"));
/* Basic tests. */
result = test_mkfifo (do_mkfifoat, true);
diff --git a/tests/test-mknod.c b/tests/test-mknod.c
index b7e7b03..92c68e8 100644
--- a/tests/test-mknod.c
+++ b/tests/test-mknod.c
@@ -48,7 +48,7 @@ int
main (void)
{
/* Remove any leftovers from a previous partial run. */
- ignore_value (system ("rm -rf " BASE "*"));
+ ignore_value (system (GL_RM_RF " " BASE "*"));
/* We can only portably test creation of fifos. Anything else
requires root privileges and knowledge of device numbers. */
diff --git a/tests/test-readlink.c b/tests/test-readlink.c
index 3da5fbf..f7e4b3b 100644
--- a/tests/test-readlink.c
+++ b/tests/test-readlink.c
@@ -42,7 +42,7 @@ int
main (void)
{
/* Remove any leftovers from a previous partial run. */
- ignore_value (system ("rm -rf " BASE "*"));
+ ignore_value (system (GL_RM_RF " " BASE "*"));
return test_readlink (readlink, true);
}
diff --git a/tests/test-readlinkat.c b/tests/test-readlinkat.c
index 1d588ac..f7df5d8 100644
--- a/tests/test-readlinkat.c
+++ b/tests/test-readlinkat.c
@@ -57,7 +57,7 @@ main (void)
int result;
/* Remove any leftovers from a previous partial run. */
- ignore_value (system ("rm -rf " BASE "*"));
+ ignore_value (system (GL_RM_RF " " BASE "*"));
/* Perform same checks as counterpart functions. */
result = test_readlink (do_readlink, false);
diff --git a/tests/test-remove.c b/tests/test-remove.c
index 15d5f27..096a8af 100644
--- a/tests/test-remove.c
+++ b/tests/test-remove.c
@@ -39,7 +39,7 @@ int
main (void)
{
/* Remove any leftovers from a previous partial run. */
- ignore_value (system ("rm -rf " BASE "*"));
+ ignore_value (system (GL_RM_RF " " BASE "*"));
/* Setup. */
ASSERT (mkdir (BASE "dir", 0700) == 0);
diff --git a/tests/test-rename.c b/tests/test-rename.c
index 5ac83ca..5c2fb7f 100644
--- a/tests/test-rename.c
+++ b/tests/test-rename.c
@@ -41,7 +41,7 @@ int
main (void)
{
/* Remove any garbage left from previous partial runs. */
- ignore_value (system ("rm -rf " BASE "*"));
+ ignore_value (system (GL_RM_RF " " BASE "*"));
return test_rename (rename, true);
}
diff --git a/tests/test-renameat.c b/tests/test-renameat.c
index 1849a24..37e3882 100644
--- a/tests/test-renameat.c
+++ b/tests/test-renameat.c
@@ -60,7 +60,7 @@ main (void)
int result;
/* Clean up any trash from prior testsuite runs. */
- ignore_value (system ("rm -rf " BASE "*"));
+ ignore_value (system (GL_RM_RF " " BASE "*"));
/* Test basic rename functionality, using current directory. */
result = test_rename (do_rename, false);
diff --git a/tests/test-rmdir.c b/tests/test-rmdir.c
index 6957efe..5a12dc7 100644
--- a/tests/test-rmdir.c
+++ b/tests/test-rmdir.c
@@ -41,7 +41,7 @@ int
main (void)
{
/* Remove any leftovers from a previous partial run. */
- ignore_value (system ("rm -rf " BASE "*"));
+ ignore_value (system (GL_RM_RF " " BASE "*"));
return test_rmdir_func (rmdir, true);
}
diff --git a/tests/test-symlink.c b/tests/test-symlink.c
index 367e045..5d68c15 100644
--- a/tests/test-symlink.c
+++ b/tests/test-symlink.c
@@ -41,7 +41,7 @@ int
main (void)
{
/* Remove any leftovers from a previous partial run. */
- ignore_value (system ("rm -rf " BASE "*"));
+ ignore_value (system (GL_RM_RF " " BASE "*"));
return test_symlink (symlink, true);
}
diff --git a/tests/test-symlinkat.c b/tests/test-symlinkat.c
index 1795c0e..89e6f5e 100644
--- a/tests/test-symlinkat.c
+++ b/tests/test-symlinkat.c
@@ -56,7 +56,7 @@ main (void)
int result;
/* Remove any leftovers from a previous partial run. */
- ignore_value (system ("rm -rf " BASE "*"));
+ ignore_value (system (GL_RM_RF " " BASE "*"));
/* Perform same checks as counterpart functions. */
result = test_symlink (do_symlink, false);
diff --git a/tests/test-unlink.c b/tests/test-unlink.c
index ce340f2..24dbcaa 100644
--- a/tests/test-unlink.c
+++ b/tests/test-unlink.c
@@ -43,7 +43,7 @@ int
main (void)
{
/* Remove any leftovers from a previous partial run. */
- ignore_value (system ("rm -rf " BASE "*"));
+ ignore_value (system (GL_RM_RF " " BASE "*"));
return test_unlink_func (unlink, true);
}
diff --git a/tests/test-unlinkat.c b/tests/test-unlinkat.c
index f9ed249..57b4496 100644
--- a/tests/test-unlinkat.c
+++ b/tests/test-unlinkat.c
@@ -63,7 +63,7 @@ main (void)
int result2;
/* Remove any leftovers from a previous partial run. */
- ignore_value (system ("rm -rf " BASE "*"));
+ ignore_value (system (GL_RM_RF " " BASE "*"));
result1 = test_rmdir_func (rmdirat, false);
result2 = test_unlink_func (unlinker, false);
diff --git a/tests/test-utimens.c b/tests/test-utimens.c
index 319900d..d136483 100644
--- a/tests/test-utimens.c
+++ b/tests/test-utimens.c
@@ -67,7 +67,7 @@ main (void)
int result3; /* Skip because of no lutimens support. */
/* Clean up any trash from prior testsuite runs. */
- ignore_value (system ("rm -rf " BASE "*"));
+ ignore_value (system (GL_RM_RF " " BASE "*"));
result1 = test_utimens (utimens, true);
ASSERT (test_utimens (do_fdutimens, false) == result1);
diff --git a/tests/test-utimensat.c b/tests/test-utimensat.c
index d5b306f..a22313c 100644
--- a/tests/test-utimensat.c
+++ b/tests/test-utimensat.c
@@ -67,7 +67,7 @@ main (void)
int fd;
/* Clean up any trash from prior testsuite runs. */
- ignore_value (system ("rm -rf " BASE "*"));
+ ignore_value (system (GL_RM_RF " " BASE "*"));
/* Basic tests. */
result1 = test_utimens (do_utimensat, true);
--
1.7.1
--
Jan Nieuwenhuizen <address@hidden> | GNU LilyPond http://lilypond.org
Freelance IT http://JoyofSource.com | Avatar® http://AvatarAcademy.nl