all: merge branch 'test-and-build-fixes-for-nm-1-18' into nm-1-18

Backport various kinds of build and test fixes. Now our gitlab-ci setup
on nm-1-18 is very similar to what we also do on nm-1-20 branch and
runs the same kind of tests.
This commit is contained in:
Thomas Haller 2019-10-08 16:39:11 +02:00
commit add572607e
25 changed files with 310 additions and 120 deletions

View file

@ -10,15 +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_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
# 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'; ! 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
@ -27,6 +41,11 @@ 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
# 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\(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
@ -35,26 +54,26 @@ 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'; git clean -fdx ; BUILD_TYPE=autotools CC=gcc WITH_DOCS=1 contrib/scripts/nm-ci-run.sh
- 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 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
- 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
- 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
- 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
@ -65,6 +84,7 @@ t_fedora:28:
<<: *fedora_install
image: fedora:28
<<: *do_build
when: manual
t_fedora:29:
<<: *fedora_install
@ -84,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
@ -91,6 +116,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
@ -101,11 +137,28 @@ 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
<<: *do_build
t_debian:10:
<<: *debian_install
image: debian:stretch
<<: *do_build
t_debian:testing:
<<: *debian_install
image: debian:testing

View file

@ -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

View file

@ -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)
@ -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:
@ -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:

View file

@ -70,5 +70,6 @@ install \
python3-gi \
python3-pip \
uuid-dev \
valgrind \
\
#end

View file

@ -10,23 +10,40 @@
# 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
}
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 \
@ -50,9 +67,11 @@ install \
libuuid-devel \
make \
meson \
mobile-broadband-provider-info-devel \
newt-devel \
nss-devel \
polkit-devel \
ppp \
ppp-devel \
pygobject3-base \
python3-dbus \
@ -66,5 +85,9 @@ install \
vala-tools \
valgrind \
wireless-tools-devel \
\
"${EXTRA_PACKAGES[@]}"
# some packages don't exist in certain distributions. Install them one-by-one, and ignore errors.
install_ignore_missing \
python-gobject-base \
#end

View file

@ -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

View file

@ -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"

View file

@ -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.

View file

@ -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

View file

@ -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\""
;;
@ -52,6 +59,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
@ -79,12 +90,45 @@ 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
}
###############################################################################
_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 _with_valgrind; then
echo ">>>> PRINT VALGRIND LOGS $1 (start)"
find -name '*.valgrind-log' -print0 | xargs -0 grep -H ^ || true
echo ">>>> PRINT VALGRIND LOGS $1 (done)"
fi
}
run_autotools() {
@ -138,15 +182,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 _with_valgrind; then
if ! NMTST_USE_VALGRIND=1 make check -j 3 -k ; then
_print_test_logs "(valgrind test)"
die "valgrind test failed"
fi
fi
popd
}
@ -198,6 +249,13 @@ run_meson() {
ninja -C build
ninja -C build test
if _with_valgrind; then
if ! NMTST_USE_VALGRIND=1 ninja -C build test; then
_print_test_logs "(valgrind test)"
die "valgrind test failed"
fi
fi
}
###############################################################################

View file

@ -46,7 +46,7 @@ ip -n macsec-ns link set macsec-vethp up
echo "* Start wpa_supplicant..."
cat <<EOF > $TMPDIR/wpa_supplicant.conf
ctrl_interface=/var/run/hostapd1
ctrl_interface=/run/hostapd1
eapol_version=3
ap_scan=0
fast_reauth=1

View file

@ -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 ()))

View file

@ -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

View file

@ -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)

View file

@ -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',

View file

@ -635,8 +635,14 @@ 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)), \
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))
#endif
#if _NM_CC_SUPPORT_GENERIC

View file

@ -9,7 +9,6 @@ foreach test_unit: test_units
test_unit + '.c',
dependencies: test_nm_dep,
)
test(
'devices/' + test_unit,
test_script,

View file

@ -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);
}
/*****************************************************************************/

View file

@ -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;

View file

@ -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

View file

@ -1,23 +1,22 @@
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
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,
)

View file

@ -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;

View file

@ -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
@ -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 ();
}
}
/*****************************************************************************/
@ -574,4 +579,3 @@ main (int argc, char **argv)
return g_test_run ();
}

View file

@ -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()