gitlab: merge branch 'th/gitlab-ci'

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/merge_requests/25
This commit is contained in:
Thomas Haller
2018-10-22 13:21:36 +02:00
9 changed files with 180 additions and 28 deletions

91
.gitlab-ci.yml Normal file
View File

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

23
contrib/fedora/REQUIRED_PACKAGES Normal file → Executable file
View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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