about summary refs log tree commit diff
path: root/tools
diff options
context:
space:
mode:
Diffstat (limited to 'tools')
-rwxr-xr-xtools/check-config-options.sh72
-rwxr-xr-xtools/check-docs.sh79
-rwxr-xr-xtools/check-settings-docs.sh19
-rwxr-xr-xtools/create-exports-NetworkManager.sh2
-rwxr-xr-xtools/meson-post-install.sh2
-rwxr-xr-xtools/run-nm-test.sh9
-rwxr-xr-xtools/test-networkmanager-service.py19
7 files changed, 172 insertions, 30 deletions
diff --git a/tools/check-config-options.sh b/tools/check-config-options.sh
new file mode 100755
index 00000000..659f5490
--- /dev/null
+++ b/tools/check-config-options.sh
@@ -0,0 +1,72 @@
+#!/bin/bash
+
+srcdir=${1:-.}
+ret=0
+
+get_supported_options()
+{
+    awk '/START OPTION LIST/{flag=1;next}/END OPTION LIST/{flag=0}flag' "$srcdir/src/nm-config.c" |
+	grep -o 'NM_CONFIG_KEYFILE_KEY_\w*'
+}
+
+get_missing_options()
+{
+    grep -v '/\* check-config-options skip \*/' "$srcdir/src/nm-config.h" |
+	grep -o 'NM_CONFIG_KEYFILE_KEY_\w*' |
+	grep -v -Fx -f <(get_supported_options)
+}
+
+get_src_con_defaults()
+{
+    sed -ne 's/.*\<NM_CON_DEFAULT\s*("\([^"]*\)").*/\1/p' $(find "$srcdir/src/" -name \*.c ! -name test\*.c)
+    sed -ne 's/.*\<NM_CON_DEFAULT_NOP\s*("\([^"]*\)").*/\1/p' $(find "$srcdir/src/" -name \*.c ! -name test\*.c)
+}
+
+get_man_con_defaults()
+{
+    awk '/start connection defaults/{flag=1;next}/end connection defaults/{flag=0}flag' "$srcdir/man/NetworkManager.conf.xml" |
+	sed -ne 's#.*<varname>\([^<]*\)</varname>.*#\1#p'
+}
+
+get_missing_con_defaults()
+{
+    get_src_con_defaults | grep -v -Fx -f <(get_man_con_defaults)
+}
+
+get_missing_con_defaults2()
+{
+    get_man_con_defaults | grep -v -Fx -f <(get_src_con_defaults)
+}
+
+missing=$(get_missing_options)
+
+if [ -n "$missing" ]; then
+    echo "***"
+    echo "*** Error: the following configuration options are defined but not present in the list of supported options"
+    echo "***"
+    echo "$missing"
+    echo
+    ret=1
+fi
+
+missing_con_defaults=$(get_missing_con_defaults)
+if [ -n "$missing_con_defaults" ]; then
+    echo "***"
+    echo "*** Error: the following connection defaults are present in source files but not in the NetworkManager.conf man page:"
+    echo "***"
+    echo "$missing_con_defaults"
+    echo
+    ret=1
+fi
+
+missing_con_defaults2=$(get_missing_con_defaults2)
+if [ -n "$missing_con_defaults2" ]; then
+    echo "***"
+    echo "*** Error: the following connection defaults are present in the NetworkManager.conf man page but not in source files:"
+    echo "***"
+    echo "$missing_con_defaults2"
+    echo
+    ret=1
+fi
+
+exit $ret
diff --git a/tools/check-docs.sh b/tools/check-docs.sh
index 9dcdb1ef..b6fca6e0 100755
--- a/tools/check-docs.sh
+++ b/tools/check-docs.sh
@@ -1,22 +1,73 @@
-#!/bin/sh
+#!/bin/bash
 
