mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2026-01-06 19:00:16 +01:00
platform: share main function among tests
This commit is contained in:
parent
24dee51bce
commit
35dd05cc43
5 changed files with 33 additions and 64 deletions
|
|
@ -218,22 +218,9 @@ test_ip6_address_external (void)
|
|||
free_signal (address_removed);
|
||||
}
|
||||
|
||||
int
|
||||
main (int argc, char **argv)
|
||||
void
|
||||
setup_tests (void)
|
||||
{
|
||||
int result;
|
||||
|
||||
openlog (G_LOG_DOMAIN, LOG_CONS | LOG_PERROR, LOG_DAEMON);
|
||||
g_type_init ();
|
||||
g_test_init (&argc, &argv, NULL);
|
||||
/* Enable debug messages if called with --debug */
|
||||
for (; *argv; argv++)
|
||||
if (!g_strcmp0 (*argv, "--debug"))
|
||||
nm_logging_setup ("debug", NULL, NULL);
|
||||
|
||||
SETUP ();
|
||||
|
||||
/* Clean up */
|
||||
nm_platform_link_delete_by_name (DEVICE_NAME);
|
||||
g_assert (!nm_platform_link_exists (DEVICE_NAME));
|
||||
nm_platform_dummy_add (DEVICE_NAME);
|
||||
|
|
@ -245,10 +232,4 @@ main (int argc, char **argv)
|
|||
g_test_add_func ("/address/external/ip4", test_ip4_address_external);
|
||||
g_test_add_func ("/address/external/ip6", test_ip6_address_external);
|
||||
}
|
||||
|
||||
result = g_test_run ();
|
||||
|
||||
nm_platform_link_delete_by_name (DEVICE_NAME);
|
||||
nm_platform_free ();
|
||||
return result;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -59,3 +59,27 @@ run_command (const char *format, ...)
|
|||
g_free (command);
|
||||
}
|
||||
|
||||
int
|
||||
main (int argc, char **argv)
|
||||
{
|
||||
int result;
|
||||
|
||||
openlog (G_LOG_DOMAIN, LOG_CONS | LOG_PERROR, LOG_DAEMON);
|
||||
g_type_init ();
|
||||
g_test_init (&argc, &argv, NULL);
|
||||
/* Enable debug messages if called with --debug */
|
||||
for (; *argv; argv++) {
|
||||
if (!g_strcmp0 (*argv, "--debug")) {
|
||||
nm_logging_setup ("debug", NULL, NULL);
|
||||
}
|
||||
}
|
||||
|
||||
SETUP ();
|
||||
|
||||
setup_tests ();
|
||||
|
||||
result = g_test_run ();
|
||||
|
||||
nm_platform_free ();
|
||||
return result;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -29,3 +29,6 @@ void wait_signal (SignalData *data);
|
|||
void free_signal (SignalData *data);
|
||||
|
||||
void run_command (const char *format, ...);
|
||||
|
||||
void setup_tests (void);
|
||||
|
||||
|
|
|
|||
|
|
@ -561,24 +561,9 @@ test_external (void)
|
|||
free_signal (link_removed);
|
||||
}
|
||||
|
||||
int
|
||||
main (int argc, char **argv)
|
||||
void
|
||||
setup_tests (void)
|
||||
{
|
||||
int result;
|
||||
|
||||
openlog (G_LOG_DOMAIN, LOG_CONS | LOG_PERROR, LOG_DAEMON);
|
||||
g_type_init ();
|
||||
g_test_init (&argc, &argv, NULL);
|
||||
/* Enable debug messages if called with --debug */
|
||||
for (; *argv; argv++) {
|
||||
if (!g_strcmp0 (*argv, "--debug")) {
|
||||
nm_logging_setup ("debug", NULL, NULL);
|
||||
}
|
||||
}
|
||||
|
||||
SETUP ();
|
||||
|
||||
/* Clean up */
|
||||
nm_platform_link_delete_by_name (DEVICE_NAME);
|
||||
nm_platform_link_delete_by_name (SLAVE_NAME);
|
||||
nm_platform_link_delete_by_name (PARENT_NAME);
|
||||
|
|
@ -596,9 +581,4 @@ main (int argc, char **argv)
|
|||
|
||||
if (strcmp (g_type_name (G_TYPE_FROM_INSTANCE (nm_platform_get ())), "NMFakePlatform"))
|
||||
g_test_add_func ("/link/external", test_external);
|
||||
|
||||
result = g_test_run ();
|
||||
|
||||
nm_platform_free ();
|
||||
return result;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -196,22 +196,9 @@ test_ip6_route ()
|
|||
free_signal (route_removed);
|
||||
}
|
||||
|
||||
int
|
||||
main (int argc, char **argv)
|
||||
void
|
||||
setup_tests (void)
|
||||
{
|
||||
int result;
|
||||
|
||||
openlog (G_LOG_DOMAIN, LOG_CONS | LOG_PERROR, LOG_DAEMON);
|
||||
g_type_init ();
|
||||
g_test_init (&argc, &argv, NULL);
|
||||
/* Enable debug messages if called with --debug */
|
||||
for (; *argv; argv++)
|
||||
if (!g_strcmp0 (*argv, "--debug"))
|
||||
nm_logging_setup ("debug", NULL, NULL);
|
||||
|
||||
SETUP ();
|
||||
|
||||
/* Clean up */
|
||||
nm_platform_link_delete_by_name (DEVICE_NAME);
|
||||
g_assert (!nm_platform_link_exists (DEVICE_NAME));
|
||||
g_assert (nm_platform_dummy_add (DEVICE_NAME));
|
||||
|
|
@ -219,10 +206,4 @@ main (int argc, char **argv)
|
|||
|
||||
g_test_add_func ("/route/ip4", test_ip4_route);
|
||||
g_test_add_func ("/route/ip6", test_ip6_route);
|
||||
|
||||
result = g_test_run ();
|
||||
|
||||
nm_platform_link_delete_by_name (DEVICE_NAME);
|
||||
nm_platform_free ();
|
||||
return result;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue