tests: return status from each test definition

Add a status return value to every test definition. There are no
behavioral changes, previously the RESULT_OK was simply assumed.

The benefit of this is that in the future individual tests can also
return RESULT_SKIP, so that we can keep statistics of skipped tests.

ivi-layout-internal-test.c has the only case where a test function may
return early. That one is set to return RESULT_HARD_ERROR to match the
compositor exit code already there.

Also documentation is updated.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
This commit is contained in:
Pekka Paalanen 2025-04-30 14:49:10 +03:00
parent 303d88448a
commit e57eb5b15d
60 changed files with 602 additions and 31 deletions

View file

@ -90,7 +90,8 @@ Standalone tests
Standalone tests do not have a fixture setup function defined in the test
program or the fixture setup function calls
:func:`weston_test_harness_execute_standalone` explicitly. All test cases must
be defined with :c:func:`TEST` or :c:func:`TEST_P`.
be defined with :c:func:`TEST` or :c:func:`TEST_P`, and each such function must
return a value from :type:`test_result_code`.
This is the simplest possible test example:
@ -98,7 +99,7 @@ This is the simplest possible test example:
TEST(always_success)
{
/* true */
return RESULT_OK;
}
@ -110,7 +111,8 @@ Plugin tests
Plugin tests must have a fixture setup function that calls
:func:`weston_test_harness_execute_as_plugin`. All test cases must be defined
with :c:func:`PLUGIN_TEST` which declares an implicit function argument
:type:`weston_compositor` ``*compositor``.
:type:`weston_compositor` ``*compositor``. Each such function must
return a value from :type:`test_result_code`.
The compositor fixture manufactures the necessary environment variables and the
command line argument array to launch Weston, and calls :func:`wet_main`
@ -137,6 +139,7 @@ This is an example of a plugin test that just logs a line:
{
/* struct weston_compositor *compositor; */
testlog("Got compositor %p\n", compositor);
return RESULT_OK;
}
@ -147,7 +150,8 @@ Client tests
Plugin tests must have a fixture setup function that calls
:func:`weston_test_harness_execute_as_client`. All test cases must be
defined with :c:func:`TEST` or :c:func:`TEST_P`.
defined with :c:func:`TEST` or :c:func:`TEST_P`, and each such function must
return a value from :type:`test_result_code`.
The compositor fixture manufactures the necessary environment variables and the
command line argument array to launch Weston, and calls :func:`wet_main`
@ -202,6 +206,7 @@ clients:
expect_protocol_error(client, &wp_viewport_interface,
WP_VIEWPORT_ERROR_BAD_VALUE);
return RESULT_OK;
}
TEST(test_roundtrip)
@ -210,6 +215,7 @@ clients:
client = create_client_and_test_surface(100, 50, 123, 77);
client_roundtrip(client);
return RESULT_OK;
}
@ -257,15 +263,6 @@ type of tests to keep the fixture setup simple. See
:ref:`test-suite-standalone`, :ref:`test-suite-plugin` and
:ref:`test-suite-client` how to set up each type in a test program.
.. note::
**TODO:** Currently it is not possible to gracefully skip or fail a test.
You can skip with ``exit(RESULT_SKIP)`` but that will quit the whole test
program and all defined tests that were not ran yet will be counted as
failed. You can fail a test by any means, e.g. ``exit(RESULT_FAIL)``, but
the same caveat applies. Succeeded tests must simply return and not call any
exit function.
.. toctree::
:hidden:

View file

@ -364,4 +364,6 @@ TEST(alpha_blend)
buffer_destroy(fg);
wl_subcompositor_destroy(subco);
client_destroy(client); /* destroys bg */
return RESULT_OK;
}

View file

@ -145,4 +145,6 @@ TEST(asserts)
/* If we reach that point, it's a success so reset the assert counter
* that's been incremented to check that assertions work. */
weston_assert_counter_reset();
return RESULT_OK;
}

View file

@ -194,4 +194,6 @@ TEST(test_truncated_shm_file)
wl_buffer_destroy(bad_buffer);
client_destroy(client);
return RESULT_OK;
}

View file

@ -149,4 +149,6 @@ TEST_P(buffer_transform, my_buffer_args)
client_destroy(client);
free(refname);
return RESULT_OK;
}

View file

@ -1976,4 +1976,6 @@ TEST_P(client_buffer, client_buffer_cases)
out:
pixman_image_unref(img);
client_destroy(client);
return RESULT_OK;
}

View file

@ -428,6 +428,8 @@ TEST(opaque_pixel_conversion)
buffer_destroy(shot);
buffer_destroy(buf);
client_destroy(client);
return RESULT_OK;
}
static struct color_float
@ -653,6 +655,8 @@ TEST(output_icc_alpha_blend)
buffer_destroy(fg);
wl_subcompositor_destroy(subco);
client_destroy(client); /* destroys bg */
return RESULT_OK;
}
/*
@ -689,4 +693,6 @@ TEST(output_icc_decorations)
pixman_image_unref(img);
buffer_destroy(shot);
client_destroy(client);
return RESULT_OK;
}

View file

@ -184,6 +184,8 @@ TEST(keep_regular_matrix)
test_assert_ptr_null(cmsStageNext(elem));
pipeline_context_release(&pc);
return RESULT_OK;
}
/* Pipeline with a identity matrix, which should be removed. */
@ -198,6 +200,8 @@ TEST(drop_identity_matrix)
test_assert_u32_eq(cmsPipelineStageCount(pc.pipeline), 0);
pipeline_context_release(&pc);
return RESULT_OK;
}
/* Pipeline with two inverse matrices. When merged they become identity, which
@ -214,6 +218,8 @@ TEST(drop_inverse_matrices)
test_assert_u32_eq(cmsPipelineStageCount(pc.pipeline), 0);
pipeline_context_release(&pc);
return RESULT_OK;
}
/* Pipeline with an identity and two inverse matrices. Pipeline must be empty
@ -231,6 +237,8 @@ TEST(drop_identity_and_inverse_matrices)
test_assert_u32_eq(cmsPipelineStageCount(pc.pipeline), 0);
pipeline_context_release(&pc);
return RESULT_OK;
}
/* Pipeline has a regular matrix followed by two inverses, which should be
@ -255,6 +263,8 @@ TEST(only_drop_inverse_matrices)
test_assert_ptr_null(cmsStageNext(elem));
pipeline_context_release(&pc);
return RESULT_OK;
}
/* Same as above, but the regular matrix is the last element. */
@ -278,6 +288,8 @@ TEST(only_drop_inverse_matrices_another_order)
test_assert_ptr_null(cmsStageNext(elem));
pipeline_context_release(&pc);
return RESULT_OK;
}
/* Pipeline has an identity curve, which should be removed. */
@ -292,6 +304,8 @@ TEST(drop_identity_curve)
test_assert_u32_eq(cmsPipelineStageCount(pc.pipeline), 0);
pipeline_context_release(&pc);
return RESULT_OK;
}
/* Pipeline has two parametric curves that are inverse. So they should be
@ -308,6 +322,8 @@ TEST(drop_inverse_curves)
test_assert_u32_eq(cmsPipelineStageCount(pc.pipeline), 0);
pipeline_context_release(&pc);
return RESULT_OK;
}
/* Pipeline has two parametric inverse curves followed by an identity. Pipeline
@ -325,6 +341,8 @@ TEST(drop_identity_and_inverse_curves)
test_assert_u32_eq(cmsPipelineStageCount(pc.pipeline), 0);
pipeline_context_release(&pc);
return RESULT_OK;
}
/* Same as above, but the identity is the last element. */
@ -341,6 +359,8 @@ TEST(drop_identity_and_inverse_curves_another_order)
test_assert_u32_eq(cmsPipelineStageCount(pc.pipeline), 0);
pipeline_context_release(&pc);
return RESULT_OK;
}
#if HAVE_CMS_GET_TONE_CURVE_SEGMENT
@ -388,6 +408,8 @@ TEST(keep_regular_curve)
test_assert_ptr_null(cmsStageNext(stage));
pipeline_context_release(&pc);
return RESULT_OK;
}
/* Inverse curves followed by a parametric curve. Inverse curves are dropped (as
@ -412,6 +434,8 @@ TEST(do_not_merge_identity_with_parametric)
test_assert_ptr_null(cmsStageNext(stage));
pipeline_context_release(&pc);
return RESULT_OK;
}
/* Merge power-law function with itself. */
@ -438,6 +462,8 @@ TEST(merge_power_law_curves_with_itself)
test_assert_ptr_null(cmsStageNext(stage));
pipeline_context_release(&pc);
return RESULT_OK;
}
/* Merge power-law functions into a single parametric one of the same type. */
@ -464,6 +490,8 @@ TEST(merge_power_law_curves_with_another)
test_assert_ptr_null(cmsStageNext(stage));
pipeline_context_release(&pc);
return RESULT_OK;
}
#endif /* HAVE_CMS_GET_TONE_CURVE_SEGMENT */

View file

