summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Haller <thaller@redhat.com>2018-10-22 13:21:36 +0200
committerThomas Haller <thaller@redhat.com>2018-10-22 13:21:36 +0200
commit31f13acdc994470cf57ab3fc722ae23539be8c0c (patch)
treeee8f580825f4baff71b3ad8cc99f3589024a6aca
parent1913a4d2590d42413b04c0cf86321286bb2e2dbd (diff)
parenta0a082456496aefc5fee4e24d31c171f0b7645c0 (diff)
downloadNetworkManager-31f13acdc994470cf57ab3fc722ae23539be8c0c.tar.gz
gitlab: merge branch 'th/gitlab-ci'
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/merge_requests/25
-rw-r--r--.gitlab-ci.yml91
-rwxr-xr-x[-rw-r--r--]contrib/fedora/REQUIRED_PACKAGES23
-rw-r--r--contrib/fedora/rpm/README2
-rwxr-xr-xcontrib/scripts/checkpatch-feature-branch.sh31
-rwxr-xr-xcontrib/scripts/checkpatch.pl8
-rw-r--r--src/meson.build13
-rw-r--r--src/ndisc/tests/meson.build6
-rw-r--r--src/platform/tests/meson.build26
-rw-r--r--src/platform/tests/test-nmp-object.c8
9 files changed, 180 insertions, 28 deletions
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
new file mode 100644
index 0000000000..33c95bd957
--- /dev/null
+++ b/.gitlab-ci.yml
@@ -0,0 +1,91 @@
+# Quick syntax check:
+# python -c 'import sys, yaml; yaml.dump (yaml.load (sys.stdin), sys.stdout)' <.gitlab-ci.yml
+
+# If things don't seem to work, this can help:
+# https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/ci/lint
+
+stages:
+ - test
+ - deploy
+
+.fedora_install: &fedora_install
+ before_script:
+ - NM_INSTALL="dnf install -y" ./contrib/fedora/REQUIRED_PACKAGES
+
+checkpatch:
+ image: fedora:28
+ stage: test
+ script:
+ - dnf install -y git
+ - contrib/scripts/checkpatch-feature-branch.sh 2>&1 | tee checkpatch-out.txt
+ allow_failure: true
+ artifacts:
+ when: on_failure
+ paths:
+ - checkpatch-out.txt
+
+f28_build_default:
+ <<: *fedora_install
+ image: fedora:28
+ stage: test
+ script:
+ - dnf install -y glibc-langpack-pl
+ - locale -a
+ - NOCONFIGURE=1 ./autogen.sh
+ - mkdir ./build
+ - cd ./build
+ - ../configure
+ --prefix="$PWD/INST"
+ --enable-gtk-doc=yes
+ --with-systemd-logind=yes
+ --enable-more-warnings=error
+ --enable-tests=yes
+ --with-crypto=gnutls
+ --with-libnm-glib=yes
+ --with-iwd=yes
+ --with-ofono=yes
+ --enable-teamdctl=yes
+ --with-dhcpcanon=yes
+ --with-dhcpcd=yes
+ --with-dhclient=yes
+ --with-netconfig=/bin/nowhere/netconfig
+ --with-resolvconf=/bin/nowhere/resolvconf
+ --enable-ifcfg-rh=yes
+ --enable-config-plugin-ibft=yes
+ --enable-ifupdown=yes
+ - make -j 6
+ - make install
+ - NM_TEST_CLIENT_CHECK_L10N=1 make -j 6 -k check
+ - cd ..
+ - mv build/INST/share/gtk-doc/html docs-html
+ artifacts:
+ expire_in: 1 day
+ paths:
+ - docs-html
+
+f28_rpm_autotools_dbg:
+ <<: *fedora_install
+ image: fedora:28
+ stage: test
+ script:
+ - ./contrib/fedora/rpm/build_clean.sh -g -w crypto_gnutls -w debug -w iwd -w test
+
+f28_rpm_meson_dbg:
+ <<: *fedora_install
+ image: fedora:28
+ stage: test
+ script:
+ - ./contrib/fedora/rpm/build_clean.sh -g -w crypto_gnutls -w debug -w iwd -w meson -w test
+
+pages:
+ stage: deploy
+ dependencies:
+ - f28_build_default
+ script:
+ - mv docs-html public
+ artifacts:
+ expire_in: 20 days
+ paths:
+ - public
+ only:
+ - master
diff --git a/contrib/fedora/REQUIRED_PACKAGES b/contrib/fedora/REQUIRED_PACKAGES
index 2efe95ce95..4a0ee4452d 100644..100755
--- a/contrib/fedora/REQUIRED_PACKAGES
+++ b/contrib/fedora/REQUIRED_PACKAGES
@@ -1,3 +1,5 @@
+#!/bin/bash
+
# A list of packages useful/needed to build and develop
# NetworkManager on Fedora and RHEL.
#
@@ -8,7 +10,16 @@
# Not all of these packages are strictly speaking necessary.
# This is a generous list of related packages.
-yum install \
+install() {
+ if [ "$NM_INSTALL" != "" ]; then
+ $NM_INSTALL "$@"
+ else
+ sudo "$(which dnf &>/dev/null && echo dnf || echo yum)" install -y "$@"
+ fi
+}
+
+install \
+ \
ModemManager-devel \
ModemManager-glib-devel \
audit-libs-devel \
@@ -21,6 +32,7 @@ yum install \
dbus-python \
dbus-x11 \
dhclient \
+ gcc-c++ \
gettext-devel \
git \
gnutls-devel \
@@ -35,11 +47,15 @@ yum install \
libselinux-devel \
libtool \
libuuid-devel \
+ make \
+ meson \
newt-devel \
nss-devel \
polkit-devel \
ppp-devel \
pygobject3-base \
+ python3-dbus \
+ qt-devel \
readline-devel \
rpm-build \
systemd-devel \
@@ -47,5 +63,6 @@ yum install \
vala-devel \
vala-tools \
valgrind \
- wireless-tools-devel
-
+ wireless-tools-devel \
+ \
+ #end
diff --git a/contrib/fedora/rpm/README b/contrib/fedora/rpm/README
index 8cc9c6f0a0..7982a1ef5b 100644
--- a/contrib/fedora/rpm/README
+++ b/contrib/fedora/rpm/README
@@ -7,7 +7,7 @@
git clone https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
cd NetworkManager
git checkout $WHATEVER
-sudo sh ./contrib/fedora/REQUIRED_PACKAGES
+./contrib/fedora/REQUIRED_PACKAGES
#
diff --git a/contrib/scripts/checkpatch-feature-branch.sh b/contrib/scripts/checkpatch-feature-branch.sh
new file mode 100755
index 0000000000..6741317be2
--- /dev/null
+++ b/contrib/scripts/checkpatch-feature-branch.sh
@@ -0,0 +1,31 @@
+#!/bin/bash
+
+die() {
+ printf "%s\n" "$@"
+ exit 1
+}
+
+HEAD="${1:-HEAD}"
+
+BASE_DIR="$(dirname "$0")"
+
+BASE_REF="refs/remotes/origin/"
+
+RANGES=( $(git show-ref | sed 's#^\(.*\) '"$BASE_REF"'\(master\|nm-1-[0-9]\+\)$#\1..'"$HEAD"'#p' -n) )
+
+[ "${#RANGES[@]}" != 0 ] || die "cannot detect git-ranges (HEAD is $(git rev-parse HEAD))"
+
+REFS=( $(git log --reverse --format='%H' "${RANGES[@]}") )
+
+[ "${#REFS[@]}" != 0 ] || die "no refs detected (HEAD is $(git rev-parse HEAD))"
+
+SUCCESS=0
+for H in ${REFS[@]}; do
+ export NM_CHECKPATCH_HEADER=$'\n'">>> VALIDATE \"$(git log --oneline -n1 "$H")\""
+ git format-patch -U65535 --stdout -1 "$H" | "$BASE_DIR/checkpatch.pl"
+ if [ $? != 0 ]; then
+ SUCCESS=1
+ fi
+done
+
+exit $SUCCESS
diff --git a/contrib/scripts/checkpatch.pl b/contrib/scripts/checkpatch.pl
index 0769273bcb..67ffbc4256 100755
--- a/contrib/scripts/checkpatch.pl
+++ b/contrib/scripts/checkpatch.pl
@@ -72,11 +72,19 @@ sub new_file
@functions_seen = ();
}
+my $header = $ENV{'NM_CHECKPATCH_HEADER'};
+
sub complain
{
my $message = shift;
return unless $check_line;
+
+ if (defined($header)) {
+ warn "$header\n";
+ undef $header;
+ }
+
warn "$filename:$line_no: $message:\n";
warn "> $line\n\n";
$seen_error = 1;
diff --git a/src/meson.build b/src/meson.build
index f293f299b5..d58fb4d1f6 100644
--- a/src/meson.build
+++ b/src/meson.build
@@ -216,9 +216,6 @@ if enable_tests
test_cflags += ['-DREQUIRE_ROOT_TESTS=1']
endif
- platform = (host_machine.system().contains('linux') ? 'linux' : 'fake')
- test_cflags_platform = '-DSETUP=nm_' + platform + '_platform_setup'
-
libnetwork_manager_test = static_library(
nm_name + 'Test',
sources: sources,
@@ -233,6 +230,16 @@ if enable_tests
link_with: libnetwork_manager_test
)
+ test_nm_dep_fake = declare_dependency(
+ dependencies: test_nm_dep,
+ compile_args: ['-DSETUP=nm_fake_platform_setup']
+ )
+
+ test_nm_dep_linux = declare_dependency(
+ dependencies: test_nm_dep,
+ compile_args: ['-DSETUP=nm_linux_platform_setup']
+ )
+
subdir('dnsmasq/tests')
subdir('ndisc/tests')
subdir('platform/tests')
diff --git a/src/ndisc/tests/meson.build b/src/ndisc/tests/meson.build
index 2f479c2d9f..e0dc9aa6cb 100644
--- a/src/ndisc/tests/meson.build
+++ b/src/ndisc/tests/meson.build
@@ -3,8 +3,7 @@ test_unit = 'test-ndisc-fake'
exe = executable(
test_unit,
test_unit + '.c',
- dependencies: test_nm_dep,
- c_args: test_cflags_platform
+ dependencies: test_nm_dep_fake,
)
test(
@@ -18,6 +17,5 @@ test = 'test-ndisc-linux'
exe = executable(
test,
test + '.c',
- dependencies: test_nm_dep,
- c_args: test_cflags_platform
+ dependencies: test_nm_dep_linux,
)
diff --git a/src/platform/tests/meson.build b/src/platform/tests/meson.build
index 0571efacff..67582d7766 100644
--- a/src/platform/tests/meson.build
+++ b/src/platform/tests/meson.build
@@ -1,28 +1,27 @@
test_units = [
- ['test-link-fake', 'test-link.c', 60],
- ['test-link-linux', 'test-link.c', 60],
- ['test-address-fake', 'test-address.c'],
- ['test-address-linux', 'test-address.c'],
- ['test-general', 'test-general.c'],
- ['test-nmp-object', 'test-nmp-object.c'],
- ['test-route-fake', 'test-route.c'],
- ['test-route-linux', 'test-route.c'],
- ['test-cleanup-fake', 'test-cleanup.c'],
- ['test-cleanup-linux', 'test-cleanup.c'],
+ ['test-link-fake', 'test-link.c', test_nm_dep_fake, 30],
+ ['test-link-linux', 'test-link.c', test_nm_dep_linux, 90],
+ ['test-address-fake', 'test-address.c', test_nm_dep_fake, 30],
+ ['test-address-linux', 'test-address.c', test_nm_dep_linux, 30],
+ ['test-general', 'test-general.c', test_nm_dep, 30],
+ ['test-nmp-object', 'test-nmp-object.c', test_nm_dep, 30],
+ ['test-route-fake', 'test-route.c', test_nm_dep_fake, 30],
+ ['test-route-linux', 'test-route.c', test_nm_dep_linux, 30],
+ ['test-cleanup-fake', 'test-cleanup.c', test_nm_dep_fake, 30],
+ ['test-cleanup-linux', 'test-cleanup.c', test_nm_dep_linux, 30],
]
foreach test_unit: test_units
exe = executable(
'platform-' + test_unit[0],
test_unit[1],
- dependencies: test_nm_dep,
- c_args: test_cflags_platform
+ dependencies: test_unit[2],
)
test(
'platform/' + test_unit[0],
test_script,
- timeout: test_unit.length() > 2 ? test_unit[2] : 30,
+ timeout: test_unit[3],
args: test_args + [exe.full_path()]
)
endforeach
@@ -33,5 +32,4 @@ executable(
test,
test + '.c',
dependencies: test_nm_dep,
- c_args: test_cflags_platform
)
diff --git a/src/platform/tests/test-nmp-object.c b/src/platform/tests/test-nmp-object.c
index 047d7a854b..12acf4a544 100644
--- a/src/platform/tests/test-nmp-object.c
+++ b/src/platform/tests/test-nmp-object.c
@@ -267,10 +267,11 @@ test_cache_link (void)
struct udev_device *udev_device_3 = g_list_nth_data (global.udev_devices, 0);
NMPCacheOpsType ops_type;
nm_auto_unref_dedup_multi_index NMDedupMultiIndex *multi_idx = NULL;
+ gboolean use_udev = nmtst_get_rand_int () % 2;
multi_idx = nm_dedup_multi_index_new ();
- cache = nmp_cache_new (multi_idx, nmtst_get_rand_int () % 2);
+ cache = nmp_cache_new (multi_idx, use_udev);
/* if we have a link, and don't set is_in_netlink, adding it has no effect. */
objm1 = nmp_object_new (NMP_OBJECT_TYPE_LINK, (NMPlatformObject *) &pl_link_2);
@@ -387,7 +388,8 @@ test_cache_link (void)
} else {
g_assert (nmp_cache_lookup_obj (cache, objm1) == NULL);
g_assert (nmp_cache_lookup_obj (cache, nmp_object_stackinit_id_link (&objs1, pl_link_2.ifindex)) == NULL);
- g_assert (nmp_object_is_visible (obj_new));
+ g_assert (!nmp_object_is_alive (obj_new));
+ g_assert (!nmp_object_is_visible (obj_new));
}
nmp_object_unref (objm1);
nmp_object_unref (obj_old);
@@ -587,7 +589,7 @@ main (int argc, char **argv)
while (global.udev_devices) {
udev_device_unref (global.udev_devices->data);
- global.udev_devices = g_list_remove (global.udev_devices, global.udev_devices->data);
+ global.udev_devices = g_list_delete_link (global.udev_devices, global.udev_devices);
}
nm_udev_client_unref (udev_client);