-SOURCEDIR=$1
+set -e
+
+export LANG=C
+
+die() {
+    printf '%s\n' "$@" >&2
+    exit 1
+}
+
+word_regex() {
+    tr '\n|<>\\' ' ' \
+    | sed -e 's, *$,\\>,' \
+          -e 's,^ *,\\<,' \
+          -e 's, \+,\\>\\|\\<,g'
+}
+
+same_lines() {
+    diff <(printf "%s\n" "$1" | sed '/^$/d' | sort) \
+         <(printf "%s\n" "$2" | sed '/^$/d' | sort) >&2
+}
+
+libnm_headers() {
+    (
+        ls -1 "$1"libnm/*.h "$1"libnm-core/*.h
+        if [ -n "$2" ]; then
+            ls -1 "$2"/libnm/*.h "$2"/libnm-core/*.h
+        fi
+    ) | sort | uniq
+}
+
+
+SOURCEDIR="$1"
+BUILDDIR="$2"
+if test "$SOURCEDIR" == "$BUILDDIR"; then
+    BUILDDIR=
+fi
 [ -n "$SOURCEDIR" ] && SOURCEDIR="$SOURCEDIR/"
 
+
 # Check that the D-Bus API docs contain all known interfaces
-if (sed -n 's/.*<xi:include href="dbus-\(.*\.xml\)".*/\1\n\1/p' $SOURCEDIR''docs/api/network-manager-docs.xml;
-    cd $SOURCEDIR''introspection; ls *.xml) |sort |uniq -u| grep . >&2; then
-	echo "*** Error: D-Bus interfaces not included in docs/api/network-manager-docs.xml ***" >&2
-	exit 1
+F1="$(sed -n 's,^      <xi:include href="dbus-\([^"]*\.xml\)"/>$,\1,p' "$SOURCEDIR"docs/api/network-manager-docs.xml)"
+F1_EXTRA="
+org.freedesktop.NetworkManager.Device.WiMax.xml
+org.freedesktop.NetworkManager.WiMax.Nsp.xml
+"
+F2="$(cd "$SOURCEDIR"introspection; ls -1 *.xml)"
+if ! same_lines "$F1"$'\n'"$F1_EXTRA" "$F2" ; then
+    die "*** Error: D-Bus interfaces not included in docs/api/network-manager-docs.xml ***"
 fi
 
+
 # Check that files that define types that are in public libnm API are included in libnm documentation.
-# Don't complain about readability or I'll rewrite this in Perl.
-if (sed -n 's/.*<xi:include href="\(xml\/.*\.xml\)".*/\1\n\1/p' $SOURCEDIR''docs/libnm/libnm-docs.xml;
-    grep -lE "$(sed -n 's/^[\t ]*\(.*_get_type\);/\1/p' $SOURCEDIR''libnm/libnm.ver |xargs echo |sed 's/ /|/g')" $SOURCEDIR''libnm{,-core}/*.h |
-    sed 's,.*/,xml/,;s/\.h$/.xml/') |sort |uniq -u| grep . >&2; then
-	echo "*** Error: libnm classes not included in docs/libnm/libnm-docs.xml ***" >&2
-	exit 1
+F1="$(sed -n 's/.*<xi:include href="xml\/\([^"]*\)\.xml".*/\1/p' "$SOURCEDIR"docs/libnm/libnm-docs.xml)"
+F1_EXTRA="
+nm-core-enum-types
+nm-enum-types
+"
+F2="$(grep -l "$(sed -n 's/^[\t ]*\(.*_get_type\);/\1/p' "$SOURCEDIR"libnm/libnm.ver | word_regex)" \
+           $(libnm_headers "$SOURCEDIR" "$BUILDDIR") \
+      | sed 's,.*/\([^/]\+\)\.h$,\1,')"
+F2_EXTRA="
+annotation-glossary
+api-index-full
+nm-dbus-interface
+nm-errors
+nm-utils
+nm-version
+"
+if ! same_lines "$F1"$'\n'"$F1_EXTRA" "$F2"$'\n'"$F2_EXTRA"; then
+    die "*** Error: libnm classes not included in docs/libnm/libnm-docs.xml ***"
 fi
-
-exit 0
diff --git a/tools/check-settings-docs.sh b/tools/check-settings-docs.sh
new file mode 100755
index 00000000..8695ccc0
--- /dev/null
+++ b/tools/check-settings-docs.sh
@@ -0,0 +1,19 @@
+#!/bin/sh
+
+srcdir=$1
+builddir=$2
+doc_h=$3
+
+if [ -z "$NMTST_NO_CHECK_SETTINGS_DOCS" ] ; then
+    if ! cmp -s "${srcdir}/${doc_h}.in" "${builddir}/${doc_h}"; then
+        if [ "$NM_TEST_REGENERATE" = 1 ] ; then
+            cp -f "${builddir}/${doc_h}" "${srcdir}/${doc_h}.in"
+        else
+            echo "*** Error: the generated file '${builddir}/${doc_h}' differs from the source file '${srcdir}/${doc_h}.in'. You probably should copy the generated file over to the source file. You can skip this test by setting NMTST_NO_CHECK_SETTINGS_DOCS=yes. You can also automatically copy the file by rerunning the test with NM_TEST_REGENERATE=1"
+            exit 1
+        fi
+    fi
+fi
+
+exit 0
+
diff --git a/tools/create-exports-NetworkManager.sh b/tools/create-exports-NetworkManager.sh
index 3c5789d8..375141aa 100755
--- a/tools/create-exports-NetworkManager.sh
+++ b/tools/create-exports-NetworkManager.sh
@@ -19,7 +19,7 @@ die() {
 _build() {
     git clean -fdx
     ./autogen.sh --enable-ld-gc --enable-ifcfg-rh --enable-ifupdown \
-        --enable-ibft --enable-teamdctl --enable-wifi \
+        --enable-config-plugin-ibft --enable-teamdctl --enable-wifi \
         --with-modem-manager-1 --with-ofono --with-more-asserts \
         --with-more-logging
     make -j20
diff --git a/tools/meson-post-install.sh b/tools/meson-post-install.sh
index 8a60ce33..2037c0ce 100755
--- a/tools/meson-post-install.sh
+++ b/tools/meson-post-install.sh
@@ -42,6 +42,6 @@ if [ "$6" = install_docs ]; then
         ln -f "${DESTDIR}${mandir}/man1/nmtui.1" "${DESTDIR}${mandir}/man1/${alias}.1"
     done
 
-    ln -f "${DESTDIR}${mandir}/man5/NetworkManager.conf.5" "${DESTDIR}${mandir}/man5/nm-system-settings.conf"
+    ln -f "${DESTDIR}${mandir}/man5/NetworkManager.conf.5" "${DESTDIR}${mandir}/man5/nm-system-settings.conf.5"
 fi
 
diff --git a/tools/run-nm-test.sh b/tools/run-nm-test.sh
index 29ac7cd3..6e7d02c8 100755
--- a/tools/run-nm-test.sh
+++ b/tools/run-nm-test.sh
@@ -278,7 +278,7 @@ if [ $RESULT -ne 0 -a $RESULT -ne 77 ]; then
         UNRESOLVED=$(awk -F: '/obj:\// {print $NF}' "$LOGFILE" | sort | uniq)
         if [ -n "$UNRESOLVED" ]; then
             echo Some addresses could not be resolved into symbols. >&2
-            echo The errors might get suppressed when you install the debuging symbols. >&2
+            echo The errors might get suppressed when you install the debugging symbols. >&2
             if [ -x /usr/bin/dnf ]; then
                 echo Hint: dnf debuginfo-install $UNRESOLVED >&2
             elif [ -x /usr/bin/debuginfo-install ]; then
@@ -294,8 +294,11 @@ fi
 if [ $HAS_ERRORS -eq 0 ]; then
     # valgrind doesn't support setns syscall and spams the logfile.
     # hack around it...
-    if [ "$TEST_NAME" = 'test-link-linux' -a -z "$(sed -e '/^--[0-9]\+-- WARNING: unhandled .* syscall: /,/^--[0-9]\+-- it at http.*\.$/d' "$LOGFILE")" ]; then
-        HAS_ERRORS=1
+    if [ "$TEST_NAME" = 'test-link-linux' -o \
+         "$TEST_NAME" = 'test-acd' ]; then
+        if [ -z "$(sed -e '/^--[0-9]\+-- WARNING: unhandled .* syscall: /,/^--[0-9]\+-- it at http.*\.$/d' "$LOGFILE")" ]; then
+            HAS_ERRORS=1
+        fi
     fi
 fi
 
diff --git a/tools/test-networkmanager-service.py b/tools/test-networkmanager-service.py
index 8a37fb17..7d9eceb8 100755
--- a/tools/test-networkmanager-service.py
+++ b/tools/test-networkmanager-service.py
@@ -916,16 +916,8 @@ class WifiDevice(Device):
         self.aps = []
         self.scan_cb_id = None
 
-        # Note: we would like to simulate how nmcli calls RequestScan() and we could
-        # do so by using an older timestamp. However, that makes the client tests
-        # racy, because if a bunch of nmcli instances run in parallel against this
-        # service, earlier instances will issue a RequestScan(), while later instances
-        # won't do that (because the LastScan timestamp is already updated). That means,
-        # the later instances will print the scan result immediately, and in another sort
-        # order. That should be fixed, by nmcli not starting to print anything, before
-        # all RequestScan() requests complete, and thus, always print a consistent list
-        # of results.
-        ts = NM.utils_get_timestamp_msec()
+        # Use a randomly older timestamp to trigger RequestScan() from the client
+        ts = max(0, NM.utils_get_timestamp_msec() - Util.random_int(self.path, 20000, 40000))
 
         props = {
             PRP_WIFI_HW_ADDRESS:            mac,
@@ -1349,9 +1341,14 @@ class NetworkManager(ExportedObj):
 
     @dbus.service.method(dbus_interface=IFACE_NM, in_signature='a{sa{sv}}oo', out_signature='oo')
     def AddAndActivateConnection(self, con_hash, devpath, specific_object):
+        conpath, acpath, result = self.AddAndActivateConnection2(con_hash, devpath, specific_object, dict())
+        return (conpath, acpath)
+
+    @dbus.service.method(dbus_interface=IFACE_NM, in_signature='a{sa{sv}}ooa{sv}', out_signature='ooa{sv}')
+    def AddAndActivateConnection2(self, con_hash, devpath, specific_object, options):
         device = self.find_device_first(path = devpath, require = BusErr.UnknownDeviceException)
         conpath = gl.settings.AddConnection(con_hash)
-        return (conpath, self.ActivateConnection(conpath, devpath, specific_object))
+        return (conpath, self.ActivateConnection(conpath, devpath, specific_object), [])
 
     @dbus.service.method(dbus_interface=IFACE_NM, in_signature='o', out_signature='')
     def DeactivateConnection(self, active_connection):