mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager
synced 2024-10-06 16:21:50 +00:00
test: fix parsing of command line arguments for setting nmtst_test_quick()
glib interprets the options either as "-m arg" or "-m=arg". Fix parsing
to check for both cases.
Also, g_test_init() removes the parsed options from argv, hence we must
check our original copy in __nmtst_internal.orig_argv.
Now the following all have the same outcome:
$ NMTST_DEBUG=no-debug,quick ./src/rdisc/tests/test-rdisc-fake
$ ./src/rdisc/tests/test-rdisc-fake -m quick
$ ./src/rdisc/tests/test-rdisc-fake -m=quick
Fixes: a2edd6445f
This commit is contained in:
parent
e52dac9887
commit
f529fedd17
|
@ -328,20 +328,21 @@ __nmtst_init (int *argc, char ***argv, gboolean assert_logging, const char *log_
|
|||
g_free (nmtst_debug_copy);
|
||||
}
|
||||
|
||||
if (argv && *argv) {
|
||||
char **a = *argv;
|
||||
if (__nmtst_internal.orig_argv) {
|
||||
char **a = __nmtst_internal.orig_argv;
|
||||
|
||||
for (; *a; a++) {
|
||||
if (!g_ascii_strcasecmp (*a, "--debug"))
|
||||
is_debug = TRUE;
|
||||
else if (!g_ascii_strcasecmp (*a, "--no-debug"))
|
||||
is_debug = FALSE;
|
||||
else if ( !strcmp (*a, "-mslow")
|
||||
|| !strcmp (*a, "-m=slow")
|
||||
|| !strcmp (*a, "-mthorough")
|
||||
else if ( !strcmp (*a, "-m=slow")
|
||||
|| !strcmp (*a, "-m=thorough")
|
||||
|| !strcmp (*a, "-mquick")
|
||||
|| !strcmp (*a, "-m=quick"))
|
||||
|| !strcmp (*a, "-m=quick")
|
||||
|| (!strcmp (*a, "-m") && *(a+1)
|
||||
&& ( !strcmp (*(a+1), "quick")
|
||||
|| !strcmp (*(a+1), "slow")
|
||||
|| !strcmp (*(a+1), "thorough"))))
|
||||
test_quick_argv = TRUE;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue