Commit graph

79 commits

Author SHA1 Message Date
Thomas Haller f9b6042441 build: merge "tools/Makefile.am" into toplevel Makefile 2016-10-19 17:16:08 +02:00
Thomas Haller 7aefbcb622 build: merge "libnm/tests/Makefile.am" into toplevel Makefile 2016-10-19 17:16:08 +02:00
Thomas Haller cd98705d21 tests: combine "run-test-valgrind.sh" and "run-test-dbus-session.sh" in "run-nm-test.sh"
No need to have two test-runners. Combine them, and call tests always
via "tools/run-nm-test.sh".

Yes, this brings an overhead, that we now always invoke the test with
a test wrapper script, also --without-vagrind. Previously, that was only
necessary for libnm tests that require their own D-Bus session.

Later we will do non-recursive Makefiles, thus all tests should have the
same LOG_COMPILER.
2016-10-19 15:26:30 +02:00
Thomas Haller a54a3e8263 tools/trivial: replace tabs from "tools/run-test-valgrind.sh" script 2016-10-19 15:26:30 +02:00
Thomas Haller c94dac0b5d tools: fix starting tests with D-Bus session with NMTST_NO_VALGRIND=1
When running

  NMTST_NO_VALGRIND=1 make check -j

we would not start separate D-Bus sessions, thus running tests with
valgrind enabled failed.
2016-10-19 15:26:30 +02:00
Thomas Haller 34f3563add tools: dist "tools/create-exports-NetworkManager.sh"
It's also used by contrib/rpm's SPEC file.
2016-10-17 16:21:08 +02:00
Thomas Haller b171fbc9ca build: explicitly whitelist symbols in NetworkManager binary
- this allows the linker to drop unused symbols via link-time optimization
  or with --gc-sections:

    git clean -fdx
    ./autogen.sh --enable-ld-gc --enable-ifcfg-rh --enable-ifupdown \
        --enable-ifnet --enable-ibft --enable-teamdctl --enable-wifi \
        --with-modem-manager-1 --with-ofono --with-more-asserts \
        --with-more-logging
    make -j20
    strip ./src/NetworkManager

  gives 2822840 vs. 2625960 bytes (-7%).

- this also gives more control over the symbols that are used by the
  plugins. Yes, it means if you modify a plugin to use a new symbols,
  you have to extend NetworkManager.ver file.
  You can run the script to create the version file:

    $ ./tools/create-exports-NetworkManager.sh update

  but be sure that your current configuration enables all plugins
  and debugging options to actually use all symbols that are in use.

- If you compile with certain plugins enabled, you could theoretically
  re-compile NetworkManager to expose less symbols. Try:

    $ ./tools/create-exports-NetworkManager.sh build

- note that we have `make check` tests to ensure that all used
  symbols of the plugins can be found. So, it should not be possible
  to accidentally forget to expose a symbol.
2016-10-13 21:33:33 +02:00
Thomas Haller 1d0e0eeffd manager: add Reload() D-Bus command
Add new Reload D-Bus command to reload NetworkManager configuration.

For now, this is like sending SIGHUP to the process. There are several
advantages here:

  - it is guarded via PolicyKit authentication while signals
    can only be sent by root.

  - the user can wait for the reload to be complete instead of sending
    an asynchronous signal. For now, we operation completes after
    nm_config_reload() returns, but later we could delay the response
    further until specific parts are fully reloaded.

  - SIGHUP reloads everything including re-reading configuration from
    disk while SIGUSR1 reloads just certain parts such as writing out DNS
    configuration anew.
    Now, the Reload command has a flags argument which is more granular
    in selecting parts which are to be reloaded. For example, via
    signals the user can:

      1) send SIGUSR1: this writes out the DNS configuration to
         resolv.conf and possibly reloads other parts without
         re-reading configuration and without restarting the DNS plugin.
      2) send SIGHUP: this reloads configuration from disk,
         writes out resolv.conf and restarts the DNS plugin.

    There is no way, to only restart the DNS plugin without also reloading
    everything else.
