summaryrefslogtreecommitdiff
path: root/t/ax/deltree.pl
diff options
context:
space:
mode:
authorStefano Lattarini <stefano.lattarini@gmail.com>2013-05-16 14:18:55 +0200
committerStefano Lattarini <stefano.lattarini@gmail.com>2013-05-16 14:18:55 +0200
commit361430c09b240df88092eff7a875b2fc0749670c (patch)
tree80f0b2224b2ca2a84af28b85b0b50ea0d5ebe8fa /t/ax/deltree.pl
parent74017b56cbadf675de023f7bee6a0b18877c0a74 (diff)
downloadautomake-361430c09b240df88092eff7a875b2fc0749670c.tar.gz
tests: use perl, not find+rm, to remove temporary directories
The File::Path::rmtree function from perl, if used right, is more reliable and more portable of our past idiom: find $dirs -type d ! -perm -700 -exec chmod u+rwx {} ';'; rm -rf $$dirs || exit 1 at least of the face of unreadable dirs/files and other similar permission issues (and we have those in our test directories). In fact, this change fixes some spurious failures seen in "make distcheck" on Solaris 10. * t/ax/deltree.pl: New. * Makefile.am (EXTRA_DIST): Add it. (clean-local-check): Use it. * t/ax/test-lib.sh (rm_rf_): Use it. Signed-off-by: Stefano Lattarini <stefano.lattarini@gmail.com>
Diffstat (limited to 't/ax/deltree.pl')
-rw-r--r--t/ax/deltree.pl19
1 files changed, 19 insertions, 0 deletions
diff --git a/t/ax/deltree.pl b/t/ax/deltree.pl
new file mode 100644
index 000000000..70607662f
--- /dev/null
+++ b/t/ax/deltree.pl
@@ -0,0 +1,19 @@
+#!/usr/bin/env perl
+# deltree: recursively removes file and directory,
+# trying to handle permissions and other complications.
+
+use strict;
+use warnings FATAL => 'all';
+use File::Path qw/rmtree/;
+
+my $exit_status = 0;
+local $SIG{__WARN__} = sub { warn "@_"; $exit_status = 1; };
+
+foreach my $path (@ARGV) {
+ local $@ = undef;
+ rmtree ($path);
+}
+
+exit $exit_status;
+
+# vim: ft=perl ts=4 sw=4 et