]> git.ipfire.org Git - thirdparty/knot-resolver.git/commitdiff
ci: merge unit and config tests into single job
authorTomas Krizek <tomas.krizek@nic.cz>
Tue, 19 Feb 2019 15:40:33 +0000 (16:40 +0100)
committerTomas Krizek <tomas.krizek@nic.cz>
Tue, 12 Mar 2019 09:43:33 +0000 (10:43 +0100)
Since these tests are very quick, it's not worth it to have a separate
job for them, it only wastes CI resources.

.gitlab-ci.yml
scripts/test-integration-prepare.sh

index df685ff8fa71a979070644c5a1194b067845fcbe..437d92997f938f3dd4a1a9b6a604275bba615fa9 100644 (file)
@@ -8,6 +8,8 @@ variables:
   RESPDIFF_FORCE: 0
   RESPERF_FORCE: 0
   KNOT_VERSION: '2.7'
+  LIBKRES_ABI: 9
+  LIBKRES_NAME: libkres
 
 image: $CI_REGISTRY/knot/knot-resolver/ci/debian-buster:knot-$KNOT_VERSION
 
@@ -23,7 +25,10 @@ stages:
   except:
     - master
   artifacts:
-    untracked: true
+    when: always
+    paths:
+      - .local
+      - 'build_ci*'
   tags:
     - docker
     - linux
@@ -32,19 +37,22 @@ stages:
 build:linux:amd64:
   <<: *build
   script:
-    - meson build_ci --default-library=both --prefix=$CI_PROJECT_DIR/.local -Dwerror=true
-    - ninja -v -C build_ci
-    - ninja -v -C build_ci kres-gen
-    - STATUS="$(git status --untracked-files=normal --porcelain)"
-    - test -n "${STATUS}" && echo "${STATUS}" && echo "Build made working tree dirty, did you forget to update something?" && exit 2
-    - ninja -C build_ci install
+    - meson build_ci --default-library=static --prefix=$CI_PROJECT_DIR/.local -Dwerror=true -Dpostinstall_tests=enabled
+    - ninja -C build_ci
+    - ninja -C build_ci install >/dev/null
+    - meson test -C build_ci --suite unit --suite config --print-errorlogs
 
 build:asan:linux:amd64:
   <<: *build
   script:
-    - meson build_ci --default-library=static --prefix=$CI_PROJECT_DIR/.local -Db_sanitize=address,undefined
-    - ninja -v -C build_ci
-    - ninja -C build_ci install
+    - meson build_ci_asan --default-library=static --prefix=$CI_PROJECT_DIR/.local -Db_sanitize=address,undefined -Dpostinstall_tests=enabled
+    - ninja -C build_ci_asan
+    - ninja -C build_ci_asan install >/dev/null
+    - meson test -C build_ci_asan --suite unit --suite config --print-errorlogs
+  # TODO remove allow_failure and privileged
+  allow_failure: true
+  tags:
+    - privileged
 
 # NOTE: build for turris when meson is available and packaging files updated
 #build:turris:omnia:
@@ -70,6 +78,18 @@ build:asan:linux:amd64:
 #    - linux
 #    - amd64
 
+kres-gen:
+  stage: build
+  except:
+    - master
+  tags:
+    - docker
+  script:
+    - meson build_ci --prefix=$CI_PROJECT_DIR/.local
+    - ninja -C build_ci lib/libkres.so.${LIBKRES_ABI}
+    - ninja -C build_ci kres-gen
+    - git diff --quiet || (git diff; exit 1)
+
 lint:pedantic:
   stage: test  # could be in build already, but let's not block the test stage if this fails
   dependencies: []  # do not download build artifacts
@@ -141,28 +161,6 @@ lint:clang-scan-build:
   tags:
     - docker
 
