]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
Do not remove $systest for out-of-tree builds
authorMichal Nowak <mnowak@isc.org>
Fri, 31 Jul 2020 11:10:44 +0000 (13:10 +0200)
committerMichał Kępień <michal@isc.org>
Mon, 28 Sep 2020 19:38:15 +0000 (21:38 +0200)
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

index ed6c2e2a9a567109b19458792023ba7e061852a7..2ab8bb91e76b33540fcf1ff0b09ae6004c1f93e3 100644 (file)
@@ -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