Hash :
361430c0
Author :
Date :
2013-05-16T14:18:55
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>
#!/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