2016-06-01 19:06:34 +02:00
Thomas Haller 8913585397 libnm: implement missing NM_AUTH_PERMISSION_SETTINGS_MODIFY_GLOBAL_DNS 2016-06-01 19:06:34 +02:00
Lubomir Rintel 8280ab69f1 tools: add forgotten file to dist
Fixes: f15c412015
2016-04-23 20:08:01 +02:00
Lubomir Rintel db6ebe003d docs: include the D-Bus enums reference with the API documentation
Otherwise the types links would be dangling or resolved to slightly
irrelevant documentation in libnm or completely irrelevant documentation
in libnm-util.
2016-04-22 10:02:37 +02:00
Lubomir Rintel 3a2803b42c docs: replace spec.html with docbook D-Bus API reference
May use a lot of improvement (actually documenting the names and
objects that use the interfaces in question), but at least this looks a
lot better on developer.gnome.org.
2016-03-26 11:28:19 +01:00
Jan Tojnar 226ef19109 tests: fix test-networkmanager-service.py for Python 3 incompatibility
https://bugzilla.gnome.org/show_bug.cgi?id=763544
2016-03-13 18:30:05 +01:00
Thomas Haller c7b3862503 platform: add network namespace support to platform
Add a new NMPNetns class. This allows creation, deletion and
switching of network namespaces. The API only offers push/pop
operations to switch the namespace. This way the API enforces
the user to always restore the previous namespace.

A NMPlatform instance not only uses the netlink socket, but also
sysfs, udev, ethtool, mii. Still, a NMPlatform instance lives
entirely inside one namespace and is not spanning multiple namespaces.
To properly support network namespaces, the platform instance must
switch the namespace as necessary, transparent to the caller.
Udev is only supported in the main namespace.

For now, network namespaces are not actually used and are disabled
via the NM_PLATFORM_NETNS_SUPPORT argument.

https://bugzilla.gnome.org/show_bug.cgi?id=762408
2016-03-07 12:28:13 +01:00
Michael Biebl 0518489b39 tests: fix bashism in run-test-dbus-session.sh
https://bugzilla.gnome.org/show_bug.cgi?id=762940
2016-03-03 13:45:50 +01:00
Thomas Haller f74a9000b1 tests: use dbus-run-session for tools/run-test-valgrind.sh 2016-01-22 16:54:32 +01:00
Thomas Haller fb1da0eab2 tests: allow fallback to dbus-launch in case dbus-run-session is not available
Like on Ubuntu 12.04 which is currently used by our Travic CI setup.
2016-01-22 16:52:42 +01:00
Thomas Haller 5170d3a760 tests: move common dbus test-runners to tools/ directory 2016-01-22 16:52:41 +01:00
Thomas Haller 8859cd0738 libnm/tests: extend handling connections in python test service 2015-12-26 16:43:49 +01:00
Thomas Haller ce238a7074 tests/valgrind: rename name of logfile for valgrind run
Change the name of the file where to store the results
of the valgrind run.

Previously the file had a prefix "valgrind-", which is inconvinient.
Instead, have the file using the same name as the test executable,
with a ".valgrind-log" suffix.
2015-12-05 20:35:16 +01:00
Dan Williams 4db851f852 libnm/libnm-glib: add NMClient.get_all_devices() method and AllDevices property
Mirror new NetworkManager API to return both real devices and
device placeholders.
2015-12-04 12:16:41 +01:00
Thomas Haller e84587183b test: some refactoring of test-networkmanager-service.py 2015-12-04 12:16:41 +01:00
Thomas Haller 4dacf0b1ad nmtst/valgrind: allow calling 'run-test-valgrind.sh' script directly
When you want to run valgrind for a test, you either had to
invoke valgrind manually, or doing it via `make check` (provided
you configured --with-valgrind).

Make it more convenient to run valgrind by passing the test
to run to the "run-test-valgrind.sh" wrapper.

