From 47075f64c3f8d267b4f183ff0011fd36873a2abe Mon Sep 17 00:00:00 2001 From: Michal Nowak Date: Fri, 31 Jul 2020 13:10:44 +0200 Subject: [PATCH] Do not remove $systest for out-of-tree builds Previously, the $systest directory was being removed for out-of-tree builds at the end of each system test. Because of that, running tests which depend on compiled objects was breaking subsequent "make check" invocations: make: Target 'check' not remade because of errors. Making all in dyndb/driver /bin/bash: line 20: cd: dyndb/driver: No such file or directory Making all in dlzexternal/driver /bin/bash: line 20: cd: dlzexternal/driver: No such file or directory Address by first removing build/test artifacts for a given test and then removing empty directories inside (and potentially including) $systest. --- bin/tests/system/run.sh.in | 35 +++++++++++++++++++++++++---------- 1 file changed, 25 insertions(+), 10 deletions(-) diff --git a/bin/tests/system/run.sh.in b/bin/tests/system/run.sh.in index ed6c2e2a9a..2ab8bb91e7 100644 --- a/bin/tests/system/run.sh.in +++ b/bin/tests/system/run.sh.in @@ -294,21 +294,36 @@ elif [ "$sanitizer_summaries" -ne 0 ]; then echoinfo "I:$systest:$sanitizer_summaries sanitizer report(s) found" fi +print_outstanding_files() { + if test -d ${srcdir}/../../../.git; then + git status -su --ignored "${systest}" 2>/dev/null | \ + sed -n -e 's|^?? \(.*\)|I:file \1 not removed|p' \ + -e 's|^!! \(.*/named.run\)$|I:file \1 not removed|p' \ + -e 's|^!! \(.*/named.memstats\)$|I:file \1 not removed|p' + fi +} + +print_outstanding_files_oot() { + if test -d ${srcdir}/../../../.git; then + git -C "${srcdir}/${systest}" ls-files | sed "s|^|${systest}/|" > gitfiles.txt + find "${systest}/" -type f ! -name .prepared ! -name Makefile > testfiles.txt + grep -F -x -v -f gitfiles.txt testfiles.txt + rm -f gitfiles.txt testfiles.txt + fi +} + if [ $status -ne 0 ]; then echofail "R:$systest:FAIL" else echopass "R:$systest:PASS" if $clean; then - ( cd "${systest}" && $SHELL clean.sh "$@" ) - if [ "${srcdir}" != "${builddir}" ]; then - rm -rf "./${systest}" ## FIXME (this also removes compiled binaries) - fi - if test -d ${srcdir}/../../../.git; then - git status -su --ignored "${systest}" 2>/dev/null | \ - sed -n -e 's|^?? \(.*\)|I:file \1 not removed|p' \ - -e 's|^!! \(.*/named.run\)$|I:file \1 not removed|p' \ - -e 's|^!! \(.*/named.memstats\)$|I:file \1 not removed|p' - fi + ( cd "${systest}" && $SHELL clean.sh "$@" ) + if [ "${srcdir}" = "${builddir}" ]; then + print_outstanding_files + else + print_outstanding_files_oot | xargs rm -f + find "${systest}/" \( -type d -empty \) -delete 2>/dev/null + fi fi fi