@ -727,6 +727,8 @@ TEST_P(create_parametric_image_description, good_test_cases)
image_description_destroy(image_desc);
color_manager_fini(&cm);
client_destroy(client);
return RESULT_OK;
}
TEST_P(fail_to_create_parametric_image_description, bad_test_cases)
@ -850,6 +852,8 @@ out:
wp_image_description_creator_params_v1_destroy(image_desc_creator_param);
color_manager_fini(&cm);
client_destroy(client);
return RESULT_OK;
}
TEST(set_primaries_named_twice)
@ -874,6 +878,8 @@ TEST(set_primaries_named_twice)
color_manager_fini(&cm);
client_destroy(client);
return RESULT_OK;
}
TEST(set_primaries_twice)
@ -896,6 +902,8 @@ TEST(set_primaries_twice)
color_manager_fini(&cm);
client_destroy(client);
return RESULT_OK;
}
TEST(set_primaries_then_primaries_named)
@ -919,6 +927,8 @@ TEST(set_primaries_then_primaries_named)
color_manager_fini(&cm);
client_destroy(client);
return RESULT_OK;
}
TEST(set_primaries_named_then_primaries)
@ -942,6 +952,8 @@ TEST(set_primaries_named_then_primaries)
color_manager_fini(&cm);
client_destroy(client);
return RESULT_OK;
}
TEST(set_tf_power_twice)
@ -966,6 +978,8 @@ TEST(set_tf_power_twice)
color_manager_fini(&cm);
client_destroy(client);
return RESULT_OK;
}
TEST(set_tf_named_twice)
@ -990,6 +1004,8 @@ TEST(set_tf_named_twice)
color_manager_fini(&cm);
client_destroy(client);
return RESULT_OK;
}
TEST(set_tf_power_then_tf_named)
@ -1014,6 +1030,8 @@ TEST(set_tf_power_then_tf_named)
color_manager_fini(&cm);
client_destroy(client);
return RESULT_OK;
}
TEST(set_tf_named_then_tf_power)
@ -1038,6 +1056,8 @@ TEST(set_tf_named_then_tf_power)
color_manager_fini(&cm);
client_destroy(client);
return RESULT_OK;
}
TEST(set_luminance_twice)
@ -1069,6 +1089,8 @@ TEST(set_luminance_twice)
color_manager_fini(&cm);
client_destroy(client);
return RESULT_OK;
}
TEST(set_target_primaries_twice)
@ -1091,6 +1113,8 @@ TEST(set_target_primaries_twice)
color_manager_fini(&cm);
client_destroy(client);
return RESULT_OK;
}
TEST(set_target_luminance_twice)
@ -1119,6 +1143,8 @@ TEST(set_target_luminance_twice)
color_manager_fini(&cm);
client_destroy(client);
return RESULT_OK;
}
TEST(set_max_cll_twice)
@ -1141,6 +1167,8 @@ TEST(set_max_cll_twice)
color_manager_fini(&cm);
client_destroy(client);
return RESULT_OK;
}
TEST(set_max_fall_twice)
@ -1163,4 +1191,6 @@ TEST(set_max_fall_twice)
color_manager_fini(&cm);
client_destroy(client);
return RESULT_OK;
}

View file

@ -749,6 +749,8 @@ TEST(smoke_test)
color_manager_fini(&cm);
client_destroy(client);
return RESULT_OK;
}
static void
@ -808,6 +810,8 @@ TEST(output_get_image_description)
image_descr_info_destroy(image_descr_info);
color_manager_fini(&cm);
client_destroy(client);
return RESULT_OK;
}
TEST(surface_get_preferred_image_description)
@ -831,6 +835,8 @@ TEST(surface_get_preferred_image_description)
image_descr_info_destroy(image_descr_info);
color_manager_fini(&cm);
client_destroy(client);
return RESULT_OK;
}
TEST(create_image_description_before_setting_icc_file)
@ -859,6 +865,8 @@ TEST(create_image_description_before_setting_icc_file)
wp_image_description_v1_destroy(image_desc);
color_manager_fini(&cm);
client_destroy(client);
return RESULT_OK;
}
TEST(set_unreadable_icc_fd)
@ -891,6 +899,8 @@ TEST(set_unreadable_icc_fd)
wp_image_description_creator_icc_v1_destroy(image_descr_creator_icc);
color_manager_fini(&cm);
client_destroy(client);
return RESULT_OK;
}
TEST(set_bad_icc_size_zero)
@ -919,6 +929,8 @@ TEST(set_bad_icc_size_zero)
wp_image_description_creator_icc_v1_destroy(image_descr_creator_icc);
color_manager_fini(&cm);
client_destroy(client);
return RESULT_OK;
}
TEST(set_bad_icc_non_seekable)
@ -949,6 +961,8 @@ TEST(set_bad_icc_non_seekable)
wp_image_description_creator_icc_v1_destroy(image_descr_creator_icc);
color_manager_fini(&cm);
client_destroy(client);
return RESULT_OK;
}
TEST(set_icc_twice)
@ -983,6 +997,8 @@ TEST(set_icc_twice)
wp_image_description_creator_icc_v1_destroy(image_descr_creator_icc);
color_manager_fini(&cm);
client_destroy(client);
return RESULT_OK;
}
TEST(create_icc_image_description_no_info)
@ -1013,6 +1029,8 @@ TEST(create_icc_image_description_no_info)
image_descr_info_destroy(image_descr_info);
color_manager_fini(&cm);
client_destroy(client);
return RESULT_OK;
}
TEST(set_surface_image_description)
@ -1041,4 +1059,6 @@ TEST(set_surface_image_description)
color_manager_fini(&cm);
client_destroy(client);
return RESULT_OK;
}

View file

@ -241,6 +241,8 @@ TEST_P(color_characteristics_config_error, config_cases)
free(logbuf);
weston_output_release(&mock_output);
weston_idalloc_destroy(mock_compositor.color_profile_id_generator);
return RESULT_OK;
}
/* Setting NULL resets group_mask */
@ -268,6 +270,8 @@ TEST(weston_output_set_color_characteristics_null)
weston_output_release(&mock_output);
weston_idalloc_destroy(mock_compositor.color_profile_id_generator);
return RESULT_OK;
}
struct value_testcase {
@ -355,6 +359,8 @@ TEST_P(hdr_metadata_type1_errors, value_cases)
weston_output_color_outcome_destroy(&mock_output.color_outcome);
weston_output_release(&mock_output);
weston_idalloc_destroy(mock_compositor.color_profile_id_generator);
return RESULT_OK;
}
/* Unflagged members are ignored in validity check */
@ -398,6 +404,8 @@ TEST(hdr_metadata_type1_ignore_unflagged)
weston_output_color_outcome_destroy(&mock_output.color_outcome);
weston_output_release(&mock_output);
weston_idalloc_destroy(mock_compositor.color_profile_id_generator);
return RESULT_OK;
}
struct mode_testcase {
@ -663,4 +671,6 @@ TEST_P(mode_config_error, mode_config_cases)
weston_output_release(&mock_output);
weston_head_release(&mock_head);
weston_idalloc_destroy(mock_compositor.color_profile_id_generator);
return RESULT_OK;
}

View file

@ -123,4 +123,6 @@ PLUGIN_TEST(color_characteristics_from_weston_ini)
test_assert_f32_eq(hdr_meta->maxDML, 65535.0f);
test_assert_f32_eq(hdr_meta->maxCLL, 65535.0f);
test_assert_f32_eq(hdr_meta->maxFALL, 1000.0f);
return RESULT_OK;
}

View file

