From 343adb2acd8fd27eedf6c4015e7eacce535f3a97 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lo=C3=AFc=20Molinari?= Date: Tue, 20 Feb 2024 21:09:41 +0100 Subject: [PATCH] tests: Speed up runtime using immediate repaint on capture MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The test suite is throttled by the headless backend repaint timer. This commit uses the headless refresh rate option to speed up runtime by using the immediate repaint-only-on-capture mode by default. Tests which don't support that mode yet override the refresh value to use the highest rate possible. Fixes #682 Signed-off-by: Loïc Molinari --- tests/alpha-blending-test.c | 1 + tests/bad-buffer-test.c | 1 + tests/buffer-transforms-test.c | 1 + tests/color-icc-output-test.c | 1 + tests/color-management-test.c | 1 + tests/constraints-test.c | 1 + tests/devices-test.c | 1 + tests/event-test.c | 1 + tests/internal-screenshot-test.c | 1 + tests/keyboard-test.c | 1 + tests/linux-explicit-synchronization-test.c | 1 + tests/output-damage-test.c | 1 + tests/output-transforms-test.c | 1 + tests/paint-node-test.c | 1 + tests/pointer-shot-test.c | 1 + tests/pointer-test.c | 1 + tests/presentation-test.c | 1 + tests/roles-test.c | 1 + tests/single-pixel-buffer-test.c | 1 + tests/subsurface-shot-test.c | 1 + tests/subsurface-test.c | 1 + tests/text-test.c | 1 + tests/touch-test.c | 1 + tests/viewporter-shot-test.c | 1 + tests/viewporter-test.c | 1 + tests/weston-test-fixture-compositor.c | 7 +++++++ tests/weston-test-fixture-compositor.h | 8 ++++++++ tests/yuv-buffer-test.c | 1 + 28 files changed, 41 insertions(+) diff --git a/tests/alpha-blending-test.c b/tests/alpha-blending-test.c index 31880b73..8e9cc67d 100644 --- a/tests/alpha-blending-test.c +++ b/tests/alpha-blending-test.c @@ -71,6 +71,7 @@ fixture_setup(struct weston_test_harness *harness, const struct setup_args *arg) setup.width = BLOCK_WIDTH * ALPHA_STEPS; setup.height = 16; setup.shell = SHELL_TEST_DESKTOP; + setup.refresh = HIGHEST_OUTPUT_REFRESH; if (arg->color_management) { #if !BUILD_COLOR_LCMS diff --git a/tests/bad-buffer-test.c b/tests/bad-buffer-test.c index 6d966d9b..6d7bff6e 100644 --- a/tests/bad-buffer-test.c +++ b/tests/bad-buffer-test.c @@ -43,6 +43,7 @@ fixture_setup(struct weston_test_harness *harness) compositor_setup_defaults(&setup); setup.shell = SHELL_TEST_DESKTOP; + setup.refresh = HIGHEST_OUTPUT_REFRESH; return weston_test_harness_execute_as_client(harness, &setup); } diff --git a/tests/buffer-transforms-test.c b/tests/buffer-transforms-test.c index f7ec51e1..34fa05f8 100644 --- a/tests/buffer-transforms-test.c +++ b/tests/buffer-transforms-test.c @@ -80,6 +80,7 @@ fixture_setup(struct weston_test_harness *harness, const struct setup_args *arg) setup.scale = arg->scale; setup.transform = arg->transform; setup.shell = SHELL_TEST_DESKTOP; + setup.refresh = HIGHEST_OUTPUT_REFRESH; return weston_test_harness_execute_as_client(harness, &setup); } diff --git a/tests/color-icc-output-test.c b/tests/color-icc-output-test.c index 81311ff3..aae852af 100644 --- a/tests/color-icc-output-test.c +++ b/tests/color-icc-output-test.c @@ -234,6 +234,7 @@ fixture_setup(struct weston_test_harness *harness, const struct setup_args *arg) setup.height = WINDOW_HEIGHT; setup.shell = SHELL_TEST_DESKTOP; setup.logging_scopes = "log,color-lcms-profiles,color-lcms-transformations,color-lcms-optimizer"; + setup.refresh = HIGHEST_OUTPUT_REFRESH; file_name = output_filename_for_fixture(THIS_TEST_NAME, harness, arg->meta.name, "icm"); diff --git a/tests/color-management-test.c b/tests/color-management-test.c index 2ac78741..630462e4 100644 --- a/tests/color-management-test.c +++ b/tests/color-management-test.c @@ -640,6 +640,7 @@ fixture_setup(struct weston_test_harness *harness) compositor_setup_defaults(&setup); setup.renderer = WESTON_RENDERER_GL; setup.shell = SHELL_TEST_DESKTOP; + setup.refresh = HIGHEST_OUTPUT_REFRESH; /* Create the sRGB ICC profile. We do that only once for this test * program. */ diff --git a/tests/constraints-test.c b/tests/constraints-test.c index ad6af5c3..e53bbc2b 100644 --- a/tests/constraints-test.c +++ b/tests/constraints-test.c @@ -49,6 +49,7 @@ fixture_setup(struct weston_test_harness *harness) compositor_setup_defaults(&setup); setup.shell = SHELL_TEST_DESKTOP; + setup.refresh = HIGHEST_OUTPUT_REFRESH; return weston_test_harness_execute_as_client(harness, &setup); } diff --git a/tests/devices-test.c b/tests/devices-test.c index a2a70573..311451c2 100644 --- a/tests/devices-test.c +++ b/tests/devices-test.c @@ -37,6 +37,7 @@ fixture_setup(struct weston_test_harness *harness) compositor_setup_defaults(&setup); setup.shell = SHELL_TEST_DESKTOP; + setup.refresh = HIGHEST_OUTPUT_REFRESH; return weston_test_harness_execute_as_client(harness, &setup); } diff --git a/tests/event-test.c b/tests/event-test.c index 2e19f014..37116243 100644 --- a/tests/event-test.c +++ b/tests/event-test.c @@ -36,6 +36,7 @@ fixture_setup(struct weston_test_harness *harness) compositor_setup_defaults(&setup); setup.shell = SHELL_TEST_DESKTOP; + setup.refresh = HIGHEST_OUTPUT_REFRESH; return weston_test_harness_execute_as_client(harness, &setup); } diff --git a/tests/internal-screenshot-test.c b/tests/internal-screenshot-test.c index da63cb53..96236b9b 100644 --- a/tests/internal-screenshot-test.c +++ b/tests/internal-screenshot-test.c @@ -43,6 +43,7 @@ fixture_setup(struct weston_test_harness *harness) setup.width = 320; setup.height = 240; setup.shell = SHELL_DESKTOP; + setup.refresh = HIGHEST_OUTPUT_REFRESH; weston_ini_setup (&setup, cfgln("[shell]"), diff --git a/tests/keyboard-test.c b/tests/keyboard-test.c index 9ccbfd06..0f415a9a 100644 --- a/tests/keyboard-test.c +++ b/tests/keyboard-test.c @@ -39,6 +39,7 @@ fixture_setup(struct weston_test_harness *harness) compositor_setup_defaults(&setup); setup.shell = SHELL_TEST_DESKTOP; + setup.refresh = HIGHEST_OUTPUT_REFRESH; return weston_test_harness_execute_as_client(harness, &setup); } diff --git a/tests/linux-explicit-synchronization-test.c b/tests/linux-explicit-synchronization-test.c index ae3e897d..0798b35d 100644 --- a/tests/linux-explicit-synchronization-test.c +++ b/tests/linux-explicit-synchronization-test.c @@ -41,6 +41,7 @@ fixture_setup(struct weston_test_harness *harness) compositor_setup_defaults(&setup); setup.shell = SHELL_TEST_DESKTOP; + setup.refresh = HIGHEST_OUTPUT_REFRESH; /* We need to use the pixman renderer, since a few of the tests depend * on the renderer holding onto a surface buffer until the next one diff --git a/tests/output-damage-test.c b/tests/output-damage-test.c index b021ea51..e3f5cb0a 100644 --- a/tests/output-damage-test.c +++ b/tests/output-damage-test.c @@ -103,6 +103,7 @@ fixture_setup(struct weston_test_harness *harness, const struct setup_args *arg) setup.scale = arg->scale; setup.transform = arg->transform; setup.shell = SHELL_TEST_DESKTOP; + setup.refresh = HIGHEST_OUTPUT_REFRESH; /* * The test here works by swapping the whole wl_surface into a diff --git a/tests/output-transforms-test.c b/tests/output-transforms-test.c index 006ab35a..9e5fda98 100644 --- a/tests/output-transforms-test.c +++ b/tests/output-transforms-test.c @@ -92,6 +92,7 @@ fixture_setup(struct weston_test_harness *harness, const struct setup_args *arg) setup.scale = arg->scale; setup.transform = arg->transform; setup.shell = SHELL_TEST_DESKTOP; + setup.refresh = HIGHEST_OUTPUT_REFRESH; return weston_test_harness_execute_as_client(harness, &setup); } diff --git a/tests/paint-node-test.c b/tests/paint-node-test.c index cec75a31..2db81cef 100644 --- a/tests/paint-node-test.c +++ b/tests/paint-node-test.c @@ -60,6 +60,7 @@ fixture_setup(struct weston_test_harness *harness, const struct setup_args *arg) setup.height = 240; setup.shell = SHELL_TEST_DESKTOP; setup.logging_scopes = "log,test-harness-plugin"; + setup.refresh = HIGHEST_OUTPUT_REFRESH; return weston_test_harness_execute_as_client(harness, &setup); } diff --git a/tests/pointer-shot-test.c b/tests/pointer-shot-test.c index a78d7ed9..ed3497c4 100644 --- a/tests/pointer-shot-test.c +++ b/tests/pointer-shot-test.c @@ -59,6 +59,7 @@ fixture_setup(struct weston_test_harness *harness, const struct setup_args *arg) setup.width = 320; setup.height = 240; setup.shell = SHELL_TEST_DESKTOP; + setup.refresh = HIGHEST_OUTPUT_REFRESH; return weston_test_harness_execute_as_client(harness, &setup); } diff --git a/tests/pointer-test.c b/tests/pointer-test.c index cd727ac6..79753cfd 100644 --- a/tests/pointer-test.c +++ b/tests/pointer-test.c @@ -40,6 +40,7 @@ fixture_setup(struct weston_test_harness *harness) compositor_setup_defaults(&setup); setup.shell = SHELL_TEST_DESKTOP; + setup.refresh = HIGHEST_OUTPUT_REFRESH; return weston_test_harness_execute_as_client(harness, &setup); } diff --git a/tests/presentation-test.c b/tests/presentation-test.c index a0862d60..3ffedd1f 100644 --- a/tests/presentation-test.c +++ b/tests/presentation-test.c @@ -46,6 +46,7 @@ fixture_setup(struct weston_test_harness *harness) compositor_setup_defaults(&setup); setup.shell = SHELL_TEST_DESKTOP; + setup.refresh = HIGHEST_OUTPUT_REFRESH; return weston_test_harness_execute_as_client(harness, &setup); } diff --git a/tests/roles-test.c b/tests/roles-test.c index d8842884..d687ee22 100644 --- a/tests/roles-test.c +++ b/tests/roles-test.c @@ -42,6 +42,7 @@ fixture_setup(struct weston_test_harness *harness) compositor_setup_defaults(&setup); setup.shell = SHELL_TEST_DESKTOP; setup.logging_scopes = "log,proto,test-harness-plugin"; + setup.refresh = HIGHEST_OUTPUT_REFRESH; return weston_test_harness_execute_as_client(harness, &setup); } diff --git a/tests/single-pixel-buffer-test.c b/tests/single-pixel-buffer-test.c index e7cf1331..b091a174 100644 --- a/tests/single-pixel-buffer-test.c +++ b/tests/single-pixel-buffer-test.c @@ -64,6 +64,7 @@ fixture_setup(struct weston_test_harness *harness, const struct setup_args *arg) setup.height = 240; setup.shell = SHELL_TEST_DESKTOP; setup.logging_scopes = "log,test-harness-plugin"; + setup.refresh = HIGHEST_OUTPUT_REFRESH; return weston_test_harness_execute_as_client(harness, &setup); } diff --git a/tests/subsurface-shot-test.c b/tests/subsurface-shot-test.c index c405304e..e31a3ae2 100644 --- a/tests/subsurface-shot-test.c +++ b/tests/subsurface-shot-test.c @@ -60,6 +60,7 @@ fixture_setup(struct weston_test_harness *harness, const struct setup_args *arg) setup.height = 240; setup.shell = SHELL_TEST_DESKTOP; setup.logging_scopes = "log,test-harness-plugin"; + setup.refresh = HIGHEST_OUTPUT_REFRESH; return weston_test_harness_execute_as_client(harness, &setup); } diff --git a/tests/subsurface-test.c b/tests/subsurface-test.c index edaea9fa..34b95082 100644 --- a/tests/subsurface-test.c +++ b/tests/subsurface-test.c @@ -40,6 +40,7 @@ fixture_setup(struct weston_test_harness *harness) compositor_setup_defaults(&setup); setup.shell = SHELL_TEST_DESKTOP; + setup.refresh = HIGHEST_OUTPUT_REFRESH; return weston_test_harness_execute_as_client(harness, &setup); } diff --git a/tests/text-test.c b/tests/text-test.c index 2f5103b6..d34e77f7 100644 --- a/tests/text-test.c +++ b/tests/text-test.c @@ -40,6 +40,7 @@ fixture_setup(struct weston_test_harness *harness) compositor_setup_defaults(&setup); setup.shell = SHELL_DESKTOP; + setup.refresh = HIGHEST_OUTPUT_REFRESH; return weston_test_harness_execute_as_client(harness, &setup); } diff --git a/tests/touch-test.c b/tests/touch-test.c index d6a4ac40..2cf0b894 100644 --- a/tests/touch-test.c +++ b/tests/touch-test.c @@ -40,6 +40,7 @@ fixture_setup(struct weston_test_harness *harness) compositor_setup_defaults(&setup); setup.shell = SHELL_TEST_DESKTOP; + setup.refresh = HIGHEST_OUTPUT_REFRESH; return weston_test_harness_execute_as_client(harness, &setup); } diff --git a/tests/viewporter-shot-test.c b/tests/viewporter-shot-test.c index 1f9bca85..f5ddab0d 100644 --- a/tests/viewporter-shot-test.c +++ b/tests/viewporter-shot-test.c @@ -58,6 +58,7 @@ fixture_setup(struct weston_test_harness *harness, compositor_setup_defaults(&setup); setup.renderer = arg->renderer; setup.shell = SHELL_TEST_DESKTOP; + setup.refresh = HIGHEST_OUTPUT_REFRESH; return weston_test_harness_execute_as_client(harness, &setup); } diff --git a/tests/viewporter-test.c b/tests/viewporter-test.c index cbb973ef..6f5ef669 100644 --- a/tests/viewporter-test.c +++ b/tests/viewporter-test.c @@ -43,6 +43,7 @@ fixture_setup(struct weston_test_harness *harness) compositor_setup_defaults(&setup); setup.shell = SHELL_TEST_DESKTOP; + setup.refresh = HIGHEST_OUTPUT_REFRESH; return weston_test_harness_execute_as_client(harness, &setup); } diff --git a/tests/weston-test-fixture-compositor.c b/tests/weston-test-fixture-compositor.c index c62a8532..a885b54f 100644 --- a/tests/weston-test-fixture-compositor.c +++ b/tests/weston-test-fixture-compositor.c @@ -194,6 +194,7 @@ compositor_setup_defaults_(struct compositor_setup *setup, .width = 320, .height = 240, .scale = 1, + .refresh = 0, .transform = WL_OUTPUT_TRANSFORM_NORMAL, .config_file = NULL, .extra_module = NULL, @@ -319,6 +320,12 @@ execute_compositor(const struct compositor_setup *setup, prog_args_take(&args, tmp); } + if (setup->refresh >= 0 && + setup->backend == WESTON_BACKEND_HEADLESS) { + str_printf(&tmp, "--refresh-rate=%d", setup->refresh); + prog_args_take(&args, tmp); + } + if (setup->config_file) { str_printf(&tmp, "--config=%s", setup->config_file); prog_args_take(&args, tmp); diff --git a/tests/weston-test-fixture-compositor.h b/tests/weston-test-fixture-compositor.h index b94f62be..3ef682d1 100644 --- a/tests/weston-test-fixture-compositor.h +++ b/tests/weston-test-fixture-compositor.h @@ -31,6 +31,12 @@ #include "weston-testsuite-data.h" +/* Compositor configuration defaults to a refresh rate of 0 to repaint only on + * captures immediately. This allows to run the test suite as fast as + * possible. Tests not supporting that mode can fallback to the highest refresh + * rate using that constant. */ +#define HIGHEST_OUTPUT_REFRESH 1000000 + /** Weston shell plugin * * \sa compositor_setup @@ -73,6 +79,8 @@ struct compositor_setup { unsigned height; /** Default output scale. */ int scale; + /** Default output refresh rate (headless backend). */ + int refresh; /** Default output transform, one of WL_OUTPUT_TRANSFORM_*. */ enum wl_output_transform transform; /** The absolute path to \c weston.ini to use, diff --git a/tests/yuv-buffer-test.c b/tests/yuv-buffer-test.c index 2a3c679c..33de243d 100644 --- a/tests/yuv-buffer-test.c +++ b/tests/yuv-buffer-test.c @@ -49,6 +49,7 @@ fixture_setup(struct weston_test_harness *harness) setup.height = 264; setup.shell = SHELL_TEST_DESKTOP; setup.logging_scopes = "log,gl-shader-generator"; + setup.refresh = HIGHEST_OUTPUT_REFRESH; return weston_test_harness_execute_as_client(harness, &setup); }