build: fix cleaning of test directories in contrib (and in t/perf)
authorStefano Lattarini <stefano.lattarini@gmail.com>
Tue, 3 Jul 2012 19:56:08 +0000 (21:56 +0200)
committerStefano Lattarini <stefano.lattarini@gmail.com>
Tue, 3 Jul 2012 20:57:11 +0000 (22:57 +0200)
* Makefile.am (clean-local-check): Update recipe to cater to the fact
that some tests using a temporary directory have been placed in other
directories that the 't/' directory (for the moment, at least 't/perf'
and 'contrib/t').

Signed-off-by: Stefano Lattarini <stefano.lattarini@gmail.com>
Makefile.am

index f05e82d..d28f3c7 100644 (file)
@@ -432,13 +432,16 @@ installcheck-testsuite:
 clean-local: clean-local-check
 .PHONY: clean-local-check
 clean-local-check:
-       -set x t/*.dir; shift; \
-        if test "$$#,$$1" = "1,*.dir"; then \
-          : there is no test directory to clean; \
-        else \
-          find "$$@" -type d ! -perm -700 -exec chmod u+rwx {} ';'; \
-          rm -rf "$$@"; \
-        fi;
+## Directries candidate to be test directories match this wildcard.
+       @globs='t/*.dir t/*/*.dir */t/*.dir */t/*/*.dir'; \
+## The 'nullglob' bash option is not portable, so use perl.
+       dirs=`$(PERL) -e "print join(' ', glob('$$globs'));"` || exit 1; \
+       if test -n "$$dirs"; then \
+## Errors in find are acceptable, errors in rm are not.
+           find $$dirs -type d ! -perm -700 -exec chmod u+rwx {} ';'; \
+           echo " rm -rf $$dirs"; \
+           rm -rf $$dirs || exit 1; \
+       fi
 
 
 ## ---------------- ##