mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-02-27 12:42:10 +01:00
gtestutils: move "/subprocess" path special-casing
https://bugzilla.gnome.org/show_bug.cgi?id=754284
This commit is contained in:
parent
91ff2ba844
commit
51c91ed53d
@ -2076,28 +2076,6 @@ test_case_run (GTestCase *tc)
|
|||||||
old_free_list = test_filename_free_list;
|
old_free_list = test_filename_free_list;
|
||||||
test_filename_free_list = &filename_free_list;
|
test_filename_free_list = &filename_free_list;
|
||||||
|
|
||||||
if (strstr (test_run_name, "/subprocess"))
|
|
||||||
{
|
|
||||||
GSList *iter;
|
|
||||||
gboolean found = FALSE;
|
|
||||||
|
|
||||||
for (iter = test_paths; iter; iter = iter->next)
|
|
||||||
{
|
|
||||||
if (!strcmp (test_run_name, iter->data))
|
|
||||||
{
|
|
||||||
found = TRUE;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!found)
|
|
||||||
{
|
|
||||||
if (g_test_verbose ())
|
|
||||||
g_print ("GTest: skipping: %s\n", test_run_name);
|
|
||||||
goto out;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (++test_run_count <= test_startup_skip_count)
|
if (++test_run_count <= test_startup_skip_count)
|
||||||
g_test_log (G_TEST_LOG_SKIP_CASE, test_run_name, NULL, 0, NULL);
|
g_test_log (G_TEST_LOG_SKIP_CASE, test_run_name, NULL, 0, NULL);
|
||||||
else if (test_run_list)
|
else if (test_run_list)
|
||||||
@ -2144,7 +2122,6 @@ test_case_run (GTestCase *tc)
|
|||||||
g_timer_destroy (test_run_timer);
|
g_timer_destroy (test_run_timer);
|
||||||
}
|
}
|
||||||
|
|
||||||
out:
|
|
||||||
g_slist_free_full (filename_free_list, g_free);
|
g_slist_free_full (filename_free_list, g_free);
|
||||||
test_filename_free_list = old_free_list;
|
test_filename_free_list = old_free_list;
|
||||||
g_free (test_uri_base);
|
g_free (test_uri_base);
|
||||||
@ -2165,6 +2142,23 @@ path_has_prefix (const char *path,
|
|||||||
path[prefix_len] == '/'));
|
path[prefix_len] == '/'));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static gboolean
|
||||||
|
test_should_run (const char *test_path,
|
||||||
|
const char *cmp_path)
|
||||||
|
{
|
||||||
|
if (strstr (test_run_name, "/subprocess"))
|
||||||
|
{
|
||||||
|
if (g_strcmp0 (test_path, cmp_path) == 0)
|
||||||
|
return TRUE;
|
||||||
|
|
||||||
|
if (g_test_verbose ())
|
||||||
|
g_print ("GTest: skipping: %s\n", test_run_name);
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
return !cmp_path || path_has_prefix (test_path, cmp_path);
|
||||||
|
}
|
||||||
|
|
||||||
/* Recurse through @suite, running tests matching @path (or all tests
|
/* Recurse through @suite, running tests matching @path (or all tests
|
||||||
* if @path is %NULL).
|
* if @path is %NULL).
|
||||||
*/
|
*/
|
||||||
@ -2185,7 +2179,7 @@ g_test_run_suite_internal (GTestSuite *suite,
|
|||||||
GTestCase *tc = iter->data;
|
GTestCase *tc = iter->data;
|
||||||
|
|
||||||
test_run_name = g_build_path ("/", old_name, tc->name, NULL);
|
test_run_name = g_build_path ("/", old_name, tc->name, NULL);
|
||||||
if (!path || path_has_prefix (test_run_name, path))
|
if (test_should_run (test_run_name, path))
|
||||||
{
|
{
|
||||||
if (!test_case_run (tc))
|
if (!test_case_run (tc))
|
||||||
n_bad++;
|
n_bad++;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user