@ -75,6 +75,8 @@ TEST(comment_only)
struct weston_config *config = assert_load_config(comment_only_text);
weston_config_destroy(config);
return RESULT_OK;
}
/** @todo legit tests should have more descriptive names. */
@ -132,6 +134,8 @@ TEST(legit_test01)
test_assert_ptr_null(section);
weston_config_destroy(config);
return RESULT_OK;
}
TEST(legit_test02)
@ -149,6 +153,8 @@ TEST(legit_test02)
free(s);
weston_config_destroy(config);
return RESULT_OK;
}
TEST(legit_test03)
@ -166,6 +172,8 @@ TEST(legit_test03)
test_assert_ptr_null(s);
weston_config_destroy(config);
return RESULT_OK;
}
TEST(legit_test04)
@ -183,6 +191,8 @@ TEST(legit_test04)
free(s);
weston_config_destroy(config);
return RESULT_OK;
}
TEST(legit_test05)
@ -201,6 +211,8 @@ TEST(legit_test05)
free(s);
weston_config_destroy(config);
return RESULT_OK;
}
TEST(legit_test06)
@ -218,6 +230,8 @@ TEST(legit_test06)
test_assert_errno(0);
weston_config_destroy(config);
return RESULT_OK;
}
TEST(legit_test07)
@ -235,6 +249,8 @@ TEST(legit_test07)
test_assert_s32_eq(700, n);
weston_config_destroy(config);
return RESULT_OK;
}
TEST(legit_test08)
@ -252,6 +268,8 @@ TEST(legit_test08)
test_assert_errno(0);
weston_config_destroy(config);
return RESULT_OK;
}
TEST(legit_test09)
@ -269,6 +287,8 @@ TEST(legit_test09)
test_assert_u32_eq(600, u);
weston_config_destroy(config);
return RESULT_OK;
}
TEST(legit_test10)
@ -285,6 +305,8 @@ TEST(legit_test10)
test_assert_false(b);
weston_config_destroy(config);
return RESULT_OK;
}
TEST(legit_test11)
@ -301,6 +323,8 @@ TEST(legit_test11)
test_assert_true(b);
weston_config_destroy(config);
return RESULT_OK;
}
TEST(legit_test12)
@ -318,6 +342,8 @@ TEST(legit_test12)
test_assert_false(b);
weston_config_destroy(config);
return RESULT_OK;
}
TEST(legit_test13)
@ -336,6 +362,8 @@ TEST(legit_test13)
free(s);
weston_config_destroy(config);
return RESULT_OK;
}
TEST(legit_test14)
@ -354,6 +382,8 @@ TEST(legit_test14)
free(s);
weston_config_destroy(config);
return RESULT_OK;
}
TEST(legit_test15)
@ -374,6 +404,8 @@ TEST(legit_test15)
free(s);
weston_config_destroy(config);
return RESULT_OK;
}
TEST(legit_test16)
@ -394,6 +426,8 @@ TEST(legit_test16)
test_assert_int_eq(6, i);
weston_config_destroy(config);
return RESULT_OK;
}
TEST(legit_test17)
@ -411,6 +445,8 @@ TEST(legit_test17)
test_assert_errno(0);
weston_config_destroy(config);
return RESULT_OK;
}
TEST(legit_test18)
@ -428,6 +464,8 @@ TEST(legit_test18)
test_assert_errno(0);
weston_config_destroy(config);
return RESULT_OK;
}
TEST(legit_test19)
@ -445,6 +483,8 @@ TEST(legit_test19)
test_assert_errno(0);
weston_config_destroy(config);
return RESULT_OK;
}
TEST(legit_test20)
@ -462,6 +502,8 @@ TEST(legit_test20)
test_assert_errno(0);
weston_config_destroy(config);
return RESULT_OK;
}
TEST(legit_test21)
@ -479,6 +521,8 @@ TEST(legit_test21)
test_assert_errno(0);
weston_config_destroy(config);
return RESULT_OK;
}
TEST(legit_test22)
@ -497,6 +541,8 @@ TEST(legit_test22)
test_assert_errno(0);
weston_config_destroy(config);
return RESULT_OK;
}
TEST(legit_test23)
@ -515,6 +561,8 @@ TEST(legit_test23)
test_assert_errno(0);
weston_config_destroy(config);
return RESULT_OK;
}
TEST(legit_test24)
@ -533,6 +581,8 @@ TEST(legit_test24)
test_assert_errno(EINVAL);
weston_config_destroy(config);
return RESULT_OK;
}
TEST(legit_test25)
@ -551,6 +601,8 @@ TEST(legit_test25)
test_assert_errno(EINVAL);
weston_config_destroy(config);
return RESULT_OK;
}
TEST(legit_test26)
@ -568,6 +620,8 @@ TEST(legit_test26)
test_assert_errno(0);
weston_config_destroy(config);
return RESULT_OK;
}
TEST(legit_test27)
@ -585,6 +639,8 @@ TEST(legit_test27)
test_assert_errno(ERANGE);
weston_config_destroy(config);
return RESULT_OK;
}
TEST(get_double_number)
@ -603,6 +659,8 @@ TEST(get_double_number)
test_assert_errno(0);
weston_config_destroy(config);
return RESULT_OK;
}
TEST(get_double_missing)
@ -620,6 +678,8 @@ TEST(get_double_missing)
test_assert_errno(ENOENT);
weston_config_destroy(config);
return RESULT_OK;
}
TEST(get_double_zero)
@ -638,6 +698,8 @@ TEST(get_double_zero)
test_assert_errno(0);
weston_config_destroy(config);
return RESULT_OK;
}
TEST(get_double_negative)
@ -656,6 +718,8 @@ TEST(get_double_negative)
test_assert_errno(0);
weston_config_destroy(config);
return RESULT_OK;
}
TEST(get_double_flag)
@ -674,6 +738,8 @@ TEST(get_double_flag)
test_assert_errno(EINVAL);
weston_config_destroy(config);
return RESULT_OK;
}
TEST(get_double_real)
@ -692,6 +758,8 @@ TEST(get_double_real)
test_assert_errno(0);
weston_config_destroy(config);
return RESULT_OK;
}
TEST(get_double_negreal)
@ -710,6 +778,8 @@ TEST(get_double_negreal)
test_assert_errno(0);
weston_config_destroy(config);
return RESULT_OK;
}
TEST(get_double_expval)
@ -728,6 +798,8 @@ TEST(get_double_expval)
test_assert_errno(0);
weston_config_destroy(config);
return RESULT_OK;
}
TEST(get_double_negexpval)
@ -746,6 +818,8 @@ TEST(get_double_negexpval)
test_assert_errno(0);
weston_config_destroy(config);
return RESULT_OK;
}
TEST(get_double_notanumber)
@ -764,6 +838,8 @@ TEST(get_double_notanumber)
test_assert_errno(0);
weston_config_destroy(config);
return RESULT_OK;
}
TEST(get_double_empty)
@ -782,6 +858,8 @@ TEST(get_double_empty)
test_assert_errno(0);
weston_config_destroy(config);
return RESULT_OK;
}
TEST(get_double_tiny)
@ -800,6 +878,8 @@ TEST(get_double_tiny)
test_assert_errno(0);
weston_config_destroy(config);
return RESULT_OK;
}
struct doesnt_parse_test { char *text; };
@ -824,12 +904,16 @@ TEST_P(doesnt_parse, doesnt_parse_test_data)
struct doesnt_parse_test *test = (struct doesnt_parse_test *) data;
struct weston_config *config = load_config(test->text);
test_assert_ptr_null(config);
return RESULT_OK;
}
TEST(destroy_null)
{
weston_config_destroy(NULL);
test_assert_int_eq(0, weston_config_next_section(NULL, NULL, NULL));
return RESULT_OK;
}
TEST(section_from_null)
@ -837,4 +921,6 @@ TEST(section_from_null)
struct weston_config_section *section;
section = weston_config_get_section(NULL, "bucket", NULL, NULL);
test_assert_ptr_null(section);
return RESULT_OK;
}

View file

