From 483e5af5342ece377c866f98dec56757515ca0ea Mon Sep 17 00:00:00 2001 From: Michal Nowak Date: Tue, 21 Jul 2020 15:54:27 +0200 Subject: [PATCH 1/2] Add an out-of-tree system test job to GitLab CI Make sure the new job does not get run for every pipeline as it is not expected to break often and it is similar enough to other system test jobs. Change the name of the variable holding the path to the out-of-tree build directory to a more generic one. --- .gitlab-ci.yml | 32 ++++++++++++++++++++++++++------ 1 file changed, 26 insertions(+), 6 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 522677fcfb..df826b291d 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -207,14 +207,16 @@ stages: stage: build before_script: - test -w "${CCACHE_DIR}" && export PATH="/usr/lib/ccache:${PATH}" - - test -n "${OOT_BUILD_WORKSPACE}" && mkdir "${OOT_BUILD_WORKSPACE}" && cd "${OOT_BUILD_WORKSPACE}" + - test -n "${OUT_OF_TREE_WORKSPACE}" && mkdir "${OUT_OF_TREE_WORKSPACE}" && cd "${OUT_OF_TREE_WORKSPACE}" script: - *configure - *check_readline_setup - make -j${BUILD_PARALLEL_JOBS:-1} -k all V=1 - test -z "${RUN_MAKE_INSTALL}" || make install - test -z "${RUN_MAKE_INSTALL}" || sh util/check-make-install - - if test "$(git status --porcelain | grep -Ev '\?\?' | wc -l)" -gt "0"; then git status --short; exit 1; fi + - if test -z "${OUT_OF_TREE_WORKSPACE}" && test "$(git status --porcelain | grep -Ev '\?\?' | wc -l)" -gt "0"; then git status --short; exit 1; fi + after_script: + - test -n "${OUT_OF_TREE_WORKSPACE}" && mv "${OUT_OF_TREE_WORKSPACE}" "${CI_PROJECT_DIR}" needs: - job: autoreconf artifacts: true @@ -266,14 +268,20 @@ stages: <<: *default_triggering_rules stage: system before_script: - - *setup_interfaces - *setup_softhsm + # Move the artifacts from the out-of-tree build job to their original location (the out-of-tree workspace). + - test -n "${OUT_OF_TREE_WORKSPACE}" && mv "$(basename "${OUT_OF_TREE_WORKSPACE}")" "${OUT_OF_TREE_WORKSPACE}" + # Continue work in the out-of-tree workspace. + - test -n "${OUT_OF_TREE_WORKSPACE}" && cd "${OUT_OF_TREE_WORKSPACE}" + - *setup_interfaces script: - cd bin/tests/system - make -j${TEST_PARALLEL_JOBS:-1} -k check V=1 after_script: + - test -n "${OUT_OF_TREE_WORKSPACE}" && cd "${OUT_OF_TREE_WORKSPACE}" - test -d bind-* && cd bind-* - cat bin/tests/system/test-suite.log + - test -n "${OUT_OF_TREE_WORKSPACE}" && mv "${OUT_OF_TREE_WORKSPACE}" "${CI_PROJECT_DIR}" .system_test: &system_test_job <<: *system_test_common @@ -495,7 +503,6 @@ docs: stage: docs before_script: - test -w "${CCACHE_DIR}" && export PATH="/usr/lib/ccache:${PATH}" - - test -n "${OOT_BUILD_WORKSPACE}" && mkdir "${OOT_BUILD_WORKSPACE}" && cd "${OOT_BUILD_WORKSPACE}" script: - *configure - make -j${BUILD_PARALLEL_JOBS:-1} -k doc V=1 @@ -709,13 +716,26 @@ gcc:out-of-tree: variables: CC: gcc CFLAGS: "${CFLAGS_COMMON} -Og" - CONFIGURE: ../configure + CONFIGURE: "${CI_PROJECT_DIR}/configure" EXTRA_CONFIGURE: "--enable-dnstap --with-libidn2 --with-lmdb" RUN_MAKE_INSTALL: 1 - OOT_BUILD_WORKSPACE: workspace + OUT_OF_TREE_WORKSPACE: /tmp/out_of_tree_workspace <<: *base_image <<: *build_job +system:gcc:out-of-tree: + variables: + OUT_OF_TREE_WORKSPACE: /tmp/out_of_tree_workspace + needs: + - job: gcc:out-of-tree + artifacts: true + <<: *base_image + <<: *system_test_job + only: + - schedules + - tags + - web + # Jobs for tarball GCC builds on Debian 10 "buster" (amd64) gcc:tarball: From 47075f64c3f8d267b4f183ff0011fd36873a2abe Mon Sep 17 00:00:00 2001 From: Michal Nowak Date: Fri, 31 Jul 2020 13:10:44 +0200 Subject: [PATCH 2/2] 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