This also allows to pass -p/-s to the test, which is not possible
during `make check` because selecting tests conflicts with "--tap".
The following invocations are largely equivalent and work as
expected:

  $ ./tools/run-test-valgrind.sh ./src/platform/tests/test-link-linux -p /link/software/detect/vlan

  $ NMTST_DEBUG=no-debug,p=/link/software/detect/vlan ./tools/run-test-valgrind.sh ./src/platform/tests/test-link-linux
2015-11-24 11:02:55 +01:00
Jiří Klimeš 82e4364480 tests: add a test for connection_compatible() for wired devices
Allow setting MAC address and S390 subchannels for ethernet devices in
testing NM service.
2015-09-29 09:31:41 +02:00
Quentin Glidic 2a4a222d95 tools/check-exports.sh: use ${NM} when available
This way you can export NM to use a prefixed tool

https://bugzilla.gnome.org/show_bug.cgi?id=755540

Signed-off-by: Quentin Glidic <sardemff7+git@sardemff7.net>
2015-09-24 16:28:15 +02:00
Dan Winship 64ff214bb8 macros: add NM_BACKPORT_SYMBOL()
Add a macro to insert the necessary compiler/linker magic to add a
copy of an existing symbol to an older version. Also, update
check-exports.sh to be able to check for such symbols by listed them
commented-out in the appropriate section.

[thaller@redhat.com: patch modified]

Related: https://bugzilla.gnome.org/show_bug.cgi?id=742993
2015-06-26 16:28:33 +02:00
Thomas Haller 2a5d17eb5f valgrind: rework run-test-valgrind.sh script not to print unrelated message
If the valgrind logfile is empty, don't log an error message with
the location of the logfile.

Also, if the test didn't fail due to memleaks, log a different message.
2015-06-04 17:48:34 +02:00
Lubomir Rintel df0676ab00 tests: delete the valgrind logs if they're empty 2015-06-04 14:29:10 +02:00
Lubomir Rintel d909e76d9e tests: don't limit the valgrind tracebacks to 12 frames
The glib tracebacks are typically longer.
2015-06-04 14:29:10 +02:00
Lubomir Rintel b9b7bb1958 tests: avoid calling GLib.IOChannel.unix_new()
The Ubuntu 12.04 introspection data don't contain it. However, the default
constructor works just well and even looks a bit more Python-y.
2015-06-02 12:30:03 +02:00
Thomas Haller ce3d1533cc test: fix running valgrind tests with NMTST_NO_VALGRIND
Fixes: 6463ce5dd9
2015-05-26 15:34:19 +02:00
Lubomir Rintel dd959087a2 tests: be a bit more helpful when valgrind tests fail 2015-05-26 13:51:45 +02:00
Lubomir Rintel 6463ce5dd9 tests: use the TAP formatter
The test results in standard format are easily integrated into CI systems.
2015-05-26 13:51:45 +02:00
Lubomir Rintel d0e25ac8be tests: always spawn private d-bus
Parallel test runs would not be possible without this.
2015-05-26 13:51:44 +02:00
Thomas Haller 95a750e4fa tests: allow running tests without valgrind by setting NMTST_NO_VALGRIND
When configuring with --with-valgrind, tests will be invoked
via valgrind. That significantly slows down the tests. Allow
user to set the environment variable NMTST_NO_VALGRIND to invoke
tests directly, even when valgrind was enabled at configure time.
2015-02-09 15:49:58 +01:00
Thomas Haller cfa4560073 tests: fail valgrind script if log file is non-empty 2015-02-09 12:10:13 +01:00
Thomas Haller e7356ef0a6 libnm/tests: enable valgrind for libnm tests 2015-02-09 12:10:13 +01:00
Thomas Haller 9a2c0451a4 tests: fix valgrind script to handle exit value 77 (skip) 2015-02-06 12:58:42 +01:00
Thomas Haller 954c744bc0 libnm/tests: fix GetAccessPoints() in test-networkmanager-service.py for hidden APs
There was a bug checking for "if a.ssid():". Refactor the whole line to
use a list comprehension.
2015-01-05 14:18:53 +01:00
Thomas Haller 66ced4de56 libnm/tests: cleanup handling object paths in test-networkmanager-service.py 2015-01-05 14:18:53 +01:00
Thomas Haller c569fc23bf libnm/tests: fix handling ByteArray in test-networkmanager-service.py for Python 3
In Python 3, dbus.ByteArray() must be created using a byte string,
while strings obtained via DBUS are unicode strings.