@ -232,6 +232,8 @@ TEST(constraints_events)
constraint_deinit(&cs);
client_destroy(client);
return RESULT_OK;
}
TEST(constraints_confined_boundaries_input_region)
@ -286,6 +288,8 @@ TEST(constraints_confined_boundaries_input_region)
constraint_deinit(&cs);
client_destroy(client);
return RESULT_OK;
}
TEST(constraints_locked_boundaries_input_region)
@ -322,6 +326,8 @@ TEST(constraints_locked_boundaries_input_region)
constraint_deinit(&cs);
client_destroy(client);
return RESULT_OK;
}
TEST(constraints_already_constrained)
@ -377,6 +383,8 @@ TEST(constraints_already_constrained)
constraint_deinit(&cs);
client_destroy(client);
return RESULT_OK;
}
/*
@ -415,6 +423,8 @@ TEST(constraints_shell_activate_input)
constraint_deinit(&cs);
client_destroy(client);
return RESULT_OK;
}
TEST(constraints_pointer_focus)
@ -447,4 +457,6 @@ TEST(constraints_pointer_focus)
constraint_deinit(&cs);
client_destroy(client);
return RESULT_OK;
}

View file

@ -86,6 +86,8 @@ TEST(basic_env)
ASSERT_STR_ARRAY_MATCH("envp", custom_env_get_envp(&env), envp);
test_assert_true(env.env_finalized);
custom_env_fini(&env);
return RESULT_OK;
}
TEST(basic_env_arg)
@ -103,6 +105,8 @@ TEST(basic_env_arg)
ASSERT_STR_ARRAY_MATCH("argp", custom_env_get_argp(&env), argp);
test_assert_true(env.arg_finalized);
custom_env_fini(&env);
return RESULT_OK;
}
struct test_str {
@ -155,4 +159,6 @@ TEST_P(env_parse_string, str_tests)
ASSERT_STR_ARRAY_MATCH("envp", custom_env_get_envp(&env), test->envp);
ASSERT_STR_ARRAY_MATCH("argp", custom_env_get_argp(&env), test->argp);
custom_env_fini(&env);
return RESULT_OK;
}

View file

@ -112,6 +112,8 @@ TEST(seat_capabilities_test)
test_assert_ptr_not_null(cl->input->touch);
client_destroy(cl);
return RESULT_OK;
}
#define COUNT 15
@ -152,6 +154,8 @@ TEST(multiple_device_add_and_remove)
test_assert_ptr_not_null(cl->input->touch);
client_destroy(cl);
return RESULT_OK;
}
static void
@ -200,6 +204,8 @@ TEST(device_release_before_destroy_multiple)
for (i = 0; i < 30; ++i)
device_release_before_destroy();
return RESULT_OK;
}
static void
@ -249,6 +255,8 @@ TEST(device_release_after_destroy_multiple)
for (i = 0; i < 30; ++i)
device_release_after_destroy();
return RESULT_OK;
}
/* see https://bugzilla.gnome.org/show_bug.cgi?id=745008
@ -325,6 +333,8 @@ TEST(get_device_after_destroy_multiple)
for (i = 0; i < 30; ++i) {
get_device_after_destroy();
}
return RESULT_OK;
}
TEST(seats_have_names)
@ -337,6 +347,8 @@ TEST(seats_have_names)
}
client_destroy(cl);
return RESULT_OK;
}
TEST(seat_destroy_and_recreate)
@ -361,4 +373,6 @@ TEST(seat_destroy_and_recreate)
test_assert_ptr_not_null(cl->input->touch);
client_destroy(cl);
return RESULT_OK;
}

View file

@ -96,6 +96,8 @@ TEST(basic_operations)
ARRAY_LENGTH(formats) * ARRAY_LENGTH(modifiers));
weston_drm_format_array_fini(&format_array);
return RESULT_OK;
}
TEST(compare_arrays_same_content)
@ -125,6 +127,8 @@ TEST(compare_arrays_same_content)
weston_drm_format_array_fini(&format_array_A);
weston_drm_format_array_fini(&format_array_B);
return RESULT_OK;
}
TEST(compare_arrays_exclusive_content)
@ -146,6 +150,8 @@ TEST(compare_arrays_exclusive_content)
weston_drm_format_array_fini(&format_array_A);
weston_drm_format_array_fini(&format_array_B);
return RESULT_OK;
}
TEST(replace_array)
@ -167,6 +173,8 @@ TEST(replace_array)
weston_drm_format_array_fini(&format_array_A);
weston_drm_format_array_fini(&format_array_B);
return RESULT_OK;
}
TEST(remove_from_array)
@ -196,6 +204,8 @@ TEST(remove_from_array)
weston_drm_format_array_fini(&format_array_A);
weston_drm_format_array_fini(&format_array_B);
weston_drm_format_array_fini(&format_array_C);
return RESULT_OK;
}
TEST(join_arrays)
@ -232,6 +242,8 @@ TEST(join_arrays)
weston_drm_format_array_fini(&format_array_A);
weston_drm_format_array_fini(&format_array_B);
weston_drm_format_array_fini(&format_array_C);
return RESULT_OK;
}
TEST(join_arrays_same_content)
@ -264,6 +276,8 @@ TEST(join_arrays_same_content)
weston_drm_format_array_fini(&format_array_A);
weston_drm_format_array_fini(&format_array_B);
return RESULT_OK;
}
TEST(join_arrays_exclusive_content)
@ -291,6 +305,8 @@ TEST(join_arrays_exclusive_content)
weston_drm_format_array_fini(&format_array_A);
weston_drm_format_array_fini(&format_array_B);
weston_drm_format_array_fini(&format_array_C);
return RESULT_OK;
}
TEST(join_arrays_modifier_invalid)
@ -319,6 +335,8 @@ TEST(join_arrays_modifier_invalid)
weston_drm_format_array_fini(&format_array_A);
weston_drm_format_array_fini(&format_array_B);
weston_drm_format_array_fini(&format_array_C);
return RESULT_OK;
}
TEST(intersect_arrays)
@ -351,6 +369,8 @@ TEST(intersect_arrays)
weston_drm_format_array_fini(&format_array_A);
weston_drm_format_array_fini(&format_array_B);
weston_drm_format_array_fini(&format_array_C);
return RESULT_OK;
}
TEST(intersect_arrays_same_content)
@ -381,6 +401,8 @@ TEST(intersect_arrays_same_content)
weston_drm_format_array_fini(&format_array_A);
weston_drm_format_array_fini(&format_array_B);
return RESULT_OK;
}
TEST(intersect_arrays_exclusive_formats)
@ -404,6 +426,8 @@ TEST(intersect_arrays_exclusive_formats)
weston_drm_format_array_fini(&format_array_A);
weston_drm_format_array_fini(&format_array_B);
return RESULT_OK;
}
TEST(intersect_arrays_exclusive_modifiers)
@ -429,6 +453,8 @@ TEST(intersect_arrays_exclusive_modifiers)
weston_drm_format_array_fini(&format_array_A);
weston_drm_format_array_fini(&format_array_B);
return RESULT_OK;
}
TEST(subtract_arrays)
@ -463,6 +489,8 @@ TEST(subtract_arrays)
weston_drm_format_array_fini(&format_array_A);
weston_drm_format_array_fini(&format_array_B);
weston_drm_format_array_fini(&format_array_C);
return RESULT_OK;
}
TEST(subtract_arrays_same_content)
@ -486,6 +514,8 @@ TEST(subtract_arrays_same_content)
weston_drm_format_array_fini(&format_array_A);
weston_drm_format_array_fini(&format_array_B);
return RESULT_OK;
}
TEST(subtract_arrays_exclusive_formats)
@ -515,6 +545,8 @@ TEST(subtract_arrays_exclusive_formats)
weston_drm_format_array_fini(&format_array_A);
weston_drm_format_array_fini(&format_array_B);
weston_drm_format_array_fini(&format_array_C);
return RESULT_OK;
}
TEST(subtract_arrays_exclusive_modifiers)
@ -544,6 +576,8 @@ TEST(subtract_arrays_exclusive_modifiers)
weston_drm_format_array_fini(&format_array_A);
weston_drm_format_array_fini(&format_array_B);
weston_drm_format_array_fini(&format_array_C);
return RESULT_OK;
}
TEST(subtract_arrays_modifier_invalid)
@ -570,4 +604,6 @@ TEST(subtract_arrays_modifier_invalid)
weston_drm_format_array_fini(&format_array_A);
weston_drm_format_array_fini(&format_array_B);
return RESULT_OK;
}

View file

@ -71,6 +71,8 @@ TEST(drm_smoke) {
buffer_destroy(buffer);
client_destroy(client);
return RESULT_OK;
}
TEST(drm_screenshot_no_damage) {
@ -97,4 +99,6 @@ TEST(drm_screenshot_no_damage) {
}
client_destroy(client);
return RESULT_OK;
}

View file

@ -153,4 +153,6 @@ TEST(drm_writeback_screenshot) {
client_destroy(client);
test_assert_true(match);
return RESULT_OK;
}

View file

@ -113,6 +113,8 @@ TEST(test_surface_output)
test_assert_true(output_contains_client(client));
client_destroy(client);
return RESULT_OK;
}
static void
@ -186,4 +188,6 @@ TEST(buffer_release)
buffer_destroy(buf2);
buffer_destroy(buf3);
client_destroy(client);
return RESULT_OK;
}

View file

@ -50,4 +50,6 @@ TEST(test_sequential_ids)
test_assert_u32_eq(weston_idalloc_get_id(ida), 10000);
weston_idalloc_destroy(ida);
return RESULT_OK;
}

View file

@ -179,4 +179,6 @@ TEST(internal_screenshot)
buffer_destroy(buf);
client_destroy(client);
return RESULT_OK;
}

View file

@ -80,4 +80,6 @@ iterate_debug_scopes(struct weston_compositor *compositor)
PLUGIN_TEST(iterate_default_debug_scopes)
{
iterate_debug_scopes(compositor);
return RESULT_OK;
}

View file

@ -783,11 +783,13 @@ PLUGIN_TEST(ivi_layout_internal)
if (!iface) {
weston_log("fatal: cannot use ivi_layout_interface.\n");
weston_compositor_exit_with_code(compositor, RESULT_HARD_ERROR);
return;
return RESULT_HARD_ERROR;
}
ctx.compositor = compositor;
ctx.layout_interface = iface;
run_internal_tests(&ctx);
return RESULT_OK;
}

View file

@ -242,6 +242,8 @@ TEST_P(ivi_layout_runner, basic_test_names)
runner_destroy(runner);
ivi_application_destroy(iviapp);
client_destroy(client);
return RESULT_OK;
}
TEST(ivi_layout_surface_create)
@ -270,6 +272,8 @@ TEST(ivi_layout_surface_create)
runner_destroy(runner);
ivi_application_destroy(iviapp);
client_destroy(client);
return RESULT_OK;
}
TEST_P(commit_changes_after_properties_set_surface_destroy, surface_property_commit_changes_test_names)
@ -296,6 +300,8 @@ TEST_P(commit_changes_after_properties_set_surface_destroy, surface_property_com
runner_destroy(runner);
ivi_application_destroy(iviapp);
client_destroy(client);
return RESULT_OK;
}
TEST(get_surface_after_destroy_ivi_surface)
@ -320,6 +326,8 @@ TEST(get_surface_after_destroy_ivi_surface)
runner_destroy(runner);
ivi_application_destroy(iviapp);
client_destroy(client);
return RESULT_OK;
}
TEST(get_surface_after_destroy_wl_surface)
@ -344,6 +352,8 @@ TEST(get_surface_after_destroy_wl_surface)
runner_destroy(runner);
ivi_application_destroy(iviapp);
client_destroy(client);
return RESULT_OK;
}
TEST_P(ivi_layout_layer_render_order_runner, render_order_test_names)
@ -374,6 +384,8 @@ TEST_P(ivi_layout_layer_render_order_runner, render_order_test_names)
runner_destroy(runner);
ivi_application_destroy(iviapp);
client_destroy(client);
return RESULT_OK;
}
TEST(destroy_surface_after_layer_render_order)
@ -405,6 +417,8 @@ TEST(destroy_surface_after_layer_render_order)
runner_destroy(runner);
ivi_application_destroy(iviapp);
client_destroy(client);
return RESULT_OK;
}
TEST(commit_changes_after_render_order_set_surface_destroy)
@ -437,6 +451,8 @@ TEST(commit_changes_after_render_order_set_surface_destroy)
runner_destroy(runner);
ivi_application_destroy(iviapp);
client_destroy(client);
return RESULT_OK;
}
TEST(ivi_layout_surface_configure_notification)
@ -474,6 +490,8 @@ TEST(ivi_layout_surface_configure_notification)
runner_destroy(runner);
ivi_application_destroy(iviapp);
client_destroy(client);
return RESULT_OK;
}
TEST(ivi_layout_surface_create_notification)
@ -501,6 +519,8 @@ TEST(ivi_layout_surface_create_notification)
runner_destroy(runner);
ivi_application_destroy(iviapp);
client_destroy(client);
return RESULT_OK;
}
TEST(ivi_layout_surface_remove_notification)
@ -527,4 +547,6 @@ TEST(ivi_layout_surface_remove_notification)
runner_destroy(runner);
ivi_application_destroy(iviapp);
client_destroy(client);
return RESULT_OK;
}

View file

@ -189,4 +189,6 @@ TEST(ivi_application_exists)
ivi_application_destroy(iviapp);
client_destroy(client);
return RESULT_OK;
}

View file

@ -110,6 +110,8 @@ TEST(simple_keyboard_test)
}
client_destroy(client);
return RESULT_OK;
}
TEST(keyboard_key_event_time)
@ -130,6 +132,8 @@ TEST(keyboard_key_event_time)
input_timestamps_destroy(input_ts);
client_destroy(client);
return RESULT_OK;
}
TEST(keyboard_timestamps_stop_after_input_timestamps_object_is_destroyed)
@ -150,6 +154,8 @@ TEST(keyboard_timestamps_stop_after_input_timestamps_object_is_destroyed)
test_assert_true(timespec_is_zero(&keyboard->key_time_timespec));
client_destroy(client);
return RESULT_OK;
}
TEST(keyboard_timestamps_stop_after_client_releases_wl_keyboard)
@ -179,4 +185,6 @@ TEST(keyboard_timestamps_stop_after_client_releases_wl_keyboard)
free(client->input->keyboard);
client->input->keyboard = NULL;
client_destroy(client);
return RESULT_OK;
}

View file

@ -539,8 +539,9 @@ TEST(two_surface_switching)
destroy_xdg_surface(xdg_surface1);
xdg_client_destroy(xdg_client);
}
return RESULT_OK;
}
TEST(top_surface_present_in_output_repaint)
{
@ -594,6 +595,8 @@ TEST(top_surface_present_in_output_repaint)
destroy_xdg_surface(xdg_surface);
xdg_client_destroy(xdg_client);
return RESULT_OK;
}
TEST(test_surface_unmaps_on_null)
@ -684,4 +687,6 @@ TEST(test_surface_unmaps_on_null)
destroy_xdg_surface(xdg_surface);
xdg_client_destroy(xdg_client);
return RESULT_OK;
}

View file

@ -83,4 +83,6 @@ TEST_P(build_MPE_curves, build_MPE_curves_test_set)
test_assert_f64_lt(fabs(stat.min), 1e-7);
cmsPipelineFree(pipeline);
return RESULT_OK;
}

View file

@ -60,6 +60,8 @@ TEST(vec3_layout)
for (i = 0; i < 3; i++)
test_assert_f64_eq(v.el[i], i + 1);
return RESULT_OK;
}
/*
@ -87,6 +89,8 @@ TEST(mat3_layout)
for (i = 0; i < 9; i++)
test_assert_f64_eq(M.colmaj[i], i + 1);
return RESULT_OK;
}
TEST(mat3_inf_norm)
@ -98,6 +102,8 @@ TEST(mat3_inf_norm)
);
test_assert_f64_eq(weston_m3f_inf_norm(M), 42.0);
return RESULT_OK;
}
struct test_matrix3 {
@ -216,6 +222,8 @@ TEST_P(mat3_inversion_precision, matrices3)
print_mat3(tm->M);
test_assert_true(false);
}
return RESULT_OK;
}
static void
@ -249,6 +257,8 @@ TEST(vec4_layout)
for (i = 0; i < 4; i++)
test_assert_f32_eq(v.el[i], i + 1);
return RESULT_OK;
}
/*
@ -277,6 +287,8 @@ TEST(mat4_layout)
for (i = 0; i < 16; i++)
test_assert_f32_eq(M.colmaj[i], i + 1);
return RESULT_OK;
}
TEST(mat4_inf_norm)
@ -288,6 +300,8 @@ TEST(mat4_inf_norm)
9, 10, 11, 12);
test_assert_f32_eq(weston_m4f_inf_norm(M), 58.0);
return RESULT_OK;
}
struct test_matrix4 {
@ -453,4 +467,6 @@ TEST_P(mat4_inversion_precision, matrices4)
print_mat4(tm->M);
test_assert_true(false);
}
return RESULT_OK;
}

View file

@ -116,6 +116,8 @@ TEST(second_surface_synchronization_on_surface_raises_error)
zwp_linux_surface_synchronization_v1_destroy(surface_sync1);
zwp_linux_explicit_synchronization_v1_destroy(sync);
client_destroy(client);
return RESULT_OK;
}
TEST(set_acquire_fence_with_invalid_fence_raises_error)
@ -142,6 +144,8 @@ TEST(set_acquire_fence_with_invalid_fence_raises_error)
zwp_linux_surface_synchronization_v1_destroy(surface_sync);
zwp_linux_explicit_synchronization_v1_destroy(sync);
client_destroy(client);
return RESULT_OK;
}
TEST(set_acquire_fence_on_destroyed_surface_raises_error)
@ -170,6 +174,8 @@ TEST(set_acquire_fence_on_destroyed_surface_raises_error)
zwp_linux_surface_synchronization_v1_destroy(surface_sync);
zwp_linux_explicit_synchronization_v1_destroy(sync);
client_destroy(client);
return RESULT_OK;
}
TEST(second_buffer_release_in_commit_raises_error)
@ -200,6 +206,8 @@ TEST(second_buffer_release_in_commit_raises_error)
zwp_linux_surface_synchronization_v1_destroy(surface_sync);
zwp_linux_explicit_synchronization_v1_destroy(sync);
client_destroy(client);
return RESULT_OK;
}
TEST(get_release_without_buffer_raises_commit_error)
@ -225,6 +233,8 @@ TEST(get_release_without_buffer_raises_commit_error)
zwp_linux_surface_synchronization_v1_destroy(surface_sync);
zwp_linux_explicit_synchronization_v1_destroy(sync);
client_destroy(client);
return RESULT_OK;
}
TEST(get_release_on_destroyed_surface_raises_error)
@ -250,6 +260,8 @@ TEST(get_release_on_destroyed_surface_raises_error)
zwp_linux_surface_synchronization_v1_destroy(surface_sync);
zwp_linux_explicit_synchronization_v1_destroy(sync);
client_destroy(client);
return RESULT_OK;
}
TEST(get_release_after_commit_succeeds)
@ -282,6 +294,8 @@ TEST(get_release_after_commit_succeeds)
zwp_linux_surface_synchronization_v1_destroy(surface_sync);
zwp_linux_explicit_synchronization_v1_destroy(sync);
client_destroy(client);
return RESULT_OK;
}
static void
@ -373,6 +387,8 @@ TEST(get_release_events_are_emitted_for_different_buffers)
zwp_linux_surface_synchronization_v1_destroy(surface_sync);
zwp_linux_explicit_synchronization_v1_destroy(sync);
client_destroy(client);
return RESULT_OK;
}
TEST(get_release_events_are_emitted_for_same_buffer_on_surface)
@ -433,6 +449,8 @@ TEST(get_release_events_are_emitted_for_same_buffer_on_surface)
zwp_linux_surface_synchronization_v1_destroy(surface_sync);
zwp_linux_explicit_synchronization_v1_destroy(sync);
client_destroy(client);
return RESULT_OK;
}
TEST(get_release_events_are_emitted_for_same_buffer_on_different_surfaces)
@ -512,4 +530,6 @@ TEST(get_release_events_are_emitted_for_same_buffer_on_different_surfaces)
zwp_linux_explicit_synchronization_v1_destroy(sync);
surface_destroy(other_surface);
client_destroy(client);
return RESULT_OK;
}

View file

@ -227,4 +227,6 @@ TEST_P(matrix_inversion_precision, matrices)
print_matrix(&tm->M);
test_assert_true(false);
}
return RESULT_OK;
}

View file

@ -284,6 +284,8 @@ TEST(transformation_matrix)
weston_matrix_multiply(&a, &b);
transform_expect(&a, true, WL_OUTPUT_TRANSFORM_NORMAL);
test_assert_false(weston_matrix_needs_filtering(&a));
return RESULT_OK;
}
static void
@ -359,6 +361,8 @@ TEST(surface_matrix_to_standard_transform)
surface_test_all_transforms(&surf, 723, 300, 512, 77, scale,
120, 10, 200, 200);
}
return RESULT_OK;
}
static void
@ -461,4 +465,6 @@ TEST(output_matrix_to_standard_transform)
output_test_all_transforms(&output, 1000, 1000, 1024, 768, scale);
output_test_all_transforms(&output, 1024, 768, 1920, 1080, scale);
}
return RESULT_OK;
}

View file

@ -231,6 +231,8 @@ TEST(simple_shot)
capturer_destroy(capt);
buffer_destroy(buf);
client_destroy(client);
return RESULT_OK;
}
/*
@ -271,6 +273,8 @@ TEST(retry_on_wrong_format)
capturer_destroy(capt);
buffer_destroy(buf);
client_destroy(client);
return RESULT_OK;
}
/*
@ -307,6 +311,8 @@ TEST(retry_on_wrong_size)
capturer_destroy(capt);
buffer_destroy(buf);
client_destroy(client);
return RESULT_OK;
}
/*
@ -341,4 +347,6 @@ TEST(writeback_on_headless_fails)
capturer_destroy(capt);
buffer_destroy(buf);
client_destroy(client);
return RESULT_OK;
}

View file

@ -235,4 +235,6 @@ TEST(output_damage)
client->surface->buffer = NULL;
client_destroy(client);
free(refname);
return RESULT_OK;
}

View file

@ -82,4 +82,6 @@ TEST(output_decorations)
pixman_image_unref(img);
buffer_destroy(shot);
client_destroy(client);
return RESULT_OK;
}

View file

@ -149,4 +149,6 @@ TEST_P(output_transform, my_buffer_args)
client_destroy(client);
free(refname);
return RESULT_OK;
}

View file

@ -140,6 +140,8 @@ TEST(top_surface_present_in_output_repaint)
buffer_destroy(buf);
client_destroy(client);
return RESULT_OK;
}
TEST(test_surface_unmaps_on_null)
@ -234,4 +236,6 @@ TEST(test_surface_unmaps_on_null)
buffer_destroy(buf);
client_destroy(client);
return RESULT_OK;
}

View file

@ -102,4 +102,6 @@ PLUGIN_TEST(plugin_registry_test)
api = weston_plugin_api_get(compositor, MY_API_NAME, sz);
test_assert_ptr_not_null(api);
test_assert_ptr_eq(api->func2, dummy_func);
return RESULT_OK;
}

View file

@ -177,4 +177,6 @@ TEST(pointer_cursor_retains_committed_buffer_after_reenter)
surface_destroy(back_surface);
/* main_surface is destroyed when destroying the client. */
client_destroy(client);
return RESULT_OK;
}

