diff options
author | Thomas Haller <thaller@redhat.com> | 2019-02-22 08:23:20 +0100 |
---|---|---|
committer | Thomas Haller <thaller@redhat.com> | 2019-05-17 21:47:04 +0200 |
commit | 172362ab78e56c18ff394c6103c3fff09eb9d38d (patch) | |
tree | 813ac1ee32f5ff210ec309f1151e76dc93c90cb5 | |
parent | 16cd84d346f1657560eb4aba78d65bcbc69474fb (diff) | |
download | NetworkManager-th/gitlab-ci-valgrind.tar.gz |
gitlab-ci: run unit tests under valgrind in gitlab-cith/gitlab-ci-valgrind
-rw-r--r-- | .gitlab-ci.yml | 7 | ||||
-rwxr-xr-x | contrib/debian/REQUIRED_PACKAGES | 1 | ||||
-rwxr-xr-x | contrib/scripts/nm-ci-run.sh | 36 |
3 files changed, 38 insertions, 6 deletions
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 77387c5649..792838a4fb 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -17,6 +17,9 @@ stages: # to generate proper documentation. - date '+%Y%m%d-%H%M%S'; dnf reinstall -y --setopt='tsflags=' glib2-doc + - date '+%Y%m%d-%H%M%S'; dnf install -y python3-dnf-plugins-core + - date '+%Y%m%d-%H%M%S'; dnf debuginfo-install -y glib2 + - date '+%Y%m%d-%H%M%S'; contrib/scripts/nm-ci-patch-gtkdoc.sh || true .debian_install: &debian_install @@ -37,9 +40,9 @@ stages: - date '+%Y%m%d-%H%M%S'; meson --version - date '+%Y%m%d-%H%M%S'; ! which dnf || dnf list --installed - date '+%Y%m%d-%H%M%S'; ! which dpkg || dpkg -l - - date '+%Y%m%d-%H%M%S'; git clean -fdx ; BUILD_TYPE=autotools CC=gcc WITH_DOCS=1 contrib/scripts/nm-ci-run.sh + - date '+%Y%m%d-%H%M%S'; git clean -fdx ; BUILD_TYPE=autotools CC=gcc WITH_DOCS=1 WITH_VALGRIND=1 contrib/scripts/nm-ci-run.sh - date '+%Y%m%d-%H%M%S'; rm -rf /tmp/nm-docs-html; mv build/INST/share/gtk-doc/html /tmp/nm-docs-html - - date '+%Y%m%d-%H%M%S'; git clean -fdx ; BUILD_TYPE=meson CC=gcc WITH_DOCS=1 contrib/scripts/nm-ci-run.sh + - date '+%Y%m%d-%H%M%S'; git clean -fdx ; BUILD_TYPE=meson CC=gcc WITH_DOCS=1 WITH_VALGRIND=1 contrib/scripts/nm-ci-run.sh - date '+%Y%m%d-%H%M%S'; git clean -fdx ; BUILD_TYPE=autotools CC=clang WITH_DOCS=0 contrib/scripts/nm-ci-run.sh - date '+%Y%m%d-%H%M%S'; git clean -fdx ; BUILD_TYPE=meson CC=clang WITH_DOCS=0 contrib/scripts/nm-ci-run.sh - date '+%Y%m%d-%H%M%S'; git clean -fdx ; ! grep -q '^NAME=Fedora' /etc/os-release || ./contrib/fedora/rpm/build_clean.sh -g -w crypto_gnutls -w debug -w iwd -w test diff --git a/contrib/debian/REQUIRED_PACKAGES b/contrib/debian/REQUIRED_PACKAGES index a56c55d024..091dd2b483 100755 --- a/contrib/debian/REQUIRED_PACKAGES +++ b/contrib/debian/REQUIRED_PACKAGES @@ -69,5 +69,6 @@ install \ python3-gi \ python3-pip \ uuid-dev \ + valgrind \ \ #end diff --git a/contrib/scripts/nm-ci-run.sh b/contrib/scripts/nm-ci-run.sh index 6328267948..b54be86f05 100755 --- a/contrib/scripts/nm-ci-run.sh +++ b/contrib/scripts/nm-ci-run.sh @@ -22,6 +22,13 @@ _is_true() { 0|n|no|NO|No|off) return 1 ;; + "") + if [ "$2" == "" ]; then + die "not a boolean argument \"$1\"" + fi + _is_true "$2" + return $? + ;; *) die "not a boolean argument \"$1\"" ;; @@ -85,10 +92,17 @@ fi ############################################################################### -_autotools_test_print_logs() { +_print_test_logs() { echo ">>>> PRINT TEST LOGS $1 (start)" - cat test-suite.log + if test -f test-suite.log; then + cat test-suite.log + fi echo ">>>> PRINT TEST LOGS $1 (done)" + if _is_true "$WITH_VALGRIND" 0; then + echo ">>>> PRINT VALGRIND LOGS $1 (start)" + find -name '*.valgrind-log' -print0 | xargs -0 grep -H ^ + echo ">>>> PRINT VALGRIND LOGS $1 (done)" + fi } run_autotools() { @@ -141,15 +155,22 @@ run_autotools() { if ! make check -j 6 -k ; then - _autotools_test_print_logs "first-test" + _print_test_logs "first-test" echo ">>>> RUN SECOND TEST (start)" NMTST_DEBUG=TRACE,no-expect-message make check -k || : echo ">>>> RUN SECOND TEST (done)" - _autotools_test_print_logs "second-test" + _print_test_logs "second-test" die "test failed" fi + + if _is_true "$WITH_VALGRIND" 0; then + if ! NMTST_USE_VALGRIND=1 make check -j 3 -k ; then + _print_test_logs "(valgrind test)" + die "valgrind test failed" + fi + fi popd } @@ -200,6 +221,13 @@ run_meson() { ninja -C build ninja -C build test + + if _is_true "$WITH_VALGRIND" 0; then + if ! NMTST_USE_VALGRIND=1 ninja -C build test; then + _print_test_logs "(valgrind test)" + die "valgrind test failed" + fi + fi } ############################################################################### |