diff options
author | Thomas Haller <thaller@redhat.com> | 2019-05-18 10:54:33 +0200 |
---|---|---|
committer | Thomas Haller <thaller@redhat.com> | 2019-05-18 10:54:33 +0200 |
commit | faf55eb2f87e14ff8b96cc7d9c7be2b56fbb097b (patch) | |
tree | d5fb3b97b42872a67da90b15c4bd51566e38c051 | |
parent | e966f942ccfa3e6a467d572fd5897948caf78508 (diff) | |
parent | 6d76a0974e0ef7124e70678d6c38d8401dbd1503 (diff) | |
download | NetworkManager-faf55eb2f87e14ff8b96cc7d9c7be2b56fbb097b.tar.gz |
ci: merge branch 'th/gitlab-ci-valgrind'
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/merge_requests/155
-rw-r--r-- | .gitlab-ci.yml | 8 | ||||
-rwxr-xr-x | contrib/debian/REQUIRED_PACKAGES | 1 | ||||
-rwxr-xr-x | contrib/scripts/nm-ci-install-valgrind-in-ubuntu1604.sh | 36 | ||||
-rwxr-xr-x | contrib/scripts/nm-ci-run.sh | 36 | ||||
-rw-r--r-- | src/devices/tests/meson.build | 1 | ||||
-rw-r--r-- | src/platform/tests/meson.build | 9 |
6 files changed, 78 insertions, 13 deletions
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 77387c5649..5c6b131aaa 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 @@ -27,6 +30,7 @@ stages: - date '+%Y%m%d-%H%M%S'; sed -i 's/^# \(pl_PL.UTF-8 .*\)$/\1/p' /etc/locale.gen ; true - date '+%Y%m%d-%H%M%S'; locale-gen pl_PL.UTF-8 - date '+%Y%m%d-%H%M%S'; pip3 install meson + - date '+%Y%m%d-%H%M%S'; contrib/scripts/nm-ci-install-valgrind-in-ubuntu1604.sh .do_build: &do_build stage: test @@ -37,9 +41,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-install-valgrind-in-ubuntu1604.sh b/contrib/scripts/nm-ci-install-valgrind-in-ubuntu1604.sh new file mode 100755 index 0000000000..1fd88d052b --- /dev/null +++ b/contrib/scripts/nm-ci-install-valgrind-in-ubuntu1604.sh @@ -0,0 +1,36 @@ +#!/bin/bash + +set -exv + +# Ubuntu 16.04 (trusty) ships a valgrind version where __get_cpuid() announces +# rdrand support, but later valgrind crashes with unsupported opcode. +# +# See https://bugs.kde.org/show_bug.cgi?id=353370#c9 +# https://bugs.launchpad.net/ubuntu/+source/valgrind/+bug/1501545 +# +# We call rdrand for hash-tables of systemd: +# https://github.com/systemd/systemd/blob/e7b621ee1f1abfbcaae1cd17da4d815daf218679/src/basic/random-util.c#L36 +# +# Work around that by installing valgrind from bionic. + +grep -q 'PRETTY_NAME="Ubuntu 16.04.6 LTS"' /etc/os-release || exit 0 +dpkg -s valgrind | grep -q 'Version: 1:3.11.0-1ubuntu4.2$' || exit 0 + + +cat <<EOF > /etc/apt/sources.list.d/bionic1804.list +deb http://us.archive.ubuntu.com/ubuntu/ bionic main +EOF + +cat <<EOF > /etc/apt/preferences.d/bionic1804.pref +Package: * +Pin: release n=bionic +Pin-Priority: -10 + +Package: valgrind +Pin: release n=bionic +Pin-Priority: 500 +EOF + +apt-get update + +apt-get install valgrind -y 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 } ############################################################################### diff --git a/src/devices/tests/meson.build b/src/devices/tests/meson.build index 4702c656fc..4b4c5c7ee5 100644 --- a/src/devices/tests/meson.build +++ b/src/devices/tests/meson.build @@ -9,7 +9,6 @@ foreach test_unit: test_units test_unit + '.c', dependencies: test_nm_dep, ) - test( 'devices/' + test_unit, test_script, diff --git a/src/platform/tests/meson.build b/src/platform/tests/meson.build index 8086a46c9b..b3a9616286 100644 --- a/src/platform/tests/meson.build +++ b/src/platform/tests/meson.build @@ -13,11 +13,10 @@ test_units = [ foreach test_unit: test_units exe = executable( - 'platform-' + test_unit[0], + test_unit[0], test_unit[1], dependencies: test_unit[2], ) - test( 'platform/' + test_unit[0], test_script, @@ -26,10 +25,8 @@ foreach test_unit: test_units ) endforeach -test = 'monitor' - executable( - test, - test + '.c', + 'monitor', + 'monitor.c', dependencies: test_nm_dep, ) |