View file

@ -162,6 +162,8 @@ TEST(test_pointer_top_left)
check_pointer_move(client, x, y);
client_destroy(client);
return RESULT_OK;
}
TEST(test_pointer_bottom_left)
@ -189,6 +191,8 @@ TEST(test_pointer_bottom_left)
check_pointer_move(client, x, y);
client_destroy(client);
return RESULT_OK;
}
TEST(test_pointer_top_right)
@ -216,6 +220,8 @@ TEST(test_pointer_top_right)
check_pointer_move(client, x, y);
client_destroy(client);
return RESULT_OK;
}
TEST(test_pointer_bottom_right)
@ -243,6 +249,8 @@ TEST(test_pointer_bottom_right)
check_pointer_move(client, x, y);
client_destroy(client);
return RESULT_OK;
}
TEST(test_pointer_top_center)
@ -270,6 +278,8 @@ TEST(test_pointer_top_center)
check_pointer_move(client, x, y);
client_destroy(client);
return RESULT_OK;
}
TEST(test_pointer_bottom_center)
@ -297,6 +307,8 @@ TEST(test_pointer_bottom_center)
check_pointer_move(client, x, y);
client_destroy(client);
return RESULT_OK;
}
TEST(test_pointer_left_center)
@ -324,6 +336,8 @@ TEST(test_pointer_left_center)
check_pointer_move(client, x, y);
client_destroy(client);
return RESULT_OK;
}
TEST(test_pointer_right_center)
@ -351,6 +365,8 @@ TEST(test_pointer_right_center)
check_pointer_move(client, x, y);
client_destroy(client);
return RESULT_OK;
}
TEST(test_pointer_surface_move)
@ -370,6 +386,8 @@ TEST(test_pointer_surface_move)
check_pointer(client, 50, 50);
client_destroy(client);
return RESULT_OK;
}
TEST(pointer_motion_events)
@ -389,6 +407,8 @@ TEST(pointer_motion_events)
input_timestamps_destroy(input_ts);
client_destroy(client);
return RESULT_OK;
}
TEST(pointer_button_events)
@ -417,6 +437,8 @@ TEST(pointer_button_events)
input_timestamps_destroy(input_ts);
client_destroy(client);
return RESULT_OK;
}
TEST(pointer_axis_events)
@ -441,6 +463,8 @@ TEST(pointer_axis_events)
input_timestamps_destroy(input_ts);
client_destroy(client);
return RESULT_OK;
}
TEST(pointer_timestamps_stop_after_input_timestamps_object_is_destroyed)
@ -466,6 +490,8 @@ TEST(pointer_timestamps_stop_after_input_timestamps_object_is_destroyed)
test_assert_true(timespec_is_zero(&pointer->button_time_timespec));
client_destroy(client);
return RESULT_OK;
}
TEST(pointer_timestamps_stop_after_client_releases_wl_pointer)
@ -498,4 +524,6 @@ TEST(pointer_timestamps_stop_after_client_releases_wl_pointer)
free(client->input->pointer);
client->input->pointer = NULL;
client_destroy(client);
return RESULT_OK;
}

