mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2026-05-07 21:18:09 +02:00
libnm-glib: compile test-networkmanager-service.py path into test binaries
Rather than passing the path to the test service on the command line,
compile it into the test programs.
(Among other things, this makes it easier to run the test directly
from the command line.)
(cherry picked from commit 4f7e9bd336)
This commit is contained in:
parent
5fe7d375a6
commit
b2e65b2a1f
3 changed files with 12 additions and 25 deletions
|
|
@ -7,6 +7,8 @@ AM_CPPFLAGS = \
|
|||
-I$(top_builddir)/libnm-util \
|
||||
-I$(top_srcdir)/libnm-glib \
|
||||
-DNM_VERSION_MAX_ALLOWED=NM_VERSION_NEXT_STABLE \
|
||||
-DTEST_NM_BIN=\"$(abs_srcdir)/test-fake-nm.py\" \
|
||||
-DTEST_RSS_BIN=\"$(abs_srcdir)/test-remote-settings-service.py\" \
|
||||
$(GLIB_CFLAGS) \
|
||||
$(DBUS_CFLAGS)
|
||||
|
||||
|
|
@ -36,18 +38,15 @@ test_remote_settings_client_LDADD = \
|
|||
|
||||
###########################################
|
||||
|
||||
TEST_NM_BIN = test-fake-nm.py
|
||||
TEST_RSS_BIN = test-remote-settings-service.py
|
||||
|
||||
EXTRA_DIST = $(TEST_RSS_BIN) $(TEST_NM_BIN)
|
||||
EXTRA_DIST = test-fake-nm.py test-remote-settings-service.py
|
||||
|
||||
check-local: test-nm-client test-remote-settings-client
|
||||
if test -z "$$DBUS_SESSION_BUS_ADDRESS" ; then \
|
||||
dbus-launch --exit-with-session $(abs_builddir)/test-nm-client $(abs_srcdir) $(TEST_NM_BIN); \
|
||||
dbus-launch --exit-with-session $(abs_builddir)/test-remote-settings-client $(abs_srcdir) $(TEST_RSS_BIN); \
|
||||
dbus-launch --exit-with-session $(abs_builddir)/test-nm-client; \
|
||||
dbus-launch --exit-with-session $(abs_builddir)/test-remote-settings-client; \
|
||||
else \
|
||||
$(abs_builddir)/test-nm-client $(abs_srcdir) $(TEST_NM_BIN); \
|
||||
$(abs_builddir)/test-remote-settings-client $(abs_srcdir) $(TEST_RSS_BIN); \
|
||||
$(abs_builddir)/test-nm-client; \
|
||||
$(abs_builddir)/test-remote-settings-client; \
|
||||
fi;
|
||||
|
||||
endif
|
||||
|
|
|
|||
|
|
@ -33,9 +33,6 @@
|
|||
#include "nm-device-wimax.h"
|
||||
#include "nm-glib-compat.h"
|
||||
|
||||
static const char *fake_path;
|
||||
static const char *fake_bin;
|
||||
static const char *fake_exec;
|
||||
static GMainLoop *loop = NULL;
|
||||
|
||||
/*******************************************************************/
|
||||
|
|
@ -129,7 +126,7 @@ service_init (void)
|
|||
{
|
||||
DBusGConnection *bus;
|
||||
ServiceInfo *sinfo;
|
||||
const char *args[2] = { fake_exec, NULL };
|
||||
const char *args[2] = { TEST_NM_BIN, NULL };
|
||||
GError *error = NULL;
|
||||
int i = 100;
|
||||
|
||||
|
|
@ -142,7 +139,7 @@ service_init (void)
|
|||
sinfo->bus = g_bus_get_sync (G_BUS_TYPE_SESSION, NULL, NULL);
|
||||
test_assert (sinfo->bus);
|
||||
|
||||
if (!g_spawn_async (fake_path, (char **) args, NULL, 0, NULL, NULL, &sinfo->pid, &error))
|
||||
if (!g_spawn_async (NULL, (char **) args, NULL, 0, NULL, NULL, &sinfo->pid, &error))
|
||||
test_assert_no_error (error);
|
||||
|
||||
/* Wait until the service is registered on the bus */
|
||||
|
|
@ -924,18 +921,12 @@ test_devices_array (void)
|
|||
int
|
||||
main (int argc, char **argv)
|
||||
{
|
||||
g_assert (argc == 3);
|
||||
|
||||
#if !GLIB_CHECK_VERSION (2, 35, 0)
|
||||
g_type_init ();
|
||||
#endif
|
||||
|
||||
g_test_init (&argc, &argv, NULL);
|
||||
|
||||
fake_path = argv[1];
|
||||
fake_bin = argv[2];
|
||||
fake_exec = g_strdup_printf ("%s/%s", argv[1], argv[2]);
|
||||
|
||||
loop = g_main_loop_new (NULL, FALSE);
|
||||
|
||||
g_test_add_func ("/libnm-glib/device-added", test_device_added);
|
||||
|
|
|
|||
|
|
@ -358,13 +358,11 @@ test_remove_connection (void)
|
|||
int
|
||||
main (int argc, char **argv)
|
||||
{
|
||||
char *service_argv[3] = { NULL, NULL, NULL };
|
||||
char *service_argv[2] = { TEST_RSS_BIN, NULL };
|
||||
int ret;
|
||||
GError *error = NULL;
|
||||
int i = 100;
|
||||
|
||||
g_assert (argc == 3);
|
||||
|
||||
#if !GLIB_CHECK_VERSION (2, 35, 0)
|
||||
g_type_init ();
|
||||
#endif
|
||||
|
|
@ -377,9 +375,8 @@ main (int argc, char **argv)
|
|||
g_assert (error == NULL);
|
||||
}
|
||||
|
||||
service_argv[0] = g_strdup_printf ("%s/%s", argv[1], argv[2]);
|
||||
if (!g_spawn_async (argv[1], service_argv, NULL, 0, NULL, NULL, &spid, &error)) {
|
||||
g_warning ("Error spawning %s: %s", argv[2], error->message);
|
||||
if (!g_spawn_async (NULL, service_argv, NULL, 0, NULL, NULL, &spid, &error)) {
|
||||
g_warning ("Error spawning %s: %s", TEST_RSS_BIN, error->message);
|
||||
g_assert (error == NULL);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue