Commit graph

64 commits

Author SHA1 Message Date
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
Dan Winship bc003f6273 tools: fix test-networkmanager-service Settings.Connections
The test settings service wasn't exporting a Connections property.
2014-09-18 11:51:07 -04:00
Dan Winship c9fb96e02e libnm: add test-secret-agent
Implement some basic secret agent functionality in
test-networkmanager-service.py, and add test-secret-agent to test that
NMSecretAgent works as expected.
2014-09-09 12:16:38 -04:00
Thomas Haller 2ac34e437f libnm-glib/test: fix test failure for test-remote-settings-client
Due to behavioral change of test-networkmanager-service.py, the test
/remote_settings/remove_connection fails (test_remove_connection() at
test-remote-settings-client.c:318).

Fixes: 66a3480329
Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-08-08 11:39:44 +02:00
Dan Winship 66a3480329 libnm: add a test for connection-deleted-while-being-created
Since NMRemoteSettings doesn't announce new connections until it has
fetched their properties, it's possible that a connection could get
deleted while we're waiting for it to be created. NMRemoteSettings has
code to deal with this, so add a test to make sure that it works.
2014-08-07 15:43:43 -04:00
Dan Winship 08b91199fb libnm-glib: make test-networkmanager-service.py automatically exit with its parent
test-nm-client.c and test-remote-settings-client.c were using their
own assertion macros so they could kill the test service on assertion
failure. Except that some new code didn't get the memo and used the
g_assert* macros. Not to mention that sometimes the tests would crash
outside of an assertion macro.

We can make test-networkmanager-service.py notice that its parent has
crashed by opening a pipe between them and taking advantage of the
fact that the pipe will be automatically closed if the parent crashes.
So then test-networkmanager-service.py just has to watch for that, and
exit if the pipe closes.

Then that lets us drop the test_assert* macros and just use g_assert*
instead.
2014-08-01 12:12:42 -04:00
Dan Winship 5432ef5e52 tools: move libnm-glib's fake NM service implementations here
Move libnm-glib's test-fake-nm.py and test-remote-settings-service.py
to tools/, merge them together into a single program, and fix a few
bugs (notably some missing signal emissions in the Settings service).

Although they are currently only used by libnm-glib's tests, they are
generic enough that they could be used by other code in the future
(and in particular, they will be used by libnm's tests as well).
2014-07-30 15:56:29 -04:00
Dan Winship efb2b13baa tools: move debug-helper.py from test/ to tools/ 2014-07-30 15:56:19 -04:00
Dan Winship 420e027c99 tools: dist everything
Dist run-test-valgrind.sh and test-sudo-wrapper.sh, since they may be
of use to people building from tarballs as well.
2014-07-30 15:56:19 -04:00
Dan Winship 07bb19a3bb tools: remove generate-settings-spec, which is no longer used 2014-06-19 17:45:02 -04:00
Thomas Haller 7a7dd9203d nmtst: add nmtst_reexec_sudo() function
Interpret environment variable NMTST_DEBUG which allows
to specify 'sudo-cmd=CMD'. If the test program calls
nmtst_reexec_sudo(), it will `exec CMD "$0" "$@"`.

Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-06-05 18:12:57 +02:00
Jiří Klimeš 98ae6e06d2 all: g_type_init() has been deprecated in GLib 2.35.0
g_type_init() deprecation:
https://bugzilla.gnome.org/show_bug.cgi?id=686161
2014-05-27 16:58:21 +02:00
Dan Winship 9c4d86ee80 libnm-util, libnm-glib: add versioned deprecation/availability macros
Add versioned NM_DEPRECATED_IN_* and NM_AVAILABLE_IN_* macros, and tag
new/deprecated functions accordingly. (All currently-deprecated
functions are assumed to have been deprecated in 0.9.10.)

Add NM_VERSION_MIN_REQUIRED and NM_VERSION_MAX_ALLOWED macros which
can be set to determine which versions will cause warnings.

With the current settings, external consumers of the
libnm-util/libnm-glib APIs will have MIN_REQUIRED and MAX_ALLOWED both
set to NM_VERSION_0_9_8 by default, meaning they will get warnings
about functions added in 0.9.10. NM internally sets
NM_VERSION_MAX_ALLOWED to NM_VERSION_NEXT_STABLE to ensure that it is
always allowed to use all APIs.
2014-02-13 11:24:37 -05:00
Jiří Klimeš a312aad848 tools: enhance description for the nm-settings manual page 2013-11-28 13:23:53 +01:00
Jiří Klimeš b26656f003 tools: add team, team-port and dcb settings into generate-settings-spec.c 2013-11-28 11:35:52 +01:00
Dan Winship bfce3f7dc8 build: switch from $(INCLUDES) to $(AM_CPPFLAGS) to make automake happy
Unfortunately, $(AM_CPPFLAGS) gets overridden by per-target _CPPFLAGS
variables, which $(INCLUDES) did not, so this requires some additional
changes.

In most places, I have just gotten rid of the per-target _CPPFLAGS
variables; in directories with a single target, the per-target
variable is unnecessary, and in directories with multiple targets, the
per-target variable is often undesirable, since it forces some files
to be compiled twice, even though there ends up being no difference
between the two files.
2013-08-22 11:49:16 -04:00