View file

@ -251,4 +251,6 @@ TEST(test_presentation_feedback_simple)
feedback_destroy(fb);
wp_presentation_destroy(pres);
client_destroy(client);
return RESULT_OK;
}

View file

@ -135,6 +135,8 @@ TEST(test_role_conflict_sub_wlshell)
wl_subcompositor_destroy(subco);
xdg_wm_base_destroy(xdg_wm_base);
client_destroy(client);
return RESULT_OK;
}
TEST(test_role_conflict_wlshell_sub)
@ -174,4 +176,6 @@ TEST(test_role_conflict_wlshell_sub)
xdg_wm_base_destroy(xdg_wm_base);
wl_subcompositor_destroy(subco);
client_destroy(client);
return RESULT_OK;
}

View file

@ -126,4 +126,6 @@ create_outputs(struct weston_compositor *compositor)
PLUGIN_TEST(real_usecase_one)
{
create_outputs(compositor);
return RESULT_OK;
}

View file

@ -88,4 +88,6 @@ TEST(real_usecase_standalone)
destroy_test_surface(st);
destroy_test_surface(st_new);
return RESULT_OK;
}

View file

@ -111,4 +111,6 @@ TEST(solid_buffer_argb_u32)
wp_viewport_destroy(viewport);
wp_single_pixel_buffer_manager_v1_destroy(mgr);
client_destroy(client);
return RESULT_OK;
}

View file

@ -85,4 +85,6 @@ TEST(strtol_conversions)
ret = safe_strtoint(str, &val);
test_assert_false(ret);
test_assert_s32_eq(val, -1);
return RESULT_OK;
}

View file

@ -213,6 +213,8 @@ TEST(subsurface_recursive_unmap)
wl_subcompositor_destroy(subco);
client_destroy(client);
return RESULT_OK;
}
TEST(subsurface_z_order)
@ -304,6 +306,8 @@ TEST(subsurface_z_order)
wl_subcompositor_destroy(subco);
client_destroy(client);
return RESULT_OK;
}
TEST(subsurface_sync_damage_buffer)
@ -371,6 +375,8 @@ TEST(subsurface_sync_damage_buffer)
wl_subcompositor_destroy(subco);
client_destroy(client);
return RESULT_OK;
}
TEST(subsurface_empty_mapping)
@ -503,6 +509,8 @@ TEST(subsurface_empty_mapping)
wp_viewporter_destroy(viewporter);
wl_subcompositor_destroy(subco);
client_destroy(client);
return RESULT_OK;
}
TEST(subsurface_desync_commit)
@ -554,4 +562,6 @@ TEST(subsurface_desync_commit)
wl_subcompositor_destroy(subco);
client_destroy(client);
return RESULT_OK;
}

View file

