From a96f601c8a13285b5ab6cbd9ab65c2068c9c91bf Mon Sep 17 00:00:00 2001 From: Thomas Haller Date: Thu, 16 May 2019 14:57:39 +0200 Subject: [PATCH 01/32] contrib/rpm: fix comment in `./build_clean.sh -h` output (cherry picked from commit c307f07207a8090e986a5a55b692a6c0dd474350) --- contrib/fedora/rpm/build_clean.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/contrib/fedora/rpm/build_clean.sh b/contrib/fedora/rpm/build_clean.sh index c486be5129..88bfb3d0c9 100755 --- a/contrib/fedora/rpm/build_clean.sh +++ b/contrib/fedora/rpm/build_clean.sh @@ -12,7 +12,7 @@ usage() { echo "Does all the steps from a clean git working directory to an RPM of NetworkManager" echo echo "This is also the preferred way to create a distribution tarball for release:" - echo " $ $0 -c -S" + echo " $ $0 -r" echo echo "Options:" echo " -f|--force: force build, even if working directory is not clean and has local modifications" From 0f1900b4f7288695cbbca73473c3d0218b4ad4dc Mon Sep 17 00:00:00 2001 From: Thomas Haller Date: Fri, 17 May 2019 16:38:01 +0200 Subject: [PATCH 02/32] build/meson: rename platform tests to use same name as autotools First of all, all file names in our source-tree should be unique. We should not have stuff like "libnm-core/tests/test-general.c" and "src/tests/test-general.c". The problem here are the C source files, and consequently also the test binaries have duplicate names. We should avoid that in general. However, our binaries should have a matching name with the C source. If "test-general.c" is not good enough, that needs renaming. Not building "platform-test-general" out of it. On the other hand, all our tests should have a filename "*/tests/test-*", like they do for autotools. Rename the meson platform tests. It's also important because "tools/run-nm-test.sh" relies on the test name to workaround valgrind warnings. (cherry picked from commit 16cd84d346f1657560eb4aba78d65bcbc69474fb) --- src/devices/tests/meson.build | 1 - src/platform/tests/meson.build | 9 +++------ 2 files changed, 3 insertions(+), 7 deletions(-) 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, ) From cd8c3758499508b58cc8d988ecade178fd51b260 Mon Sep 17 00:00:00 2001 From: Thomas Haller Date: Fri, 17 May 2019 13:30:14 +0200 Subject: [PATCH 03/32] ci: randomize tests during our CI This affects gitlab-ci and travis-ci, which both run this script. (cherry picked from commit 70487d9ff8a053dc71e612a5403f9fb3f7f2dbc1) --- contrib/scripts/nm-ci-run.sh | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/contrib/scripts/nm-ci-run.sh b/contrib/scripts/nm-ci-run.sh index 4a50dc30d8..ff647ac5f3 100755 --- a/contrib/scripts/nm-ci-run.sh +++ b/contrib/scripts/nm-ci-run.sh @@ -52,6 +52,10 @@ _WITH_LIBTEAM="$_TRUE" _WITH_DOCS="$_TRUE" _WITH_SYSTEMD_LOGIND="$_TRUE" +if [ "$NMTST_SEED_RAND" != "" ]; then + export NMTST_SEED_RAND= +fi + case "$CI" in ""|"true"|"default"|"gitlab") CI=default From 3c9d9b0f512b75d055f819c919f458d482e4b094 Mon Sep 17 00:00:00 2001 From: Thomas Haller Date: Fri, 22 Feb 2019 08:23:20 +0100 Subject: [PATCH 04/32] gitlab-ci: run unit tests under valgrind in gitlab-ci On Ubuntu 16.04 (trusty) valgrind fails due to rdrand being advertised but not implemented. Work around that by installing valgrind from Ubuntu 18.04 (bionic) via the "contrib/scripts/nm-ci-install-valgrind-in-ubuntu1604.sh" script. (cherry picked from commit 6d76a0974e0ef7124e70678d6c38d8401dbd1503) --- .gitlab-ci.yml | 8 +++-- contrib/debian/REQUIRED_PACKAGES | 1 + .../nm-ci-install-valgrind-in-ubuntu1604.sh | 36 +++++++++++++++++++ contrib/scripts/nm-ci-run.sh | 36 ++++++++++++++++--- 4 files changed, 75 insertions(+), 6 deletions(-) create mode 100755 contrib/scripts/nm-ci-install-valgrind-in-ubuntu1604.sh 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 618c63cb70..6c43c5865f 100755 --- a/contrib/debian/REQUIRED_PACKAGES +++ b/contrib/debian/REQUIRED_PACKAGES @@ -70,5 +70,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 < /etc/apt/sources.list.d/bionic1804.list +deb http://us.archive.ubuntu.com/ubuntu/ bionic main +EOF + +cat < /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 ff647ac5f3..f63022fbb6 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() { @@ -142,15 +156,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 } @@ -202,6 +223,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 } ############################################################################### From 05576bd9cf178c2698f468791b5982c72d579588 Mon Sep 17 00:00:00 2001 From: Thomas Haller Date: Tue, 14 May 2019 08:59:02 +0200 Subject: [PATCH 05/32] tests: use "/run" instead of "/var/run" (cherry picked from commit 10688e3d886eab3395473f8c5858cff552c9a9ad) --- contrib/scripts/test-macsec | 2 +- src/platform/tests/test-link.c | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/contrib/scripts/test-macsec b/contrib/scripts/test-macsec index 60f207bb05..93935865f1 100755 --- a/contrib/scripts/test-macsec +++ b/contrib/scripts/test-macsec @@ -46,7 +46,7 @@ ip -n macsec-ns link set macsec-vethp up echo "* Start wpa_supplicant..." cat < $TMPDIR/wpa_supplicant.conf -ctrl_interface=/var/run/hostapd1 +ctrl_interface=/run/hostapd1 eapol_version=3 ap_scan=0 fast_reauth=1 diff --git a/src/platform/tests/test-link.c b/src/platform/tests/test-link.c index a0650cc18e..a2e3a6efb1 100644 --- a/src/platform/tests/test-link.c +++ b/src/platform/tests/test-link.c @@ -2765,9 +2765,9 @@ test_netns_push (gpointer fixture, gconstpointer test_data) static void test_netns_bind_to_path (gpointer fixture, gconstpointer test_data) { -#define P_VAR_RUN "/var/run" -#define P_VAR_RUN_NETNS "/var/run/netns" -#define P_VAR_RUN_NETNS_BINDNAME "/var/run/netns/"P_NETNS_BINDNAME +#define P_VAR_RUN "/run" +#define P_VAR_RUN_NETNS "/run/netns" +#define P_VAR_RUN_NETNS_BINDNAME "/run/netns/"P_NETNS_BINDNAME #define P_NETNS_BINDNAME "nmtst-iproute2-netns" gs_unref_object NMPlatform *platform_0 = NULL; gs_unref_object NMPlatform *platform_1 = NULL; From 82de6c91802c22689a3134af14d1991ae13934f1 Mon Sep 17 00:00:00 2001 From: Thomas Haller Date: Tue, 28 May 2019 15:16:39 +0200 Subject: [PATCH 06/32] shared: fix _NM_ENSURE_TYPE_CONST() for const pointers with clang Clang 3.4.2-9.el7 on CentOS7.6 complains about missing generic type match: ../dispatcher/nm-dispatcher.c:243:2: error: controlling expression type 'const Request *const' (aka 'const struct Request *const') not compatible with any generic association type _LOG_R_D (request, "start running ordered scripts..."); ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Fixes: 17dc6a9da68a ('shared: add _NM_ENSURE_TYPE_CONST()') (cherry picked from commit 3d42b2f1fa567ae6704bd3978e0649c0a70d1a60) --- shared/nm-glib-aux/nm-macros-internal.h | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/shared/nm-glib-aux/nm-macros-internal.h b/shared/nm-glib-aux/nm-macros-internal.h index 7842836b03..1ca89787a6 100644 --- a/shared/nm-glib-aux/nm-macros-internal.h +++ b/shared/nm-glib-aux/nm-macros-internal.h @@ -635,7 +635,11 @@ NM_G_ERROR_MSG (GError *error) * It's useful to check the let the compiler ensure that @value is * of a certain type. */ #define _NM_ENSURE_TYPE(type, value) (_Generic ((value), type: (value))) -#define _NM_ENSURE_TYPE_CONST(type, value) (_Generic ((value), const type: ((const type) (value)), type: ((const type) (value)))) +#define _NM_ENSURE_TYPE_CONST(type, value) (_Generic ((value), \ + const type : ((const type) (value)), \ + const type const: ((const type) (value)), \ + type : ((const type) (value)), \ + type const: ((const type) (value)))) #else #define _NM_ENSURE_TYPE(type, value) (value) #define _NM_ENSURE_TYPE_CONST(type, value) ((const type) (value)) From 1ff0ba0fabed8269fcd0722deea4e0b88374e404 Mon Sep 17 00:00:00 2001 From: Thomas Haller Date: Tue, 28 May 2019 14:56:50 +0200 Subject: [PATCH 07/32] platform: make nm_platform_kernel_support_get() macro an inline function clang (3.4.2-9.el7) on CentOS 7.6 fails related to nm_hash_update_vals(). I am not even quoting the error message, it's totally non-understandable. nm_hash_update_vals() uses typeof(), and in some obscure cases, clang dislikes when the argument itself is some complex macro. I didn't fully understand why, but this works around it. I would prefer to fix nm_hash_update_vals() to not have this limitation. But I don't know how. There is probably no downside to have this an inline function instead of a macro. (cherry picked from commit ad06cc78dc086115729331f202fa86afd045ae6e) --- src/platform/nm-platform.h | 42 +++++++++++++++++++------------------- 1 file changed, 21 insertions(+), 21 deletions(-) diff --git a/src/platform/nm-platform.h b/src/platform/nm-platform.h index a2d8e57ff6..7a418f43ee 100644 --- a/src/platform/nm-platform.h +++ b/src/platform/nm-platform.h @@ -917,28 +917,28 @@ extern volatile int _nm_platform_kernel_support_state[_NM_PLATFORM_KERNEL_SUPPOR int _nm_platform_kernel_support_init (NMPlatformKernelSupportType type, int value); -#define _nm_platform_kernel_support_detected(type) \ - G_LIKELY (({ \ - const NMPlatformKernelSupportType _type = (type); \ - \ - nm_assert (_NM_INT_NOT_NEGATIVE (_type) && _type < G_N_ELEMENTS (_nm_platform_kernel_support_state)); \ - \ - (_nm_platform_kernel_support_state[_type] != 0); \ - })) +static inline gboolean +_nm_platform_kernel_support_detected (NMPlatformKernelSupportType type) +{ + nm_assert ( _NM_INT_NOT_NEGATIVE (type) + && type < G_N_ELEMENTS (_nm_platform_kernel_support_state)); -#define nm_platform_kernel_support_get(type) \ - ({ \ - const NMPlatformKernelSupportType _type = (type); \ - int _v; \ - \ - nm_assert (_NM_INT_NOT_NEGATIVE (_type) && _type < G_N_ELEMENTS (_nm_platform_kernel_support_state)); \ - \ - _v = _nm_platform_kernel_support_state[_type]; \ - if (G_UNLIKELY (_v == 0)) \ - _v = _nm_platform_kernel_support_init (_type, 0); \ - \ - (_v >= 0); \ - }) + return G_LIKELY (_nm_platform_kernel_support_state[type] != 0); +} + +static inline gboolean +nm_platform_kernel_support_get (NMPlatformKernelSupportType type) +{ + int v; + + nm_assert (_NM_INT_NOT_NEGATIVE (type) + && type < G_N_ELEMENTS (_nm_platform_kernel_support_state)); + + v = _nm_platform_kernel_support_state[type]; + if (G_UNLIKELY (v == 0)) + v = _nm_platform_kernel_support_init (type, 0); + return (v >= 0); +} /*****************************************************************************/ From 1f3b342ad4104cdb164650ae6fb4893785aa73f5 Mon Sep 17 00:00:00 2001 From: Thomas Haller Date: Tue, 28 May 2019 15:07:34 +0200 Subject: [PATCH 08/32] platform: avoid compiler error passing NMP_OBJECT_CAST_OBJ_WITH_IFINDEX() to nm_hash_update_vals() Clang (3.4.2-9.el7) on CentOS 7.6 fails related to nm_hash_update_vals(). Clang seems to dislike passing certain complex arguments to typeof(). I'd prefer to fix nm_hash_update_vals() to not have this problem, but I don't know how. This works around the issue. (cherry picked from commit 5113c5bd00f061a407e2dc941cc462bc36fc2948) --- src/platform/nmp-object.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/platform/nmp-object.c b/src/platform/nmp-object.c index 0d20100cae..792c4e7b84 100644 --- a/src/platform/nmp-object.c +++ b/src/platform/nmp-object.c @@ -398,7 +398,7 @@ _idx_obj_part (const DedupMultiIdxType *idx_type, if (h) { nm_hash_update_vals (h, idx_type->cache_id_type, - NMP_OBJECT_CAST_OBJ_WITH_IFINDEX (obj_a)->ifindex); + obj_a->obj_with_ifindex.ifindex); } return 1; From 73d4b36e2a48c4fcd484d64d768ff7b066f190b4 Mon Sep 17 00:00:00 2001 From: Thomas Haller Date: Sat, 25 May 2019 11:03:11 +0200 Subject: [PATCH 09/32] clients/tests: increase timeout waiting for stub D-Bus service I saw this timeout reached in our gitlab-ci. I think it was due to the machine being busy and taking more than 2 seconds. Assuming the timeout was just too short, increase it to 4 seconds. (cherry picked from commit 7af1fc803e98a8201a9c79cf11494de13151527f) --- clients/tests/test-client.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/clients/tests/test-client.py b/clients/tests/test-client.py index 08b0b951d1..eb1f7cba08 100755 --- a/clients/tests/test-client.py +++ b/clients/tests/test-client.py @@ -324,7 +324,7 @@ class NMStubServer: nmobj = self._conn_get_main_object(self._conn) if nmobj is not None: break - if (NM.utils_get_timestamp_msec() - start) >= 2000: + if (NM.utils_get_timestamp_msec() - start) >= 4000: p.stdin.close() p.kill() Util.popen_wait(p, 1000) From 42e8930f8054440d6d69b05ad01002bdc152a20b Mon Sep 17 00:00:00 2001 From: Thomas Haller Date: Tue, 28 May 2019 13:08:32 +0200 Subject: [PATCH 10/32] build: disable "-Wunknown-pragmas" warning clang on CentOS 7.6 (3.4.2-9.el7) warns: CC clients/tui/newt/clients_tui_newt_libnmt_newt_a-nmt-newt-button.o In file included from ../clients/tui/newt/nmt-newt-button.c:26: In file included from ../shared/nm-default.h:280: ../shared/nm-glib-aux/nm-macros-internal.h:1617:2: error: unknown warning group -Wstringop-truncation, ignored [-Werror,-Wunknown-pragmas] NM_PRAGMA_WARNING_DISABLE ("-Wstringop-truncation"); ^ ../shared/nm-glib-aux/nm-macros-internal.h:419:9: note: expanded from macro NM_PRAGMA_WARNING_DISABLE _Pragma(_NM_PRAGMA_WARNING_DO(warning)) ^ :109:25: note: expanded from here GCC diagnostic ignored "-Wstringop-truncation" ^ This warning totally defeats the purpose of why we use the pragma in the first place. (cherry picked from commit a307bd6ec4c1724324d0a2fbb09ebfe46a996d13) --- m4/compiler_options.m4 | 1 + meson.build | 1 + 2 files changed, 2 insertions(+) diff --git a/m4/compiler_options.m4 b/m4/compiler_options.m4 index bf847bfc91..3217ed97f5 100644 --- a/m4/compiler_options.m4 +++ b/m4/compiler_options.m4 @@ -89,6 +89,7 @@ if test "$GCC" = "yes" -a "$set_more_warnings" != "no"; then -Wno-missing-field-initializers \ -Wno-pragmas \ -Wno-sign-compare \ + -Wno-unknown-pragmas \ -Wno-unused-parameter \ ; do dnl GCC 4.4 does not warn when checking for -Wno-* flags (https://gcc.gnu.org/wiki/FAQ#wnowarning) diff --git a/meson.build b/meson.build index ee9960ef26..6380ded36e 100644 --- a/meson.build +++ b/meson.build @@ -174,6 +174,7 @@ if nm_debug '-Wno-missing-field-initializers', '-Wno-pragmas', '-Wno-sign-compare', + '-Wno-unknown-pragmas', '-Wno-unused-parameter', '-Wparentheses-equality', '-Wpointer-arith', From 87c0e8dc8348f1ce014ef7dcdf40bfe9cc0a3701 Mon Sep 17 00:00:00 2001 From: Thomas Haller Date: Sat, 18 May 2019 11:19:45 +0200 Subject: [PATCH 11/32] gitlab-ci: disable valgrind on Fedora 30 and Fedora 31 depending on glib2 package Valgrind is known to report many false positives with certain glib2 versions. Workaround that by disabling it based on the installed package version. See-also: https://bugzilla.redhat.com/show_bug.cgi?id=1710417 See-also: https://gitlab.freedesktop.org/NetworkManager/NetworkManager/merge_requests/155 (cherry picked from commit 5e11d4bf1fb9360f8e612a51dd03cb54cd8153fc) --- contrib/scripts/nm-ci-run.sh | 32 +++++++++++++++++++++++++++++--- 1 file changed, 29 insertions(+), 3 deletions(-) diff --git a/contrib/scripts/nm-ci-run.sh b/contrib/scripts/nm-ci-run.sh index f63022fbb6..fe1a48b3e0 100755 --- a/contrib/scripts/nm-ci-run.sh +++ b/contrib/scripts/nm-ci-run.sh @@ -90,6 +90,32 @@ if [ "$WITH_DOCS" != "" ]; then fi fi +unset _WITH_VALGRIND_CHECKED +_with_valgrind() { + _is_true "$WITH_VALGRIND" 0 || return 1 + + test "$_WITH_VALGRIND_CHECKED" == "1" && return 0 + _WITH_VALGRIND_CHECKED=1 + + # Certain glib2 versions are known to report *lots* of leaks. Disable + # valgrind tests in this case. + # https://bugzilla.redhat.com/show_bug.cgi?id=1710417 + if grep -q '^PRETTY_NAME="Fedora 30 (.*)"$' /etc/os-release ; then + if rpm -q glib2 | grep -q glib2-2.60.2-1.fc30 ; then + WITH_VALGRIND=0 + fi + elif grep -q '^PRETTY_NAME="Fedora 31 (.*)"$' /etc/os-release; then + if rpm -q glib2 | grep -q glib2-2.61.0-2.fc31 ; then + WITH_VALGRIND=0 + fi + fi + if [ "$WITH_VALGRIND" == 0 ]; then + echo "Don't use valgrind due to known issues in other packages." + return 1 + fi + return 0 +} + ############################################################################### _print_test_logs() { @@ -98,7 +124,7 @@ _print_test_logs() { cat test-suite.log fi echo ">>>> PRINT TEST LOGS $1 (done)" - if _is_true "$WITH_VALGRIND" 0; then + if _with_valgrind; then echo ">>>> PRINT VALGRIND LOGS $1 (start)" find -name '*.valgrind-log' -print0 | xargs -0 grep -H ^ echo ">>>> PRINT VALGRIND LOGS $1 (done)" @@ -166,7 +192,7 @@ run_autotools() { die "test failed" fi - if _is_true "$WITH_VALGRIND" 0; then + if _with_valgrind; then if ! NMTST_USE_VALGRIND=1 make check -j 3 -k ; then _print_test_logs "(valgrind test)" die "valgrind test failed" @@ -224,7 +250,7 @@ run_meson() { ninja -C build ninja -C build test - if _is_true "$WITH_VALGRIND" 0; then + if _with_valgrind; then if ! NMTST_USE_VALGRIND=1 ninja -C build test; then _print_test_logs "(valgrind test)" die "valgrind test failed" From 78d8cde326128b8eb551f9a56e232606a137ff41 Mon Sep 17 00:00:00 2001 From: Thomas Haller Date: Fri, 24 May 2019 12:29:49 +0200 Subject: [PATCH 12/32] gitlab-ci: run "checkpatch" test on Fedora 29 image Fedora 28 is no longer supported at this point. Run the "checkpatch" test on a Fedora 29 image instead. (cherry picked from commit c9873d42731b7586926ad3a99f93f08490f25abd) --- .gitlab-ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 5c6b131aaa..13db037e17 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -54,7 +54,7 @@ stages: - date '+%Y%m%d-%H%M%S'; test "$NM_BUILD_TARBALL" != 1 || mv /tmp/NetworkManager-1*.tar.xz /tmp/NetworkManager-1*.src.rpm ./ checkpatch: - image: fedora:28 + image: fedora:29 stage: test script: - date '+%Y%m%d-%H%M%S'; dnf install -y git From 07ccf36ed0546d82e3820573d8e10a7e2c20500e Mon Sep 17 00:00:00 2001 From: Thomas Haller Date: Sat, 18 May 2019 11:28:26 +0200 Subject: [PATCH 13/32] platform/tests: rename platform's "test-general.c" Older versions of meson don't like building multiple artifacts with the same name (even if they are in different directories). We have multiple tests called "test-general.c", and it would be natural to compile a test binary of the same name. Meson encountered an error in file src/tests/meson.build, line 14, column 2: Tried to create target "test-general", but a target of that name already exists. It's generally a bad idea to have in our source tree multiple files with the same name. Rename the test. Fixes: 16cd84d346f1 ('build/meson: rename platform tests to use same name as autotools'): (cherry picked from commit 041aa3d60576dd30fe52e1b01c88b079ec827f66) --- Makefile.am | 82 ++++++++++--------- src/platform/tests/.gitignore | 6 +- src/platform/tests/meson.build | 20 ++--- ...test-general.c => test-platform-general.c} | 0 4 files changed, 56 insertions(+), 52 deletions(-) rename src/platform/tests/{test-general.c => test-platform-general.c} (100%) diff --git a/Makefile.am b/Makefile.am index 8c470df31a..f8f3d7e8c9 100644 --- a/Makefile.am +++ b/Makefile.am @@ -3576,31 +3576,22 @@ check_programs_norun += \ src/platform/tests/monitor check_programs += \ - src/platform/tests/test-link-fake \ - src/platform/tests/test-link-linux \ src/platform/tests/test-address-fake \ src/platform/tests/test-address-linux \ - src/platform/tests/test-general \ + src/platform/tests/test-cleanup-fake \ + src/platform/tests/test-cleanup-linux \ + src/platform/tests/test-link-fake \ + src/platform/tests/test-link-linux \ src/platform/tests/test-nmp-object \ + src/platform/tests/test-platform-general \ src/platform/tests/test-route-fake \ src/platform/tests/test-route-linux \ - src/platform/tests/test-cleanup-fake \ - src/platform/tests/test-cleanup-linux + $(NULL) src_platform_tests_monitor_CPPFLAGS = $(src_cppflags_test) src_platform_tests_monitor_LDFLAGS = $(src_platform_tests_ldflags) src_platform_tests_monitor_LDADD = $(src_platform_tests_libadd) -src_platform_tests_test_link_fake_SOURCES = src/platform/tests/test-link.c -src_platform_tests_test_link_fake_CPPFLAGS = $(src_tests_cppflags_fake) -src_platform_tests_test_link_fake_LDFLAGS = $(src_platform_tests_ldflags) -src_platform_tests_test_link_fake_LDADD = $(src_platform_tests_libadd) - -src_platform_tests_test_link_linux_SOURCES = src/platform/tests/test-link.c -src_platform_tests_test_link_linux_CPPFLAGS = $(src_tests_cppflags_linux) -src_platform_tests_test_link_linux_LDFLAGS = $(src_platform_tests_ldflags) -src_platform_tests_test_link_linux_LDADD = $(src_platform_tests_libadd) - src_platform_tests_test_address_fake_SOURCES = src/platform/tests/test-address.c src_platform_tests_test_address_fake_CPPFLAGS = $(src_tests_cppflags_fake) src_platform_tests_test_address_fake_LDFLAGS = $(src_platform_tests_ldflags) @@ -3611,16 +3602,6 @@ src_platform_tests_test_address_linux_CPPFLAGS = $(src_tests_cppflags_linux) src_platform_tests_test_address_linux_LDFLAGS = $(src_platform_tests_ldflags) src_platform_tests_test_address_linux_LDADD = $(src_platform_tests_libadd) -src_platform_tests_test_route_fake_SOURCES = src/platform/tests/test-route.c -src_platform_tests_test_route_fake_CPPFLAGS = $(src_tests_cppflags_fake) -src_platform_tests_test_route_fake_LDFLAGS = $(src_platform_tests_ldflags) -src_platform_tests_test_route_fake_LDADD = $(src_platform_tests_libadd) - -src_platform_tests_test_route_linux_SOURCES = src/platform/tests/test-route.c -src_platform_tests_test_route_linux_CPPFLAGS = $(src_tests_cppflags_linux) -src_platform_tests_test_route_linux_LDFLAGS = $(src_platform_tests_ldflags) -src_platform_tests_test_route_linux_LDADD = $(src_platform_tests_libadd) - src_platform_tests_test_cleanup_fake_SOURCES = src/platform/tests/test-cleanup.c src_platform_tests_test_cleanup_fake_CPPFLAGS = $(src_tests_cppflags_fake) src_platform_tests_test_cleanup_fake_LDFLAGS = $(src_platform_tests_ldflags) @@ -3631,28 +3612,49 @@ src_platform_tests_test_cleanup_linux_CPPFLAGS = $(src_tests_cppflags_linux) src_platform_tests_test_cleanup_linux_LDFLAGS = $(src_platform_tests_ldflags) src_platform_tests_test_cleanup_linux_LDADD = $(src_platform_tests_libadd) +src_platform_tests_test_link_fake_SOURCES = src/platform/tests/test-link.c +src_platform_tests_test_link_fake_CPPFLAGS = $(src_tests_cppflags_fake) +src_platform_tests_test_link_fake_LDFLAGS = $(src_platform_tests_ldflags) +src_platform_tests_test_link_fake_LDADD = $(src_platform_tests_libadd) + +src_platform_tests_test_link_linux_SOURCES = src/platform/tests/test-link.c +src_platform_tests_test_link_linux_CPPFLAGS = $(src_tests_cppflags_linux) +src_platform_tests_test_link_linux_LDFLAGS = $(src_platform_tests_ldflags) +src_platform_tests_test_link_linux_LDADD = $(src_platform_tests_libadd) + src_platform_tests_test_nmp_object_CPPFLAGS = $(src_cppflags_test) src_platform_tests_test_nmp_object_LDFLAGS = $(src_platform_tests_ldflags) src_platform_tests_test_nmp_object_LDADD = src/libNetworkManagerTest.la -src_platform_tests_test_general_CPPFLAGS = $(src_cppflags_test) -src_platform_tests_test_general_LDFLAGS = $(src_platform_tests_ldflags) -src_platform_tests_test_general_LDADD = src/libNetworkManagerTest.la +src_platform_tests_test_platform_general_CPPFLAGS = $(src_cppflags_test) +src_platform_tests_test_platform_general_LDFLAGS = $(src_platform_tests_ldflags) +src_platform_tests_test_platform_general_LDADD = src/libNetworkManagerTest.la -$(src_platform_tests_monitor_OBJECTS): $(libnm_core_lib_h_pub_mkenums) -$(src_platform_tests_test_link_fake_OBJECTS): $(libnm_core_lib_h_pub_mkenums) -$(src_platform_tests_test_link_linux_OBJECTS): $(libnm_core_lib_h_pub_mkenums) -$(src_platform_tests_test_address_fake_OBJECTS): $(libnm_core_lib_h_pub_mkenums) -$(src_platform_tests_test_address_linux_OBJECTS): $(libnm_core_lib_h_pub_mkenums) -$(src_platform_tests_test_route_fake_OBJECTS): $(libnm_core_lib_h_pub_mkenums) -$(src_platform_tests_test_route_linux_OBJECTS): $(libnm_core_lib_h_pub_mkenums) -$(src_platform_tests_test_cleanup_fake_OBJECTS): $(libnm_core_lib_h_pub_mkenums) -$(src_platform_tests_test_cleanup_linux_OBJECTS): $(libnm_core_lib_h_pub_mkenums) -$(src_platform_tests_test_nmp_object_OBJECTS): $(libnm_core_lib_h_pub_mkenums) -$(src_platform_tests_test_general_OBJECTS): $(libnm_core_lib_h_pub_mkenums) +src_platform_tests_test_route_fake_SOURCES = src/platform/tests/test-route.c +src_platform_tests_test_route_fake_CPPFLAGS = $(src_tests_cppflags_fake) +src_platform_tests_test_route_fake_LDFLAGS = $(src_platform_tests_ldflags) +src_platform_tests_test_route_fake_LDADD = $(src_platform_tests_libadd) + +src_platform_tests_test_route_linux_SOURCES = src/platform/tests/test-route.c +src_platform_tests_test_route_linux_CPPFLAGS = $(src_tests_cppflags_linux) +src_platform_tests_test_route_linux_LDFLAGS = $(src_platform_tests_ldflags) +src_platform_tests_test_route_linux_LDADD = $(src_platform_tests_libadd) + +$(src_platform_tests_monitor_OBJECTS): $(libnm_core_lib_h_pub_mkenums) +$(src_platform_tests_test_address_fake_OBJECTS): $(libnm_core_lib_h_pub_mkenums) +$(src_platform_tests_test_address_linux_OBJECTS): $(libnm_core_lib_h_pub_mkenums) +$(src_platform_tests_test_cleanup_fake_OBJECTS): $(libnm_core_lib_h_pub_mkenums) +$(src_platform_tests_test_cleanup_linux_OBJECTS): $(libnm_core_lib_h_pub_mkenums) +$(src_platform_tests_test_link_fake_OBJECTS): $(libnm_core_lib_h_pub_mkenums) +$(src_platform_tests_test_link_linux_OBJECTS): $(libnm_core_lib_h_pub_mkenums) +$(src_platform_tests_test_nmp_object_OBJECTS): $(libnm_core_lib_h_pub_mkenums) +$(src_platform_tests_test_platform_general_OBJECTS): $(libnm_core_lib_h_pub_mkenums) +$(src_platform_tests_test_route_fake_OBJECTS): $(libnm_core_lib_h_pub_mkenums) +$(src_platform_tests_test_route_linux_OBJECTS): $(libnm_core_lib_h_pub_mkenums) EXTRA_DIST += \ - src/platform/tests/meson.build + src/platform/tests/meson.build \ + $(NULL) ############################################################################### # src/devices/tests diff --git a/src/platform/tests/.gitignore b/src/platform/tests/.gitignore index 536f012fbd..7ebc980c2f 100644 --- a/src/platform/tests/.gitignore +++ b/src/platform/tests/.gitignore @@ -1,14 +1,16 @@ -/dump /monitor /platform /test-address-fake /test-address-linux /test-cleanup-fake /test-cleanup-linux -/test-general /test-link-fake /test-link-linux /test-nmp-object +/test-platform-general /test-route-fake /test-route-linux +# no longer exists but was used in the past. +/dump +/test-general diff --git a/src/platform/tests/meson.build b/src/platform/tests/meson.build index b3a9616286..aaee8964eb 100644 --- a/src/platform/tests/meson.build +++ b/src/platform/tests/meson.build @@ -1,14 +1,14 @@ test_units = [ - ['test-link-fake', 'test-link.c', test_nm_dep_fake, default_test_timeout], - ['test-link-linux', 'test-link.c', test_nm_dep_linux, 900], - ['test-address-fake', 'test-address.c', test_nm_dep_fake, default_test_timeout], - ['test-address-linux', 'test-address.c', test_nm_dep_linux, default_test_timeout], - ['test-general', 'test-general.c', test_nm_dep, default_test_timeout], - ['test-nmp-object', 'test-nmp-object.c', test_nm_dep, default_test_timeout], - ['test-route-fake', 'test-route.c', test_nm_dep_fake, default_test_timeout], - ['test-route-linux', 'test-route.c', test_nm_dep_linux, default_test_timeout], - ['test-cleanup-fake', 'test-cleanup.c', test_nm_dep_fake, default_test_timeout], - ['test-cleanup-linux', 'test-cleanup.c', test_nm_dep_linux, default_test_timeout], + [ 'test-address-fake', 'test-address.c', test_nm_dep_fake, default_test_timeout ], + [ 'test-address-linux', 'test-address.c', test_nm_dep_linux, default_test_timeout ], + [ 'test-cleanup-fake', 'test-cleanup.c', test_nm_dep_fake, default_test_timeout ], + [ 'test-cleanup-linux', 'test-cleanup.c', test_nm_dep_linux, default_test_timeout ], + [ 'test-link-fake', 'test-link.c', test_nm_dep_fake, default_test_timeout ], + [ 'test-link-linux', 'test-link.c', test_nm_dep_linux, 900 ], + [ 'test-nmp-object', 'test-nmp-object.c', test_nm_dep, default_test_timeout ], + [ 'test-platform-general', 'test-platform-general.c', test_nm_dep, default_test_timeout ], + [ 'test-route-fake', 'test-route.c', test_nm_dep_fake, default_test_timeout ], + [ 'test-route-linux', 'test-route.c', test_nm_dep_linux, default_test_timeout ], ] foreach test_unit: test_units diff --git a/src/platform/tests/test-general.c b/src/platform/tests/test-platform-general.c similarity index 100% rename from src/platform/tests/test-general.c rename to src/platform/tests/test-platform-general.c From 656109c3d0260f3162114fad9ce4bd7de69c8507 Mon Sep 17 00:00:00 2001 From: Thomas Haller Date: Fri, 24 May 2019 12:48:20 +0200 Subject: [PATCH 14/32] gitlab-ci: also build on CentOS 7.5 and 7.6 (cherry picked from commit 896dc7d4d93d1b9a67b1b531168faf358541e75e) --- .gitlab-ci.yml | 38 +++++++++++++++++++++++++------- contrib/fedora/REQUIRED_PACKAGES | 2 ++ contrib/scripts/nm-ci-run.sh | 2 +- 3 files changed, 33 insertions(+), 9 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 13db037e17..f8258e457a 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -10,18 +10,29 @@ stages: .fedora_install: &fedora_install before_script: - - date '+%Y%m%d-%H%M%S'; NM_INSTALL="dnf install -y" ./contrib/fedora/REQUIRED_PACKAGES - - date '+%Y%m%d-%H%M%S'; dnf install -y glibc-langpack-pl ccache clang + + # enable EPEL on CentOS + - date '+%Y%m%d-%H%M%S'; ! grep -q '^NAME=.*\(CentOS\)' /etc/os-release || yum install -y https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm + + - date '+%Y%m%d-%H%M%S'; ! grep -q '^NAME=.*\(CentOS\)' /etc/os-release || (yum install -y glibc-common && localedef -c -i pl_PL -f UTF-8 pl_PL.UTF-8 && locale -a) + + - date '+%Y%m%d-%H%M%S'; NM_INSTALL="yum install -y" ./contrib/fedora/REQUIRED_PACKAGES + - date '+%Y%m%d-%H%M%S'; yum install -y glibc-langpack-pl ccache clang which # containers have "tsflags=nodocs" in /etc/dnf/dnf.conf. We need /usr/shared/gtk-doc/html # 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'; yum 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'; ! grep -q '^NAME=.*\(CentOS\)' /etc/os-release || yum install -y python36-dbus python36-gobject-base + + - date '+%Y%m%d-%H%M%S'; ! which dnf || dnf install -y python3-dnf-plugins-core + - date '+%Y%m%d-%H%M%S'; ! which dnf || dnf debuginfo-install -y glib2 + - date '+%Y%m%d-%H%M%S'; which dnf || debuginfo-install -y glib2 - date '+%Y%m%d-%H%M%S'; contrib/scripts/nm-ci-patch-gtkdoc.sh || true + - date '+%Y%m%d-%H%M%S'; test -x /usr/bin/ninja || ! test -x /usr/bin/ninja-build || ln -s /usr/bin/ninja-build /usr/bin/ninja + .debian_install: &debian_install before_script: - date '+%Y%m%d-%H%M%S'; apt-get update @@ -39,15 +50,15 @@ stages: - date '+%Y%m%d-%H%M%S'; locale -a - date '+%Y%m%d-%H%M%S'; env - 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'; ! which yum || yum list installed - 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 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 - - 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 -w meson + - date '+%Y%m%d-%H%M%S'; git clean -fdx ; ! grep -q '^NAME=.*\(Fedora\|CentOS\)' /etc/os-release || ./contrib/fedora/rpm/build_clean.sh -g -w crypto_gnutls -w debug -w iwd -w test -W meson + - 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 -w meson - date '+%Y%m%d-%H%M%S'; git clean -fdx ; test "$NM_BUILD_TARBALL" != 1 || ( ./contrib/fedora/rpm/build_clean.sh -r && mv ./NetworkManager-1*.tar.xz /tmp/ && mv ./contrib/fedora/rpm/latest/SRPMS/NetworkManager-1*.src.rpm /tmp/ ) - date '+%Y%m%d-%H%M%S'; git clean -fdx - date '+%Y%m%d-%H%M%S'; mv /tmp/nm-docs-html ./docs-html @@ -95,6 +106,17 @@ t_fedora:rawhide: allow_failure: true when: manual +t_centos:7.5.1804: + <<: *fedora_install + image: centos:7.5.1804 + <<: *do_build + when: manual + +t_centos:7.6.1810: + <<: *fedora_install + image: centos:7.6.1810 + <<: *do_build + t_ubuntu:16.04: <<: *debian_install image: ubuntu:16.04 diff --git a/contrib/fedora/REQUIRED_PACKAGES b/contrib/fedora/REQUIRED_PACKAGES index 23a532f9e4..3d132094a4 100755 --- a/contrib/fedora/REQUIRED_PACKAGES +++ b/contrib/fedora/REQUIRED_PACKAGES @@ -53,8 +53,10 @@ install \ newt-devel \ nss-devel \ polkit-devel \ + ppp \ ppp-devel \ pygobject3-base \ + python-gobject-base \ python3-dbus \ python3-gobject \ qt-devel \ diff --git a/contrib/scripts/nm-ci-run.sh b/contrib/scripts/nm-ci-run.sh index fe1a48b3e0..d77cad1afe 100755 --- a/contrib/scripts/nm-ci-run.sh +++ b/contrib/scripts/nm-ci-run.sh @@ -126,7 +126,7 @@ _print_test_logs() { echo ">>>> PRINT TEST LOGS $1 (done)" if _with_valgrind; then echo ">>>> PRINT VALGRIND LOGS $1 (start)" - find -name '*.valgrind-log' -print0 | xargs -0 grep -H ^ + find -name '*.valgrind-log' -print0 | xargs -0 grep -H ^ || true echo ">>>> PRINT VALGRIND LOGS $1 (done)" fi } From 34bdc6caa1f7d3d82f46ac13d3557ef5e4d10100 Mon Sep 17 00:00:00 2001 From: Thomas Haller Date: Fri, 24 May 2019 08:46:48 +0200 Subject: [PATCH 15/32] shared: add _NM_ENSURE_TYPE_CONST() The sole purpose of this is more type-safe macros. An alternative solution would be to define a function instead of a macro. But if the function is unused (currently!) you get a compiler warning (on some compilers even when marking the function as "static inline", if it's in the source file). A workaround for that would be to mark the function as _nm_unused, or to use a macro instead. _NM_ENSURE_TYPE_CONST() is to aid the macro solution. (cherry picked from commit 17dc6a9da68a0809cd8d15003d7c940a898a5fb3) --- shared/nm-glib-aux/nm-macros-internal.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/shared/nm-glib-aux/nm-macros-internal.h b/shared/nm-glib-aux/nm-macros-internal.h index 2e46cd2db3..7842836b03 100644 --- a/shared/nm-glib-aux/nm-macros-internal.h +++ b/shared/nm-glib-aux/nm-macros-internal.h @@ -635,8 +635,10 @@ NM_G_ERROR_MSG (GError *error) * It's useful to check the let the compiler ensure that @value is * of a certain type. */ #define _NM_ENSURE_TYPE(type, value) (_Generic ((value), type: (value))) +#define _NM_ENSURE_TYPE_CONST(type, value) (_Generic ((value), const type: ((const type) (value)), type: ((const type) (value)))) #else #define _NM_ENSURE_TYPE(type, value) (value) +#define _NM_ENSURE_TYPE_CONST(type, value) ((const type) (value)) #endif #if _NM_CC_SUPPORT_GENERIC From 1fc4ab1186cdb82640bc7e7ca63975ad07e930a9 Mon Sep 17 00:00:00 2001 From: Thomas Haller Date: Tue, 24 Sep 2019 19:42:24 +0200 Subject: [PATCH 16/32] tests: avoid deprecated GLib.IOChannel.add_watch() in "test-networkmanager-service.py" test_001 (__main__.TestNmcli) ... /tmp/NetworkManager/tools/test-networkmanager-service.py:2346: PyGIDeprecationWarning: add_watch is deprecated; use GLib.io_add_watch() instead id1 = GLib.IOChannel(0).add_watch(GLib.IOCondition.HUP, (cherry picked from commit ceae05cc4b1eea38916c4fc23e8ce809de7d0ebd) (cherry picked from commit a2af6cc2981ea861543d98f905abdbbf11304d82) --- tools/test-networkmanager-service.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/tools/test-networkmanager-service.py b/tools/test-networkmanager-service.py index c2d874f3f2..4049041a0c 100755 --- a/tools/test-networkmanager-service.py +++ b/tools/test-networkmanager-service.py @@ -2344,8 +2344,10 @@ def main(): raise AssertionError("Failure to request D-Bus name org.freedesktop.NetworkManager") # Watch stdin; if it closes, assume our parent has crashed, and exit - id1 = GLib.IOChannel(0).add_watch(GLib.IOCondition.HUP, - lambda io, condition: gl.mainloop.quit() or True) + id1 = GLib.io_add_watch(GLib.IOChannel.unix_new(0), + GLib.PRIORITY_DEFAULT, + GLib.IO_HUP, + lambda io, condition: gl.mainloop.quit() or True) gl.mainloop.run() From 4023968251a72d03aeeb1c0dcdd86fbf2137f999 Mon Sep 17 00:00:00 2001 From: Thomas Haller Date: Tue, 24 Sep 2019 19:56:26 +0200 Subject: [PATCH 17/32] tests: don't compare string literal with "is" in "clients/tests/test-client.py" Recent Python versions warn about this: ./clients/tests/test-client.py:569: SyntaxWarning: "is" with a literal. Did you mean "=="? elif lang is de: ./clients/tests/test-client.py:572: SyntaxWarning: "is" with a literal. Did you mean "=="? elif lang is pl: And rightly so: https://bugs.python.org/issue34850 (cherry picked from commit 989b26a843acb259bc7ba8738b5994c8ca9a1e25) (cherry picked from commit 992c5abb533bb597aa910e64bca1ce0be320f906) --- clients/tests/test-client.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/clients/tests/test-client.py b/clients/tests/test-client.py index eb1f7cba08..fdd21d544d 100755 --- a/clients/tests/test-client.py +++ b/clients/tests/test-client.py @@ -566,10 +566,10 @@ class TestNmcli(NmTestBase): if lang is None or lang == 'C': lang = 'C' language = '' - elif lang is 'de': + elif lang == 'de': lang = 'de_DE.utf8' language = 'de' - elif lang is 'pl': + elif lang == 'pl': lang = 'pl_PL.UTF-8' language = 'pl' else: From 298e57e4468b67e0cc4409c1cd15547116a7b386 Mon Sep 17 00:00:00 2001 From: Thomas Haller Date: Tue, 24 Sep 2019 20:03:47 +0200 Subject: [PATCH 18/32] tests: fix "clients/tests/test-client.py" concatenating binary for Python 3 Python 3 doesn't like this: ====================================================================== ERROR: test_001 (__main__.TestNmcli) ---------------------------------------------------------------------- Traceback (most recent call last): File "./clients/tests/test-client.py", line 785, in f self._nm_test_post() File "./clients/tests/test-client.py", line 767, in _nm_test_post content_new = ''.join([r['content'] for r in results]) TypeError: sequence item 0: expected str instance, bytes found (cherry picked from commit 97646d81ce7af642eb4b1e1095357e0ac4c347f0) (cherry picked from commit ae2d6c0bc927f3327a82e987f9363a2ab72d4381) --- clients/tests/test-client.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/clients/tests/test-client.py b/clients/tests/test-client.py index fdd21d544d..0ca7300401 100755 --- a/clients/tests/test-client.py +++ b/clients/tests/test-client.py @@ -764,7 +764,7 @@ class TestNmcli(NmTestBase): self.fail("Unexpected output of command, expected %s. Rerun test with NM_TEST_REGENERATE=1 to regenerate files" % (filename)) if regenerate: - content_new = ''.join([r['content'] for r in results]) + content_new = b''.join([r['content'] for r in results]) if content_new != content_expect: try: with open(filename, 'wb') as content_file: From 8845384e06d6d2344b34516d8c5f1d88acb94bc4 Mon Sep 17 00:00:00 2001 From: Thomas Haller Date: Wed, 25 Sep 2019 07:15:57 +0200 Subject: [PATCH 19/32] tests: fix failure installing non-existing packages in REQUIRED_PACKAGES Previously, dnf/yum used to ignore packages that didn't exist. In Fedora 32, dnf starts to fail the entire command: No match for argument: python-gobject-base Error: Unable to find a match: python-gobject-base Since this script is supposed to work with different RHEL/Fedora versions, it's expected that not all packages are available everywhere. Fix that, by installing packages that we know that they might be missing one by one (and ignore the error). (cherry picked from commit 185567559cd2d85ed44b99ccc433f83c3c8d3703) (cherry picked from commit 888718d6f4023a877da56b87563859519b899a3e) --- contrib/fedora/REQUIRED_PACKAGES | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/contrib/fedora/REQUIRED_PACKAGES b/contrib/fedora/REQUIRED_PACKAGES index 3d132094a4..af8b654609 100755 --- a/contrib/fedora/REQUIRED_PACKAGES +++ b/contrib/fedora/REQUIRED_PACKAGES @@ -10,16 +10,25 @@ # Not all of these packages are strictly speaking necessary. # This is a generous list of related packages. +set -xe + +DNF="$(which dnf &>/dev/null && echo dnf || echo yum)" + install() { if [ "$NM_INSTALL" != "" ]; then $NM_INSTALL "$@" else - sudo "$(which dnf &>/dev/null && echo dnf || echo yum)" install -y "$@" + sudo "$DNF" install -y "$@" fi } +install_ignore_missing() { + for p; do + install "$p" || : + done +} + install \ - \ ModemManager-devel \ ModemManager-glib-devel \ audit-libs-devel \ @@ -56,7 +65,6 @@ install \ ppp \ ppp-devel \ pygobject3-base \ - python-gobject-base \ python3-dbus \ python3-gobject \ qt-devel \ @@ -68,5 +76,9 @@ install \ vala-tools \ valgrind \ wireless-tools-devel \ - \ + #end + +# some packages don't exist in certain distributions. Install them one-by-one, and ignore errors. +install_ignore_missing \ + python-gobject-base \ #end From ce79b9a9b55d3d3d593339c403442afe2c9fd55a Mon Sep 17 00:00:00 2001 From: Thomas Haller Date: Wed, 25 Sep 2019 07:32:33 +0200 Subject: [PATCH 20/32] tests: don't install unnecessary package in gitlab-ci tests REQUIRED_PACKAGES has two uses: - to setup a system for developing NetworkManager. This installs convenience packages like "cscope". - to install the packages required for unit testing in gitlab-ci. For gitlab-ci we should only install the packages that we actually need. (cherry picked from commit 1a2a5b37b40c3af703f901fee1dcd9241ab69beb) (cherry picked from commit 6ff16a48bb53c940089c2e063cbb4c6308f2fa8d) --- .gitlab-ci.yml | 2 +- contrib/fedora/REQUIRED_PACKAGES | 16 +++++++++++++--- 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 9d54b12ed3..ef156c2c30 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -16,7 +16,7 @@ stages: - date '+%Y%m%d-%H%M%S'; ! grep -q '^NAME=.*\(CentOS\)' /etc/os-release || (yum install -y glibc-common && localedef -c -i pl_PL -f UTF-8 pl_PL.UTF-8 && locale -a) - - date '+%Y%m%d-%H%M%S'; NM_INSTALL="yum install -y" ./contrib/fedora/REQUIRED_PACKAGES + - date '+%Y%m%d-%H%M%S'; NM_NO_EXTRA=1 NM_INSTALL="yum install -y" ./contrib/fedora/REQUIRED_PACKAGES - date '+%Y%m%d-%H%M%S'; yum install -y glibc-langpack-pl ccache clang which # containers have "tsflags=nodocs" in /etc/dnf/dnf.conf. We need /usr/shared/gtk-doc/html diff --git a/contrib/fedora/REQUIRED_PACKAGES b/contrib/fedora/REQUIRED_PACKAGES index af8b654609..c104f6bbe7 100755 --- a/contrib/fedora/REQUIRED_PACKAGES +++ b/contrib/fedora/REQUIRED_PACKAGES @@ -28,14 +28,23 @@ install_ignore_missing() { done } +if test "$NM_NO_EXTRA" != 1; then + # these packages are convenient for developing, but not necessary + # for CI testing. + EXTRA_PACKAGES=( + bash-completion \ + cscope \ + ) +else + EXTRA_PACKAGES=() +fi + install \ ModemManager-devel \ ModemManager-glib-devel \ audit-libs-devel \ - bash-completion \ bluez-libs-devel \ bzip2 \ - cscope \ dbus-devel \ dbus-glib-devel \ dbus-python \ @@ -59,6 +68,7 @@ install \ libuuid-devel \ make \ meson \ + mobile-broadband-provider-info-devel \ newt-devel \ nss-devel \ polkit-devel \ @@ -76,7 +86,7 @@ install \ vala-tools \ valgrind \ wireless-tools-devel \ - #end + "${EXTRA_PACKAGES[@]}" # some packages don't exist in certain distributions. Install them one-by-one, and ignore errors. install_ignore_missing \ From 24554b6ccee187845bed533647a5983ecbec94d9 Mon Sep 17 00:00:00 2001 From: Thomas Haller Date: Wed, 10 Jul 2019 12:29:48 +0200 Subject: [PATCH 21/32] gitlab-ci: enable test build on Debian 10 (buster) (cherry picked from commit bf1cadbdc77030b41ba3b98ab59c6461ac9766d4) --- .gitlab-ci.yml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index f8258e457a..baf6767352 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -132,6 +132,11 @@ t_debian:9: image: debian:stretch <<: *do_build +t_debian:10: + <<: *debian_install + image: debian:stretch + <<: *do_build + t_debian:testing: <<: *debian_install image: debian:testing From 543daa0f5dc336350809f344262b785238dcf35f Mon Sep 17 00:00:00 2001 From: Thomas Haller Date: Wed, 25 Sep 2019 07:40:36 +0200 Subject: [PATCH 22/32] tests: don't install bzip2 as REQUIRED_PACKAGES on Fedora/RHEL (cherry picked from commit 3a1b2b988576a7bc43e50824976a892a2255b83f) (cherry picked from commit 2b01ac0932da1646c4d2a30b90e2bf2de3a744d8) --- contrib/fedora/REQUIRED_PACKAGES | 1 - 1 file changed, 1 deletion(-) diff --git a/contrib/fedora/REQUIRED_PACKAGES b/contrib/fedora/REQUIRED_PACKAGES index c104f6bbe7..2da5b5be55 100755 --- a/contrib/fedora/REQUIRED_PACKAGES +++ b/contrib/fedora/REQUIRED_PACKAGES @@ -44,7 +44,6 @@ install \ ModemManager-glib-devel \ audit-libs-devel \ bluez-libs-devel \ - bzip2 \ dbus-devel \ dbus-glib-devel \ dbus-python \ From be1a3ffa0eedbe346557b4a95a1efebd9114fb2f Mon Sep 17 00:00:00 2001 From: Thomas Haller Date: Thu, 11 Jul 2019 11:53:37 +0200 Subject: [PATCH 23/32] gitlab-ci: add manual build step to test on ubuntu:rolling and ubuntu:devel Rolling is the latest release (regardless of whether LTS), currently that would be 19.04. Devel is the next release, currently that would be 19.10. Add manual build steps to trigger those builds so we can manually verify that they pass. (cherry picked from commit 13b4cad989bab035c5f1cbb3edc9f05d2b692b4f) --- .gitlab-ci.yml | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index baf6767352..908d5f04de 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -127,6 +127,18 @@ t_ubuntu:18.04: image: ubuntu:18.04 <<: *do_build +t_ubuntu:rolling: + <<: *debian_install + image: ubuntu:rolling + <<: *do_build + when: manual + +t_ubuntu:devel: + <<: *debian_install + image: ubuntu:devel + <<: *do_build + when: manual + t_debian:9: <<: *debian_install image: debian:stretch From 1a0b3446864b5ca96eb31e7f457f31f6e0a337c2 Mon Sep 17 00:00:00 2001 From: Thomas Haller Date: Wed, 25 Sep 2019 09:44:14 +0200 Subject: [PATCH 24/32] build/meson: use python3 interpreter for "generate-setting-docs.py" Fedora 32 drops "python" from the path. Hence "/usr/bin/env python" won't work anymore. Of course, who needs a way to invoke the interpreter that works accross different distributions! WTF. In this case, easy to work around. We run it from meson, so we have access to the Python 3 binary. Just call python explicitly, like we do with autotools. (cherry picked from commit 7c7ad97831b91a5c5de3c4b1c551d320b0ef2ba6) (cherry picked from commit c162dc00e50431f3db2f560201051c0884ebbb1a) --- libnm/meson.build | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libnm/meson.build b/libnm/meson.build index 4b3df97f15..2938d35d52 100644 --- a/libnm/meson.build +++ b/libnm/meson.build @@ -269,7 +269,7 @@ if enable_introspection name, input: libnm_gir[0], output: name, - command: [generate_setting_docs_env, generate_setting_docs, '--lib-path', meson.current_build_dir(), '--gir', '@INPUT@', '--output', '@OUTPUT@'], + command: [generate_setting_docs_env, python.path(), generate_setting_docs, '--lib-path', meson.current_build_dir(), '--gir', '@INPUT@', '--output', '@OUTPUT@'], depends: libnm_gir, ) @@ -278,7 +278,7 @@ if enable_introspection name, input: libnm_gir[0], output: name, - command: [generate_setting_docs_env, generate_setting_docs, '--lib-path', meson.current_build_dir(), '--gir', '@INPUT@', '--overrides', nm_settings_docs_overrides, '--output', '@OUTPUT@'], + command: [generate_setting_docs_env, python.path(), generate_setting_docs, '--lib-path', meson.current_build_dir(), '--gir', '@INPUT@', '--overrides', nm_settings_docs_overrides, '--output', '@OUTPUT@'], depends: libnm_gir, ) endif From f19cf354a3b5cc7605d326792616f90b1874de8e Mon Sep 17 00:00:00 2001 From: Thomas Haller Date: Fri, 12 Jul 2019 10:31:49 +0200 Subject: [PATCH 25/32] gitlab-ci: workaround build failure in Debian:sid due to iproute2 issue Our platform unit tests try to add an IP tunnel using iproute2. That fails with "add tunnel "ip6tnl0" failed: File exists" This is a bug in iproute2-5.2.0, see [1]. Workaround the issue by downgrading the package. [1] https://www.spinics.net/lists/netdev/msg584916.html (cherry picked from commit be76d8b624fab99cbd76092ff511e6adc305279c) --- .gitlab-ci.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 908d5f04de..9d54b12ed3 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -43,6 +43,10 @@ stages: - 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 + # iproute2 5.2.0 on debian:sid causes our unit tests to fail. + # Downgrade to a working version. See https://www.spinics.net/lists/netdev/msg584916.html + - date '+%Y%m%d-%H%M%S'; ! ( dpkg -s iproute2 | grep -q '^Version[:] 5.2.0-1$' ) || (curl 'http://ftp.debian.org/debian/pool/main/i/iproute2/iproute2_4.20.0-2_amd64.deb' --output /tmp/iproute2_4.20.0-2_amd64.deb && dpkg -i /tmp/iproute2_4.20.0-2_amd64.deb) + .do_build: &do_build stage: test script: From 5a32fa961e38719978879246023815816535d701 Mon Sep 17 00:00:00 2001 From: Thomas Haller Date: Wed, 25 Sep 2019 11:28:19 +0200 Subject: [PATCH 26/32] gitlab-ci: add building on Fedora 31 And don't build Fedora 28 by default. It's aleady end of life. But for now keep it, so it can be triggered manually. (cherry picked from commit b40a3aa727a7cbc45d12cbb7aa67d14a98f16dc7) (cherry picked from commit 6a4129485aaee82cfe34e182c17ba3cc63115d2a) --- .gitlab-ci.yml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index ef156c2c30..194f8e18be 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -84,6 +84,7 @@ t_fedora:28: <<: *fedora_install image: fedora:28 <<: *do_build + when: manual t_fedora:29: <<: *fedora_install @@ -103,6 +104,11 @@ t_fedora:30: image: fedora:30 <<: *do_build +t_fedora:31: + <<: *fedora_install + image: fedora:31 + <<: *do_build + t_fedora:rawhide: <<: *fedora_install image: fedora:rawhide From 66980f57abbc7862b063d8c1f98dee6d4146e431 Mon Sep 17 00:00:00 2001 From: Thomas Haller Date: Mon, 23 Sep 2019 12:38:53 +0200 Subject: [PATCH 27/32] contrib/rpm: "Suggest" wpa_supplicant for NetworkManager-wifi package "NetworkManager-wifi" package requires either wpa_supplicant or iwd. When installing the package without explicitly installing supplicant or iwd (and not having it installed yet), then we want to drag in wpa_supplicant by default. That is accomplished by suggesting wpa_supplicant package. Otherwise, the user installing NetworkManager-wifi might get iwd, which is only functioning if the user explicitly enables the backend in "NetworkManager.conf". https://bugzilla.redhat.com/show_bug.cgi?id=1743585 (cherry picked from commit 4b1cb404fd545b748beeb440ff37afaf9cc497e1) (cherry picked from commit c44c796a904073e194adfc2709cc4e7232fbd9b2) --- contrib/fedora/rpm/NetworkManager.spec | 1 + 1 file changed, 1 insertion(+) diff --git a/contrib/fedora/rpm/NetworkManager.spec b/contrib/fedora/rpm/NetworkManager.spec index e7cfe9427a..38b751082d 100644 --- a/contrib/fedora/rpm/NetworkManager.spec +++ b/contrib/fedora/rpm/NetworkManager.spec @@ -331,6 +331,7 @@ Requires: %{name}%{?_isa} = %{epoch}:%{version}-%{release} %if %{with iwd} && (0%{?fedora} > 24 || 0%{?rhel} > 7) Requires: (wpa_supplicant >= %{wpa_supplicant_version} or iwd) +Suggests: wpa_supplicant %else # Just require wpa_supplicant on platforms that don't support boolean # dependencies even though the plugin supports both supplicant and From 6dde55e22b547de42d5590f8af6789b131a43681 Mon Sep 17 00:00:00 2001 From: Thomas Haller Date: Tue, 1 Oct 2019 09:15:30 +0200 Subject: [PATCH 28/32] gitlab-ci: workaround unit test failure for iproute2 bug in "ubuntu:devel" "ubuntu:devel" ships iproute2 version "5.2.0-1ubuntu1". This has a well known bug that prevents it from creating IP tunnels during the unit tests. We already workaround that on Debian. Add the same workaround to match the Ubuntu package. (cherry picked from commit 44193d3def785d45733ab6e72a0d9b348e4fb31c) (cherry picked from commit 27c23b0748eee6ecda9fdc98e68f421c72dbfb3c) --- .gitlab-ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 194f8e18be..44aa2ed00c 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -45,7 +45,7 @@ stages: # iproute2 5.2.0 on debian:sid causes our unit tests to fail. # Downgrade to a working version. See https://www.spinics.net/lists/netdev/msg584916.html - - date '+%Y%m%d-%H%M%S'; ! ( dpkg -s iproute2 | grep -q '^Version[:] 5.2.0-1$' ) || (curl 'http://ftp.debian.org/debian/pool/main/i/iproute2/iproute2_4.20.0-2_amd64.deb' --output /tmp/iproute2_4.20.0-2_amd64.deb && dpkg -i /tmp/iproute2_4.20.0-2_amd64.deb) + - date '+%Y%m%d-%H%M%S'; ! ( dpkg -s iproute2 | grep -q '^Version[:] 5.2.0-1\(ubuntu1\)\?$' ) || (curl 'http://ftp.debian.org/debian/pool/main/i/iproute2/iproute2_4.20.0-2_amd64.deb' --output /tmp/iproute2_4.20.0-2_amd64.deb && dpkg -i /tmp/iproute2_4.20.0-2_amd64.deb) .do_build: &do_build stage: test From 67128fe6c01b5447eb84168a2b87adc99451a8d8 Mon Sep 17 00:00:00 2001 From: Thomas Haller Date: Wed, 2 Oct 2019 18:34:54 +0200 Subject: [PATCH 29/32] checkpatch,gitlab-ci: let checkpatch script compare against latest upstream master When opening a merge request from a fork of NetworkManager, then the pipeline runs with the a checkout of the fork. That means, checkpatch would compare the branch against "master" (or "nm-x-y" stable branches) of the fork, instead of upstream. That doesn't seem too useful. Instead, also add upstream NetworkManager as git remote, fetch the branches, and use the branches from there as base for checkpatch. https://gitlab.freedesktop.org/NetworkManager/NetworkManager/issues/255 (cherry picked from commit 3019648b4bc1856b84b904bb4cf02500fe35cb76) (cherry picked from commit 9a3770231165c2a9b3541f9273c22f7f4d9c155b) --- .gitlab-ci.yml | 2 +- contrib/scripts/checkpatch-feature-branch.sh | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 44aa2ed00c..bb38d67548 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -73,7 +73,7 @@ checkpatch: stage: test script: - date '+%Y%m%d-%H%M%S'; dnf install -y git - - date '+%Y%m%d-%H%M%S'; contrib/scripts/checkpatch-feature-branch.sh 2>&1 | tee checkpatch-out.txt + - date '+%Y%m%d-%H%M%S'; NM_CHECKPATCH_FETCH_UPSTREAM=1 contrib/scripts/checkpatch-feature-branch.sh 2>&1 | tee checkpatch-out.txt allow_failure: true artifacts: when: on_failure diff --git a/contrib/scripts/checkpatch-feature-branch.sh b/contrib/scripts/checkpatch-feature-branch.sh index 0f37728d9f..72e5903dae 100755 --- a/contrib/scripts/checkpatch-feature-branch.sh +++ b/contrib/scripts/checkpatch-feature-branch.sh @@ -15,6 +15,12 @@ if printf '%s' "$HEAD" | grep -q '\.\.'; then else BASE_REF="refs/remotes/origin/" + if [ "$NM_CHECKPATCH_FETCH_UPSTREAM" == 1 ]; then + git remote add nm-upstream https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git + git fetch nm-upstream || die "failure to fetch from https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git" + BASE_REF="refs/remotes/nm-upstream/" + fi + # the argument is only a single ref (or the default "HEAD"). # Find all commits that branch off one of the stable branches or master # and lead to $HEAD. These are the commits of the feature branch. From 49069cad59895e70a2469367e62e84e7e8ed5acc Mon Sep 17 00:00:00 2001 From: Thomas Haller Date: Tue, 8 Oct 2019 15:35:45 +0200 Subject: [PATCH 30/32] libnm-glib: don't use deprecated g_thread_supported() and g_thread_init() Building the sources requires libnm newer than glib 2.32, but g_thread_supported() and g_thread_init() are deprecated since 2.32. This causes a build failure due to the deprecated warning. --- libnm-glib/libnm_glib.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/libnm-glib/libnm_glib.c b/libnm-glib/libnm_glib.c index 1e0725ca1d..8f4ce10a4d 100644 --- a/libnm-glib/libnm_glib.c +++ b/libnm-glib/libnm_glib.c @@ -483,8 +483,6 @@ libnm_glib_init (void) { libnm_glib_ctx *ctx = NULL; - if (!g_thread_supported ()) - g_thread_init (NULL); dbus_g_thread_init (); if (!(ctx = _libnm_glib_ctx_new ())) From 0ed8baa00f2e961c1daeb296a4cb4d5a07acec6d Mon Sep 17 00:00:00 2001 From: Thomas Haller Date: Tue, 3 Sep 2019 18:13:26 +0200 Subject: [PATCH 31/32] core/tests: avoid deprecated g_main_run()/g_main_loop_unref() in test These are deprecated. Also, they are nowadays implemented as macros that expand to #define g_main_run(loop) g_main_loop_run(loop) GLIB_DEPRECATED_MACRO_IN_2_26_FOR(g_main_loop_run) This can cause compilation failure (in some environments). (cherry picked from commit de6f0bc6db35a7c6b6f70b18502a9fcb0afd5ad6) (cherry picked from commit 9e209138dc74d8b39545e0210ad8a49e1e2456ac) --- src/tests/test-general-with-expect.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/tests/test-general-with-expect.c b/src/tests/test-general-with-expect.c index 8339fa5d43..cc06be3858 100644 --- a/src/tests/test-general-with-expect.c +++ b/src/tests/test-general-with-expect.c @@ -119,13 +119,13 @@ test_nm_utils_kill_child_async_do (const char *name, pid_t pid, int sig, guint32 timeout_id = g_timeout_add_seconds (5, test_nm_utils_kill_child_async_fail_cb, &data); data.loop = g_main_loop_new (NULL, FALSE); - g_main_run (data.loop); + g_main_loop_run (data.loop); g_assert (data.called); success = g_source_remove (timeout_id); g_assert (success); - g_main_destroy (data.loop); + g_main_loop_unref (data.loop); } static void @@ -574,4 +574,3 @@ main (int argc, char **argv) return g_test_run (); } - From 173e6bbffb8762c870b24eab966684a4677b1b16 Mon Sep 17 00:00:00 2001 From: Thomas Haller Date: Thu, 13 Jun 2019 11:26:31 +0200 Subject: [PATCH 32/32] src/tests: show exit status in test failure of test_nm_utils_kill_child() This test keeps randomly failing. Rework is, so that we see the actual exit status in the output of the failed test. (cherry picked from commit 49c6fa2ba763955cd2a2aeab6517e7105f3e4931) --- src/tests/test-general-with-expect.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/tests/test-general-with-expect.c b/src/tests/test-general-with-expect.c index cc06be3858..ed36230ab0 100644 --- a/src/tests/test-general-with-expect.c +++ b/src/tests/test-general-with-expect.c @@ -385,7 +385,12 @@ test_nm_utils_kill_child (void) err = waitpid (child_pid, &exit_status, 0); } while (err == -1 && errno == EINTR); g_assert (err == child_pid); - g_assert (WIFEXITED (exit_status) && WEXITSTATUS(exit_status) == 0); + if (WIFEXITED (exit_status)) + g_assert_cmpint (WEXITSTATUS (exit_status), ==, 0); + else { + g_assert_cmpint (exit_status, ==, 0); + g_assert_not_reached (); + } } /*****************************************************************************/