context/test: Add flag to test runner helper

This will later be used to allow skipping tests.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2151>
This commit is contained in:
Jonas Ådahl 2021-05-17 12:12:49 +02:00 committed by Marge Bot
parent 124a1582e1
commit 51368227f2
9 changed files with 23 additions and 9 deletions

View File

@ -176,5 +176,6 @@ main (int argc, char *argv[])
init_tests ();
return meta_context_test_run_tests (META_CONTEXT_TEST (context));
return meta_context_test_run_tests (META_CONTEXT_TEST (context),
META_TEST_RUN_FLAG_NONE);
}

View File

@ -225,7 +225,8 @@ run_tests_idle (gpointer user_data)
}
int
meta_context_test_run_tests (MetaContextTest *context_test)
meta_context_test_run_tests (MetaContextTest *context_test,
MetaTestRunFlags flags)
{
MetaContext *context = META_CONTEXT (context_test);
g_autoptr (GError) error = NULL;

View File

@ -37,6 +37,11 @@ typedef enum _MetaContextTestFlag
META_CONTEXT_TEST_FLAG_NO_X11 = 1 << 1,
} MetaContextTestFlag;
typedef enum _MetaTestRunFlags
{
META_TEST_RUN_FLAG_NONE = 0,
} MetaTestRunFlags;
#define META_TYPE_CONTEXT_TEST (meta_context_test_get_type ())
META_EXPORT
G_DECLARE_DERIVABLE_TYPE (MetaContextTest, meta_context_test,
@ -48,7 +53,8 @@ MetaContext * meta_create_test_context (MetaContextTestType type,
MetaContextTestFlag flags);
META_EXPORT
int meta_context_test_run_tests (MetaContextTest *context_test);
int meta_context_test_run_tests (MetaContextTest *context_test,
MetaTestRunFlags flags);
META_EXPORT
void meta_context_test_wait_for_x11_display (MetaContextTest *context_test);

View File

@ -43,5 +43,6 @@ main (int argc,
init_tests ();
return meta_context_test_run_tests (META_CONTEXT_TEST (context));
return meta_context_test_run_tests (META_CONTEXT_TEST (context),
META_TEST_RUN_FLAG_NONE);
}

View File

@ -144,5 +144,6 @@ main (int argc,
g_signal_connect (context, "after-tests",
G_CALLBACK (tear_down_test_environment), NULL);
return meta_context_test_run_tests (META_CONTEXT_TEST (context));
return meta_context_test_run_tests (META_CONTEXT_TEST (context),
META_TEST_RUN_FLAG_NONE);
}

View File

@ -1356,5 +1356,6 @@ main (int argc, char *argv[])
init_tests ();
return meta_context_test_run_tests (META_CONTEXT_TEST (context));
return meta_context_test_run_tests (META_CONTEXT_TEST (context),
META_TEST_RUN_FLAG_NONE);
}

View File

@ -1270,5 +1270,6 @@ main (int argc, char **argv)
info.n_tests = tests->len;
g_signal_connect (context, "run-tests", G_CALLBACK (run_tests), &info);
return meta_context_test_run_tests (META_CONTEXT_TEST (context));
return meta_context_test_run_tests (META_CONTEXT_TEST (context),
META_TEST_RUN_FLAG_NONE);
}

View File

@ -255,5 +255,6 @@ main (int argc, char *argv[])
g_signal_connect (context, "after-tests",
G_CALLBACK (finish_monitor_tests), NULL);
return meta_context_test_run_tests (META_CONTEXT_TEST (context));
return meta_context_test_run_tests (META_CONTEXT_TEST (context),
META_TEST_RUN_FLAG_NONE);
}

View File

@ -516,5 +516,6 @@ main (int argc,
g_signal_connect (context, "after-tests",
G_CALLBACK (on_after_tests), NULL);
return meta_context_test_run_tests (META_CONTEXT_TEST (context));
return meta_context_test_run_tests (META_CONTEXT_TEST (context),
META_TEST_RUN_FLAG_NONE);
}