From 51368227f2e44ef33fbcb02e270d58ba52010266 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jonas=20=C3=85dahl?= Date: Mon, 17 May 2021 12:12:49 +0200 Subject: [PATCH] context/test: Add flag to test runner helper This will later be used to allow skipping tests. Part-of: --- src/tests/headless-start-test.c | 3 ++- src/tests/meta-context-test.c | 3 ++- src/tests/meta-test/meta-context-test.h | 8 +++++++- src/tests/native-headless.c | 3 ++- src/tests/ref-test-sanity.c | 3 ++- src/tests/stage-view-tests.c | 3 ++- src/tests/test-runner.c | 3 ++- src/tests/unit-tests.c | 3 ++- src/tests/wayland-unit-tests.c | 3 ++- 9 files changed, 23 insertions(+), 9 deletions(-) diff --git a/src/tests/headless-start-test.c b/src/tests/headless-start-test.c index 85f1b8ee2..4ddabf7f9 100644 --- a/src/tests/headless-start-test.c +++ b/src/tests/headless-start-test.c @@ -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); } diff --git a/src/tests/meta-context-test.c b/src/tests/meta-context-test.c index 08acdcb73..95a40de25 100644 --- a/src/tests/meta-context-test.c +++ b/src/tests/meta-context-test.c @@ -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; diff --git a/src/tests/meta-test/meta-context-test.h b/src/tests/meta-test/meta-context-test.h index b1f678030..70ce66956 100644 --- a/src/tests/meta-test/meta-context-test.h +++ b/src/tests/meta-test/meta-context-test.h @@ -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); diff --git a/src/tests/native-headless.c b/src/tests/native-headless.c index 6680ba7b9..0c94255e8 100644 --- a/src/tests/native-headless.c +++ b/src/tests/native-headless.c @@ -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); } diff --git a/src/tests/ref-test-sanity.c b/src/tests/ref-test-sanity.c index 0a9472b13..d9dd32c6c 100644 --- a/src/tests/ref-test-sanity.c +++ b/src/tests/ref-test-sanity.c @@ -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); } diff --git a/src/tests/stage-view-tests.c b/src/tests/stage-view-tests.c index 198b6cd49..008b8557c 100644 --- a/src/tests/stage-view-tests.c +++ b/src/tests/stage-view-tests.c @@ -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); } diff --git a/src/tests/test-runner.c b/src/tests/test-runner.c index edaf84f81..6a2e5a292 100644 --- a/src/tests/test-runner.c +++ b/src/tests/test-runner.c @@ -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); } diff --git a/src/tests/unit-tests.c b/src/tests/unit-tests.c index dfad2bdc7..66448a213 100644 --- a/src/tests/unit-tests.c +++ b/src/tests/unit-tests.c @@ -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); } diff --git a/src/tests/wayland-unit-tests.c b/src/tests/wayland-unit-tests.c index 87fb5d4c8..1202d2fcf 100644 --- a/src/tests/wayland-unit-tests.c +++ b/src/tests/wayland-unit-tests.c @@ -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); }