This was wrong in WifiAp.__get_props() which broke the test
test_wifi_ap_added_removed().

    File "/usr/lib/python3.3/site-packages/dbus/service.py", line 707, in _message_cb
      retval = candidate_method(self, *args, **keywords)
    File "./NetworkManager/tools/test-networkmanager-service.py", line 102, in GetAll
      return self._get_dbus_properties(iface)
    File "./NetworkManager/tools/test-networkmanager-service.py", line 96, in _get_dbus_properties
      return self.__dbus_ifaces[iface]()
    File "./NetworkManager/tools/test-networkmanager-service.py", line 315, in __get_props
      props[PP_SSID] = dbus.ByteArray(self.ssid)
    TypeError: string argument without an encoding

https://bugzilla.gnome.org/show_bug.cgi?id=739448
2015-01-05 14:18:47 +01:00
Thomas Haller 4838543053 build: fix check-exports.sh for ppc64 arch
On ppc64, `nm` reports the exported symbols as 'D' instead of 'T'.
This caused `make check` to fail.

  "D" The symbol is in the initialized data section.
  "T" The symbol is in the text (code) section.
2014-12-19 14:53:00 +01:00
Thomas Haller 256662f701 build: adjust tools/check-exports.sh
Now that the version scripts might have different
sections, the previous check-exports.sh script no
longer works.
2014-12-05 11:56:37 +01:00
Thomas Haller 0923769285 test,examples: fix scripts to avoid 'has_key' for Python 3
'has_key' on Dictionaries is removed from Python3 in favor of 'in'.

Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-10-31 16:39:00 +01:00
Dan Winship 3be53899fa libnm-core, settings: move NMSettingsError to nm-errors
Move the definition of NMSettingsError to nm-errors, register it with
D-Bus, and verify in the tests that it maps correctly.

Remove a few unused error codes, simplify a few others, and rename
GENERAL to FAILED and HOSTNAME_INVALID to INVALID_HOSTNAME, for
consistency.
2014-10-22 08:29:09 -04:00
Dan Winship 4f75ff92b4 libnm-core, libnm, devices: merge client and daemon NMDeviceError
Merge libnm's NMDeviceError and the daemon's NMDeviceError into a
single enum (in nm-errors.h). Register the domain with D-Bus, and add
a test that the client side decodes it correctly.

The daemon's NM_DEVICE_ERROR_CONNECTION_INVALID gets absorbed into
libnm's NM_DEVICE_ERROR_INVALID_CONNECTION, and
NM_DEVICE_ERROR_UNSUPPORTED_DEVICE_TYPE gets dropped, since it was
only returned from one place, which is now using
NM_DEVICE_ERROR_FAILED, since (a) it ought to be a "can't happen", and
(b) the only caller of that function just logs error->message and then
frees the error without ever looking at the code.
2014-10-22 08:29:08 -04:00
Dan Winship 9c67b6fb08 libnm-core, core: register NMConnectionError with D-Bus
Register NMConnectionError with D-Bus on both sides, so that, eg,
connection validation failures in the daemon will translate to the
correct error codes in the client.
2014-10-22 08:29:08 -04:00
Dan Winship be8060f42f libnm: add an object-creation-failed test 2014-10-19 09:27:48 -04:00
Dan Winship ba900f2a44 tools: add a bit of support for VLANs to test-networkmanager-service.py 2014-10-19 09:27:48 -04:00
Dan Winship b9c09a2b0d tools: add a bit more activation support to test-networkmanager-service.py
Now test-networkmanager-service.py can create ActiveConnections, though
they don't actually finish activating.
2014-10-19 09:27:47 -04:00