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.
This commit is contained in:
Michal Nowak
2020-07-31 13:10:44 +02:00
committed by Michał Kępień
parent 483e5af534
commit 47075f64c3

View 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