-test:linux:amd64:
-  stage: test
-  except:
-    - master
-  script:
-    # recompile everything otherwise lcov will bark because Git files will be "newer" than gcda files
-    # this is caused by interaction between Git approach to timestamps and Gitlab artifacts
-    - git clean -xdf
-    - make
-    - MAKEFLAGS="--jobs $(nproc)" make -k check
-    - MAKEFLAGS="--jobs $(nproc)" test "${COVERAGE:-0}" -eq 1 && make coverage-c COVERAGE_STAGE=gcov-check || echo "code coverage skipped"
-  dependencies: []
-  artifacts:
-    expire_in: 1 hour
-    paths:
-      - ./*.info
-  tags:
-    - docker
-    - linux
-    - amd64
-
-
 docker:build:
   stage: test
   image: docker:latest
@@ -180,30 +178,6 @@ docker:build:
     - docker rmi ${DOCKER_IMAGE_NAME}
     - docker rmi $(docker images -f "dangling=true" -q)
 
-
-installcheck:linux:amd64:
-  # TODO use debian-buster once lua packet resize issue is resolved
-  image: $CI_REGISTRY/knot/knot-resolver/ci/debian-stable:knot-$KNOT_VERSION
-  stage: test
-  except:
-    - master
-  script:
-    # recompile everything otherwise lcov will bark because Git files will be "newer" than gcda files
-    # this is caused by interaction between Git approach to timestamps and Gitlab artifacts
-    - git clean -xdf
-    - make install
-    - MAKEFLAGS="--jobs $(nproc) --keep-going" make -k installcheck
-    - MAKEFLAGS="--jobs $(nproc)" test "${COVERAGE:-0}" -eq 1 && make coverage-c coverage-lua COVERAGE_STAGE=gcov-installcheck || echo "code coverage skipped"
-  dependencies: []
-  artifacts:
-    expire_in: 1 hour
-    paths:
-      - ./*.info
-  tags:
-    - docker
-    - linux
-    - amd64
-
 doc:
   stage: test
   except:
@@ -245,14 +219,14 @@ deckard:linux:amd64:
     - linux
     - amd64
 
-installcheck:valgrind:linux:amd64:
+valgrind:linux:amd64:
   stage: test
   except:
     - master
   script:
-    - DEBUGGER="valgrind --leak-check=full --trace-children=yes --quiet --suppressions=/lj.supp" make -k installcheck
+    - meson test -C build_ci --suite unit --suite config --wrap="valgrind --leak-check=full --trace-children=yes --quiet --suppressions=/lj.supp"
   dependencies:
-    - build:linux:amd64
+    - build:linux:amd64  # valgrind doesn't work with ASAN
   tags:
     - docker
     - linux
@@ -288,21 +262,6 @@ osx:build:
 #    - amd64
 
 
-test:linux:amd64:valgrind:
-  stage: test
-  except:
-    - master
-  variables:
-    TMPDIR: $CI_PROJECT_DIR
-  script:
-    - DEBUGGER="valgrind --error-exitcode=1 --leak-check=full --trace-children=yes --quiet --suppressions=/lj.supp" make -k check
-  dependencies:
-    - build:linux:amd64
-  tags:
-    - docker
-    - linux
-    - amd64
-
 pytests:lint:
   stage: test
   dependencies: []
@@ -562,8 +521,8 @@ coverage:
   coverage: '/lines\.+:\s(\d+.\d+\%)/'
   dependencies:
     - build:linux:amd64
-    - test:linux:amd64
-    - installcheck:linux:amd64
+    #- test:linux:amd64
+    #- installcheck:linux:amd64
     - deckard:linux:amd64
     - respdiff:iter:udp:linux:amd64
   tags:
@@ -605,9 +564,6 @@ obs:devel:
     - scripts/build-in-obs.sh knot-resolver-devel  # build against knot in knot-resolver-latest
 
 pkg:debian:symbols:libkres:
-  variables:
-    LIB_NAME: libkres
-    LIB_ABI: 9
   stage: deploy
   only:  # TODO run this pre-release only
     variables:
@@ -619,7 +575,7 @@ pkg:debian:symbols:libkres:
   script:
     - ln -s distro/deb debian
     - sed -i "s/__VERSION__/99/g" distro/deb/changelog
-    - dpkg-gensymbols -c4 -elib/$LIB_NAME.so.$LIB_ABI -P. -p$LIB_NAME$LIB_ABI
+    - dpkg-gensymbols -c4 -elib/$LIB_NAME.so.$LIBKRES_ABI -P. -p$LIBKRES_NAME$LIBKRES_ABI
   allow_failure: true
   dependencies:
     - build:linux:amd64
index 73d49593645e0307711bba3f1deb96efd18ebb8f..db783963c21ae383ace0537f4a4f8ac3011a8a9d 100644 (file)
@@ -4,4 +4,4 @@ set -o errexit -o nounset
 cd "${1}"
 
 git submodule update --init --recursive
-make depend
+make depend &>/dev/null