@ -136,6 +136,8 @@ TEST(test_subsurface_basic_protocol)
fini_compound_surface(&com1);
fini_compound_surface(&com2);
client_destroy(client);
return RESULT_OK;
}
TEST(test_subsurface_position_protocol)
@ -156,6 +158,8 @@ TEST(test_subsurface_position_protocol)
fini_compound_surface(&com);
client_destroy(client);
return RESULT_OK;
}
TEST(test_subsurface_placement_protocol)
@ -177,6 +181,8 @@ TEST(test_subsurface_placement_protocol)
fini_compound_surface(&com);
client_destroy(client);
return RESULT_OK;
}
TEST(test_subsurface_paradox)
@ -202,6 +208,8 @@ TEST(test_subsurface_paradox)
wl_surface_destroy(parent);
wl_subcompositor_destroy(subco);
client_destroy(client);
return RESULT_OK;
}
TEST(test_subsurface_identical_link)
@ -224,6 +232,8 @@ TEST(test_subsurface_identical_link)
wl_subsurface_destroy(sub);
fini_compound_surface(&com);
client_destroy(client);
return RESULT_OK;
}
TEST(test_subsurface_change_link)
@ -249,6 +259,8 @@ TEST(test_subsurface_change_link)
wl_subsurface_destroy(sub);
wl_surface_destroy(stranger);
client_destroy(client);
return RESULT_OK;
}
TEST(test_subsurface_nesting)
@ -273,6 +285,8 @@ TEST(test_subsurface_nesting)
wl_surface_destroy(stranger);
fini_compound_surface(&com);
client_destroy(client);
return RESULT_OK;
}
TEST(test_subsurface_nesting_parent)
@ -297,6 +311,8 @@ TEST(test_subsurface_nesting_parent)
fini_compound_surface(&com);
wl_surface_destroy(stranger);
client_destroy(client);
return RESULT_OK;
}
TEST(test_subsurface_loop_paradox)
@ -330,6 +346,8 @@ TEST(test_subsurface_loop_paradox)
wl_subcompositor_destroy(subco);
client_destroy(client);
return RESULT_OK;
}
TEST(test_subsurface_place_above_nested_parent)
@ -358,6 +376,8 @@ TEST(test_subsurface_place_above_nested_parent)
wl_subcompositor_destroy(subco);
fini_compound_surface(&com);
client_destroy(client);
return RESULT_OK;
}
TEST(test_subsurface_place_above_grandparent)
@ -388,6 +408,8 @@ TEST(test_subsurface_place_above_grandparent)
wl_subcompositor_destroy(subco);
fini_compound_surface(&com);
client_destroy(client);
return RESULT_OK;
}
TEST(test_subsurface_place_above_great_aunt)
@ -418,6 +440,8 @@ TEST(test_subsurface_place_above_great_aunt)
wl_subcompositor_destroy(subco);
fini_compound_surface(&com);
client_destroy(client);
return RESULT_OK;
}
TEST(test_subsurface_place_above_child)
@ -448,6 +472,8 @@ TEST(test_subsurface_place_above_child)
wl_subcompositor_destroy(subco);
fini_compound_surface(&com);
client_destroy(client);
return RESULT_OK;
}
TEST(test_subsurface_place_below_nested_parent)
@ -476,6 +502,8 @@ TEST(test_subsurface_place_below_nested_parent)
wl_subcompositor_destroy(subco);
fini_compound_surface(&com);
client_destroy(client);
return RESULT_OK;
}
TEST(test_subsurface_place_below_grandparent)
@ -506,6 +534,8 @@ TEST(test_subsurface_place_below_grandparent)
wl_subcompositor_destroy(subco);
fini_compound_surface(&com);
client_destroy(client);
return RESULT_OK;
}
TEST(test_subsurface_place_below_great_aunt)
@ -536,6 +566,8 @@ TEST(test_subsurface_place_below_great_aunt)
wl_subcompositor_destroy(subco);
fini_compound_surface(&com);
client_destroy(client);
return RESULT_OK;
}
TEST(test_subsurface_place_below_child)
@ -566,6 +598,8 @@ TEST(test_subsurface_place_below_child)
wl_subcompositor_destroy(subco);
fini_compound_surface(&com);
client_destroy(client);
return RESULT_OK;
}
TEST(test_subsurface_place_above_stranger)
@ -589,6 +623,8 @@ TEST(test_subsurface_place_above_stranger)
wl_surface_destroy(stranger);
fini_compound_surface(&com);
client_destroy(client);
return RESULT_OK;
}
TEST(test_subsurface_place_below_stranger)
@ -612,6 +648,8 @@ TEST(test_subsurface_place_below_stranger)
wl_surface_destroy(stranger);
fini_compound_surface(&com);
client_destroy(client);
return RESULT_OK;
}
TEST(test_subsurface_place_above_foreign)
@ -635,6 +673,8 @@ TEST(test_subsurface_place_above_foreign)
fini_compound_surface(&com1);
fini_compound_surface(&com2);
client_destroy(client);
return RESULT_OK;
}
TEST(test_subsurface_place_below_foreign)
@ -658,6 +698,8 @@ TEST(test_subsurface_place_below_foreign)
fini_compound_surface(&com1);
fini_compound_surface(&com2);
client_destroy(client);
return RESULT_OK;
}
TEST(test_subsurface_destroy_protocol)
@ -693,6 +735,8 @@ TEST(test_subsurface_destroy_protocol)
client_roundtrip(client);
client_destroy(client);
return RESULT_OK;
}
static void
@ -912,4 +956,6 @@ TEST(test_subsurface_destroy_permutations)
testlog("tried %d destroy permutations\n", counter);
client_destroy(client);
return RESULT_OK;
}

View file

@ -111,4 +111,6 @@ PLUGIN_TEST(surface_to_from_global)
/* Destroys all views too. */
weston_surface_unref(surface);
return RESULT_OK;
}

View file

@ -78,4 +78,6 @@ PLUGIN_TEST(surface_transform)
/* Destroys all views too. */
weston_surface_unref(surface);
return RESULT_OK;
}

View file

@ -242,4 +242,6 @@ TEST(text_test)
zwp_text_input_v1_destroy(text_input);
zwp_text_input_manager_v1_destroy(factory);
client_destroy(client);
return RESULT_OK;
}

View file

@ -40,6 +40,8 @@ TEST(test_timespec_sub)
timespec_sub(&r, &a, &b);
test_assert_u64_eq(r.tv_sec, 0);
test_assert_u64_eq(r.tv_nsec, NSEC_PER_SEC - 1);
return RESULT_OK;
}
TEST(test_timespec_to_nsec)
@ -49,6 +51,8 @@ TEST(test_timespec_to_nsec)
a.tv_sec = 4;
a.tv_nsec = 4;
test_assert_u64_eq(timespec_to_nsec(&a), (NSEC_PER_SEC * 4ULL) + 4);
return RESULT_OK;
}
TEST(test_timespec_to_usec)
@ -58,6 +62,8 @@ TEST(test_timespec_to_usec)
a.tv_sec = 4;
a.tv_nsec = 4000;
test_assert_u64_eq(timespec_to_usec(&a), (4000000ULL) + 4);
return RESULT_OK;
}
TEST(test_timespec_to_msec)
@ -67,6 +73,8 @@ TEST(test_timespec_to_msec)
a.tv_sec = 4;
a.tv_nsec = 4000000;
test_assert_u64_eq(timespec_to_msec(&a), (4000ULL) + 4);
return RESULT_OK;
}
TEST(test_timespec_to_proto)
@ -96,11 +104,15 @@ TEST(test_timespec_to_proto)
test_assert_u64_eq((uint64_t)a.tv_sec >> 32, tv_sec_hi);
test_assert_u64_eq(0x70005678, tv_sec_lo);
test_assert_u64_eq(1, tv_nsec);
return RESULT_OK;
}
TEST(test_millihz_to_nsec)
{
test_assert_u64_eq(millihz_to_nsec(60000), 16666666);
return RESULT_OK;
}
TEST(test_timespec_add_nsec)
@ -159,6 +171,8 @@ TEST(test_timespec_add_nsec)
timespec_add_nsec(&r, &r, (NSEC_PER_SEC * 7ULL) + (NSEC_PER_SEC - 1ULL));
test_assert_u64_eq(16, r.tv_sec);
test_assert_u64_eq(0, r.tv_nsec);
return RESULT_OK;
}
TEST(test_timespec_add_msec)
@ -170,6 +184,8 @@ TEST(test_timespec_add_msec)
timespec_add_msec(&r, &a, 2002);
test_assert_u64_eq(1002, r.tv_sec);
test_assert_u64_eq(2000001, r.tv_nsec);
return RESULT_OK;
}
TEST(test_timespec_sub_to_nsec)
@ -181,6 +197,8 @@ TEST(test_timespec_sub_to_nsec)
b.tv_sec = 1;
b.tv_nsec = 2;
test_assert_u64_eq((999LL * NSEC_PER_SEC) - 1, timespec_sub_to_nsec(&a, &b));
return RESULT_OK;
}
TEST(test_timespec_sub_to_msec)
@ -192,6 +210,8 @@ TEST(test_timespec_sub_to_msec)
b.tv_sec = 2;
b.tv_nsec = 1000000L;
test_assert_u64_eq((998 * 1000) + 1, timespec_sub_to_msec(&a, &b));
return RESULT_OK;
}
TEST(test_timespec_from_nsec)
@ -213,6 +233,8 @@ TEST(test_timespec_from_nsec)
timespec_from_nsec(&a, (5LL * NSEC_PER_SEC) + 1);
test_assert_u64_eq(5, a.tv_sec);
test_assert_u64_eq(1, a.tv_nsec);
return RESULT_OK;
}
TEST(test_timespec_from_usec)
@ -234,6 +256,8 @@ TEST(test_timespec_from_usec)
timespec_from_usec(&a, 5000001);
test_assert_u64_eq(5, a.tv_sec);
test_assert_u64_eq(1000, a.tv_nsec);
return RESULT_OK;
}
TEST(test_timespec_from_msec)
@ -255,6 +279,8 @@ TEST(test_timespec_from_msec)
timespec_from_msec(&a, 5001);
test_assert_u64_eq(5, a.tv_sec);
test_assert_u64_eq(1000000, a.tv_nsec);
return RESULT_OK;
}
TEST(test_timespec_from_proto)
@ -272,6 +298,8 @@ TEST(test_timespec_from_proto)
timespec_from_proto(&a, 0x1234, 0x5678, 1);
test_assert_u64_eq((time_t)0x0000123400005678LL, a.tv_sec);
test_assert_u64_eq(1, a.tv_nsec);
return RESULT_OK;
}
TEST(test_timespec_is_zero)
@ -283,6 +311,8 @@ TEST(test_timespec_is_zero)
test_assert_true(timespec_is_zero(&zero));
test_assert_false(timespec_is_zero(&non_zero_nsec));
test_assert_false(timespec_is_zero(&non_zero_sec));
return RESULT_OK;
}
TEST(test_timespec_eq)
@ -295,4 +325,6 @@ TEST(test_timespec_eq)
test_assert_false(timespec_eq(&a, &b));
test_assert_false(timespec_eq(&b, &a));
return RESULT_OK;
}

View file

