From 51ea4f3ffc52524f88e01fd9e583e90fd2a537b7 Mon Sep 17 00:00:00 2001 From: Stefano Lattarini Date: Tue, 3 Jul 2012 21:56:08 +0200 Subject: [PATCH] build: fix cleaning of test directories in contrib (and in t/perf) * 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 --- Makefile.am | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/Makefile.am b/Makefile.am index f05e82d..d28f3c7 100644 --- a/Makefile.am +++ b/Makefile.am @@ -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 ## ---------------- ## -- 2.7.4