Commit Graph

95 Commits

Author SHA1 Message Date
Thomas Haller
7b78a931df build: generate src/NetworkManager.ver during build
This adds 0.4 seconds to the build time.

You can disable it by setting $NM_BUILD_NO_CREATE_EXPORTS environment
variable. This is useful in the unexpected case that the script
is broken.
Or, if you just want to use a different, non-generated version-script.
Or, if you want to save 0.4 seconds build-time.
2016-11-10 18:30:38 +01:00
Thomas Haller
aa3e44984a build: don't change directory in tools/create-exports-NetworkManager.sh
We shall call it from the makefile, thus the current directory is
$(top_builddir), which is just what we need.
2016-11-10 18:30:38 +01:00
Thomas Haller
f71d1dfffb build: improve tools/create-exports-NetworkManager.sh script
- include symbols from the "B" section.
- improve the script, to use libNetworkManager.a instead
  of the NetworkManager binary. The former is before stripping
  symbols.
2016-11-10 18:30:38 +01:00
Lubomir Rintel
7803f6b7fa libnm/tests: add restart method to the manager mock test support interface 2016-11-10 16:48:48 +01:00
Lubomir Rintel
70548dabe6 libnm/tests: add object manager mock 2016-11-10 16:48:48 +01:00
Lubomir Rintel
ab0e0ed117 libnm/tests: turn all mock objects into ExportedObjs
This way they will all be able to register with the ObjectManager mock.
2016-11-10 16:48:48 +01:00
Lubomir Rintel
3f451a2394 libnm/tests: only init the exported obj when the interfaces are in place
When we have the ObjectManager mock, this allows it to emit correct
InterfacesAdded signal when the ExportedObj is initialized.
2016-11-10 16:48:48 +01:00
Lubomir Rintel
24afcb502e libnm/tests: correct vlan id type in vlan device mock 2016-11-10 16:48:47 +01:00
Lubomir Rintel
402ba09269 libnm/tests: notify of changing active-connections in manager mock 2016-11-10 16:48:47 +01:00
Lubomir Rintel
f234279c94 libnm/tests: emit standard properties changed signals from mock objects 2016-11-10 16:48:47 +01:00
Thomas Haller
b058c45d28 tests: fix run-nm-test.sh to use valgrind when --called-from-make
Fixes: dbafd2ce50
2016-11-10 10:06:40 +01:00
Lubomir Rintel
1cc4ff3716 tools: fix the create-exports script on 32-bit 2016-11-06 15:36:24 +01:00
Thomas Haller
354fc51bc6 tools: improve handling arguments to run-nm-test.sh
- add _is_true function so that user can set argument
  environment variables to yes|y|1 etc.

- fix NMTST_CHANGE_DIRECTORY
2016-11-01 18:51:30 +01:00
Thomas Haller
a412ee419b tools: improve --make-first option of test runner to handle relative test paths
With --make-first|-m we first call `make` on the test.
However, the make path must be a relative path rooted
in the top directory.

Make sure we `cd` into the parent directory first and pass
the proper make path.

  cd src
  ../tools/run-nm-test.sh -m settings/plugins/ifcfg-rh/tests/test-ifcfg-rh
2016-11-01 18:29:42 +01:00
Thomas Haller
d35a6fe524 tools: add option to test runner to build test before running it
./tools/run-nm-test.sh -m src/settings/plugins/ifcfg-rh/tests/test-ifcfg-rh
2016-11-01 16:51:43 +01:00
Thomas Haller
dbafd2ce50 tools: improve controlling whether to run run-nm-test.sh with valgrind
Use new environment variable NMTST_USE_VALGRIND. It works both
from `make check` and during explicit invocation of the test
runner.
2016-11-01 16:46:40 +01:00
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: f15c412015647b378a187bdf98ccf8cd75eb0475
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