@ -103,6 +103,8 @@ TEST(broken_touch_event)
input_timestamps_destroy(input_ts);
client_destroy(client);
return RESULT_OK;
}
TEST(touch_events)
@ -127,6 +129,8 @@ TEST(touch_events)
input_timestamps_destroy(input_ts);
client_destroy(client);
return RESULT_OK;
}
TEST(touch_timestamps_stop_after_input_timestamps_object_is_destroyed)
@ -147,6 +151,8 @@ TEST(touch_timestamps_stop_after_input_timestamps_object_is_destroyed)
test_assert_true(timespec_is_zero(&touch->up_time_timespec));
client_destroy(client);
return RESULT_OK;
}
TEST(touch_timestamps_stop_after_client_releases_wl_touch)
@ -176,4 +182,6 @@ TEST(touch_timestamps_stop_after_client_releases_wl_touch)
free(client->input->touch);
client->input->touch = NULL;
client_destroy(client);
return RESULT_OK;
}

View file

@ -704,6 +704,8 @@ TEST_P(quad_clip_expected, quad_clip_expected_data)
clipped_n = clipper_quad_clip(&quad, tdata->box, clipped);
assert_vertices(clipped, clipped_n, tdata->clipped, tdata->clipped_n);
return RESULT_OK;
}
/* clipper_quad_clip_box32() tests: */
@ -757,6 +759,8 @@ TEST_P(quad_clip_box32_expected, quad_clip_box32_expected_data)
clipped_n = clipper_quad_clip_box32(&quad, &tdata->box32, clipped);
assert_vertices(clipped, clipped_n, tdata->clipped, tdata->clipped_n);
return RESULT_OK;
}
/* clipper_float_difference() tests: */
@ -764,9 +768,13 @@ TEST_P(quad_clip_box32_expected, quad_clip_box32_expected_data)
TEST(float_difference_different)
{
test_assert_f32_eq(clipper_float_difference(1.0f, 0.0f), 1.0f);
return RESULT_OK;
}
TEST(float_difference_same)
{
test_assert_f32_eq(clipper_float_difference(1.0f, 1.0f), 0.0f);
return RESULT_OK;
}

View file

@ -98,4 +98,6 @@ TEST(viewport_upscale_solid)
wp_viewport_destroy(viewport);
client_destroy(client);
return RESULT_OK;
}

View file

@ -76,6 +76,8 @@ TEST(test_viewporter_double_create)
wp_viewport_destroy(vp[0]);
wp_viewporter_destroy(viewporter);
client_destroy(client);
return RESULT_OK;
}
struct bad_source_rect_args {
@ -112,6 +114,8 @@ TEST_P(test_viewporter_bad_source_rect, bad_source_rect_args)
wp_viewport_destroy(vp);
client_destroy(client);
return RESULT_OK;
}
TEST(test_viewporter_unset_source_rect)
@ -129,6 +133,8 @@ TEST(test_viewporter_unset_source_rect)
wp_viewport_destroy(vp);
client_destroy(client);
return RESULT_OK;
}
struct bad_destination_args {
@ -162,6 +168,8 @@ TEST_P(test_viewporter_bad_destination_size, bad_destination_args)
wp_viewport_destroy(vp);
client_destroy(client);
return RESULT_OK;
}
TEST(test_viewporter_unset_destination_size)
@ -179,6 +187,8 @@ TEST(test_viewporter_unset_destination_size)
wp_viewport_destroy(vp);
client_destroy(client);
return RESULT_OK;
}
struct nonint_destination_args {
@ -216,6 +226,8 @@ TEST_P(test_viewporter_non_integer_destination_size, nonint_destination_args)
wp_viewport_destroy(vp);
client_destroy(client);
return RESULT_OK;
}
struct source_buffer_args {
@ -330,6 +342,8 @@ TEST(test_viewporter_source_buffer_params)
test_assert_int_lt(WIN_H / max_scale + SRC_H + MRG, WIN_H);
test_assert_int_lt(WIN_W / max_scale + SRC_H + MRG, WIN_W);
test_assert_int_lt(WIN_H / max_scale + SRC_W + MRG, WIN_H);
return RESULT_OK;
}
static const struct source_buffer_args bad_source_buffer_args[] = {
@ -401,6 +415,8 @@ TEST_P(test_viewporter_source_outside_buffer, bad_source_buffer_args)
wp_viewport_destroy(vp);
client_destroy(client);
return RESULT_OK;
}
static const struct source_buffer_args good_source_buffer_args[] = {
@ -457,6 +473,8 @@ TEST_P(test_viewporter_source_inside_buffer, good_source_buffer_args)
vp = setup_source_vs_buffer(client, args);
wp_viewport_destroy(vp);
client_destroy(client);
return RESULT_OK;
}
#undef WIN_W
@ -500,6 +518,8 @@ TEST(test_viewporter_outside_null_buffer)
wp_viewport_destroy(vp);
client_destroy(client);
return RESULT_OK;
}
TEST(test_viewporter_no_surface_set_source)
@ -520,6 +540,8 @@ TEST(test_viewporter_no_surface_set_source)
wp_viewport_destroy(vp);
client_destroy(client);
return RESULT_OK;
}
TEST(test_viewporter_no_surface_set_destination)
@ -540,6 +562,8 @@ TEST(test_viewporter_no_surface_set_destination)
wp_viewport_destroy(vp);
client_destroy(client);
return RESULT_OK;
}
TEST(test_viewporter_no_surface_destroy)
@ -556,4 +580,6 @@ TEST(test_viewporter_no_surface_destroy)
wp_viewport_destroy(vp);
client_destroy(client);
return RESULT_OK;
}

View file

@ -1,5 +1,6 @@
/*
* Copyright © 2012 Intel Corporation
* Copyright 2025 Collabora, Ltd.
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
@ -174,6 +175,7 @@ run_test(struct wet_testsuite_data *suite_data, int fixture_nr,
int iteration)
{
struct weston_test_run_info info;
enum test_result_code ret;
if (data) {
snprintf(info.name, sizeof(info.name), "%s-f%02d-e%02d",
@ -187,10 +189,10 @@ run_test(struct wet_testsuite_data *suite_data, int fixture_nr,
weston_assert_counter_reset();
test_run_info_ = &info;
t->run(suite_data, data);
ret = t->run(suite_data, data);
test_run_info_ = NULL;
return weston_assert_counter_get() ? RESULT_FAIL: RESULT_OK;
return weston_assert_counter_get() ? RESULT_FAIL : ret;
}
static void

View file

@ -1,6 +1,7 @@
/*
* Copyright © 2012 Intel Corporation
* Copyright © 2013 Sam Spilsbury <smspillaz@gmail.com>
* Copyright 2025 Collabora, Ltd.
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
@ -54,20 +55,23 @@ struct weston_test_harness;
*/
struct weston_test_entry {
const char *name;
void (*run)(struct wet_testsuite_data *, void *);
enum test_result_code (*run)(struct wet_testsuite_data *, void *);
const void *table_data;
size_t element_size;
int n_elements;
} __attribute__ ((aligned (64)));
#define TEST_BEGIN(name, arg) \
static void name(struct wet_testsuite_data *_wet_suite_data, arg)
static enum test_result_code \
name(struct wet_testsuite_data *_wet_suite_data, arg)
#define TEST_BEGIN_NO_ARG(name) \
static void name(struct wet_testsuite_data *_wet_suite_data)
static enum test_result_code \
name(struct wet_testsuite_data *_wet_suite_data)
#define TEST_COMMON(func, name, data, size, n_elem) \
static void func(struct wet_testsuite_data *, void *); \
static enum test_result_code \
func(struct wet_testsuite_data *, void *); \
\
const struct weston_test_entry test##name \
__attribute__ ((used, section ("test_section"))) = \
@ -77,12 +81,14 @@ struct weston_test_entry {
#define NO_ARG_TEST(name) \
TEST_COMMON(wrap##name, name, NULL, 0, 1) \
static void name(struct wet_testsuite_data *); \
static void wrap##name(struct wet_testsuite_data *_wet_suite_data,\
void *data) \
static enum test_result_code \
name(struct wet_testsuite_data *); \
static enum test_result_code \
wrap##name(struct wet_testsuite_data *_wet_suite_data, \
void *data) \
{ \
(void) data; \
name(_wet_suite_data); \
return name(_wet_suite_data); \
} \
\
TEST_BEGIN_NO_ARG(name)
@ -91,7 +97,7 @@ struct weston_test_entry {
TEST_COMMON(name, name, test_data, \
sizeof(test_data[0]), \
ARRAY_LENGTH(test_data)) \
TEST_BEGIN(name, void *data) \
TEST_BEGIN(name, void *data)
/** Add a test with no parameters
*
@ -137,12 +143,13 @@ struct weston_test_entry {
*/
#define PLUGIN_TEST(name) \
TEST_COMMON(wrap##name, name, NULL, 0, 1) \
static void name(struct wet_testsuite_data *, \
struct weston_compositor *); \
static void wrap##name(struct wet_testsuite_data *_wet_suite_data,\
void *compositor) \
static enum test_result_code name(struct wet_testsuite_data *, \
struct weston_compositor *); \
static enum test_result_code \
wrap##name(struct wet_testsuite_data *_wet_suite_data, \
void *compositor) \
{ \
name(_wet_suite_data, compositor); \
return name(_wet_suite_data, compositor); \
} \
TEST_BEGIN(name, struct weston_compositor *compositor)

View file

@ -177,4 +177,6 @@ TEST(xwayland_client_test)
destroy_x11_window(window);
destroy_x11_connection(conn);
return RESULT_OK;
}