tests/kms_writeback: Test cleanup
cover tests/kms_writeback: Test cleanup
*** BLURB HERE ***
Nidhi Gupta (2):
tests/kms_writeback: Convert tests to dynamic
tests/kms_writeback: Test cleanup
tests/kms_writeback.c | 59 ++++++++++++++++++++++++++++++++----------- 1 file changed, 44 insertions(+), 15 deletions(-)
Signature · 1 line
2.36.0
PATCH 1/2 tests/kms_writeback: Convert tests to dynamic
Convert the existing subtests to dynamic subtests.
--- tests/kms_writeback.c | 57 +++++++++++++++++++++++++++++++------------ 1 file changed, 42 insertions(+), 15 deletions(-)
tests/kms_writeback.c +42 -15
@@ -214,32 +214,38 @@ static void test_invalid_parameters(igt_output_t *output, igt_fb_t *valid_fb, iguint32_t fb_id;bool ptr_valid;int32_t *out_fence_ptr; +const char *name; } invalid_tests[] = { { /* No output buffer, but the WRITEBACK_OUT_FENCE_PTR set. */ .fb_id = 0, .ptr_valid = true, .out_fence_ptr = &out_fence, + .name = "WRITEBACK_OUT_FENCE_PTR-set", }, { /* Invalid output buffer. */ .fb_id = invalid_fb->fb_id, .ptr_valid = true, .out_fence_ptr = &out_fence, + .name = "Invalid-output-buffer", }, { /* Invalid WRITEBACK_OUT_FENCE_PTR. */ .fb_id = valid_fb->fb_id, .ptr_valid = false, .out_fence_ptr = (int32_t *)0x8, + .name = "Invalid-WRITEBACK_OUT_FENCE_PTR", }, }; for (i = 0; i < ARRAY_SIZE(invalid_tests); i++) { - ret = do_writeback_test(output, invalid_tests[i].fb_id, - invalid_tests[i].out_fence_ptr, - invalid_tests[i].ptr_valid); - igt_assert(ret != 0); + igt_dynamic_f("%s", invalid_tests[i].name) { + ret = do_writeback_test(output, invalid_tests[i].fb_id, + invalid_tests[i].out_fence_ptr, + invalid_tests[i].ptr_valid); + igt_assert(ret != 0); + } } }
@@ -247,18 +253,39 @@ static void writeback_fb_id(igt_output_t *output, igt_fb_t *valid_fb, igt_fb_t * {int ret; +struct { +const char *name; +uint32_t fb_id; +int i, expected_ret; + } fb_id_tests[] = { -/* Invalid object for WRITEBACK_FB_ID */ - ret =do_writeback_test (output, output->id,NULL , false); -igt_assert (ret == -EINVAL ); + { + .name ="Invalid-object" , + .fb_id = output->id, + .expected_ret = -EINVAL , + }, + + { + .name ="Zero-WRITEBACK_FB_ID" , + .fb_id =0 , + .expected_ret =0 , + }, + + { + .name ="Valid-output-buffer" , + .fb_id = valid_fb->fb_id, + .expected_ret =0 , + }, + }; + +for (int i =0 ; i <ARRAY_SIZE (fb_id_tests); i++) { + igt_dynamic_f("%s", fb_id_tests[i].name) { + ret =do_writeback_test (output, fb_id_tests[i].fb_id,NULL , false); +igt_assert (ret == fb_id_tests[i].expected_ret); + } + } -/* Zero WRITEBACK_FB_ID */ - ret =do_writeback_test (output,0 ,NULL , false); -igt_assert (ret ==0 ); -/* Valid output buffer */ - ret =do_writeback_test (output, valid_fb->fb_id,NULL , false); -igt_assert (ret ==0 ); }static void fill_fb (igt_fb_t *fb,uint32_t pixel)
@@ -553,7 +580,7 @@ igt_main_args("b:c:dl", long_options, help_str, opt_handler, NULL)igt_describe ("Writeback has a couple of parameters linked together" "(output framebuffer and fence); this test goes through" "the combination of possible bad options" ); - igt_subtest("writeback-invalid-parameters") { + igt_subtest_with_dynamic("writeback-invalid-parameters") {igt_fb_t invalid_output_fb;igt_skip_on (data.dump_check || data.list_modes);
@@ -570,7 +597,7 @@ igt_main_args("b:c:dl", long_options, help_str, opt_handler, NULL) }igt_describe ("Validate WRITEBACK_FB_ID with valid and invalid options" ); - igt_subtest("writeback-fb-id") { + igt_subtest_with_dynamic("writeback-fb-id") {igt_fb_t output_fb;igt_skip_on (data.dump_check || data.list_modes);
Signature · 1 line
2.36.0
Re: [igt-dev] [PATCH 1/2] tests/kms_writeback: Convert tests to dynamic
Quoted 13 lines · Nidhi Gupta
Convert the existing subtests to dynamic subtests.
Signed-off-by Nidhi Gupta <[email protected]>--- tests/kms_writeback.c | 57 +++++++++++++++++++++++++++++++------------ 1 file changed, 42 insertions(+), 15 deletions(-)tests/kms_writeback.c +0
-0@@ -214,32 +214,38 @@ static void test_invalid_parameters(igt_output_t *output, igt_fb_t *valid_fb, iguint32_t fb_id;
tests/kms_writeback.c static void test_invalid_parameters(igt_output_t *output, igt_fb_t *valid_fb, ig · line 224
Quoted 10 lines
tests/kms_writeback.c +2
-0bool ptr_valid;int32_t *out_fence_ptr; +const char *name; } invalid_tests[] = { {/* No output buffer, but the WRITEBACK_OUT_FENCE_PTR set. */ .fb_id = 0, .ptr_valid = true, .out_fence_ptr = &out_fence, + .name = "WRITEBACK_OUT_FENCE_PTR-set",
Please avoid mixed case, also use "-" instead of "_".
This comment is applicable to all places.
Quoted 40 lines
tests/kms_writeback.c +13
-4}, {/* Invalid output buffer. */ .fb_id = invalid_fb->fb_id, .ptr_valid = true, .out_fence_ptr = &out_fence, + .name = "Invalid-output-buffer", }, {/* Invalid WRITEBACK_OUT_FENCE_PTR. */ .fb_id = valid_fb->fb_id, .ptr_valid = false, .out_fence_ptr = (int32_t *)0x8, + .name = "Invalid-WRITEBACK_OUT_FENCE_PTR", }, };for (i =0 ; i <ARRAY_SIZE (invalid_tests); i++) { - ret =do_writeback_test (output, invalid_tests[i].fb_id, - invalid_tests[i].out_fence_ptr, - invalid_tests[i].ptr_valid); -igt_assert (ret !=0 ); + igt_dynamic_f("%s", invalid_tests[i].name) { + ret =do_writeback_test (output, invalid_tests[i].fb_id, + invalid_tests[i].out_fence_ptr, + invalid_tests[i].ptr_valid); +igt_assert (ret !=0 ); + } } }@@ -247,18 +253,39 @@ static void writeback_fb_id(igt_output_t *output, igt_fb_t *valid_fb, igt_fb_t * {int ret; +struct { +const char *name; +uint32_t fb_id; +int i, expected_ret; + } fb_id_tests[] = {
tests/kms_writeback.c static void writeback_fb_id(igt_output_t *output, igt_fb_t *valid_fb, igt_fb_t * · line 267
Quoted 10 lines
tests/kms_writeback.c +6
-3-/* Invalid object for WRITEBACK_FB_ID */ - ret =do_writeback_test (output, output->id,NULL , false); -igt_assert (ret == -EINVAL ); + { + .name = "Invalid-object", + .fb_id = output->id, + .expected_ret = -EINVAL, + }, +
Newlines are not required.
Quoted 48 lines
tests/kms_writeback.c +21
-8+ { + .name = "Zero-WRITEBACK_FB_ID", + .fb_id = 0, + .expected_ret = 0, + }, + + { + .name = "Valid-output-buffer", + .fb_id = valid_fb->fb_id, + .expected_ret = 0, + }, + }; + +for (int i =0 ; i <ARRAY_SIZE (fb_id_tests); i++) { + igt_dynamic_f("%s", fb_id_tests[i].name) { + ret =do_writeback_test (output, fb_id_tests[i].fb_id,NULL , false); +igt_assert (ret == fb_id_tests[i].expected_ret); + } + } -/* Zero WRITEBACK_FB_ID */ - ret =do_writeback_test (output,0 ,NULL , false); -igt_assert (ret ==0 ); -/* Valid output buffer */ - ret =do_writeback_test (output, valid_fb->fb_id,NULL , false); -igt_assert (ret ==0 ); }static void fill_fb (igt_fb_t *fb,uint32_t pixel)@@ -553,7 +580,7 @@ igt_main_args("b:c:dl", long_options, help_str, opt_handler, NULL)igt_describe ("Writeback has a couple of parameters linked together" "(output framebuffer and fence); this test goes through" "the combination of possible bad options" ); - igt_subtest("writeback-invalid-parameters") { + igt_subtest_with_dynamic("writeback-invalid-parameters") {igt_fb_t invalid_output_fb;igt_skip_on (data.dump_check || data.list_modes);@@ -570,7 +597,7 @@ igt_main_args("b:c:dl", long_options, help_str, opt_handler, NULL) }igt_describe ("Validate WRITEBACK_FB_ID with valid and invalid options" ); - igt_subtest("writeback-fb-id") { + igt_subtest_with_dynamic("writeback-fb-id") {igt_fb_t output_fb;igt_skip_on (data.dump_check || data.list_modes);
PATCH 2/2 tests/kms_writeback: Test cleanup
In reply to Nidhi GuptaSanitize the system state before starting the subtest.
--- tests/kms_writeback.c | 2 ++ 1 file changed, 2 insertions(+)
tests/kms_writeback.c +2 -0
@@ -521,6 +521,8 @@ igt_main_args("b:c:dl", long_options, help_str, opt_handler, NULL)kmstest_set_vt_graphics_mode (); +igt_display_reset (display); +igt_display_require (&display, display.drm_fd);igt_require (display.is_atomic);
Signature · 1 line
2.36.0
Quoted 12 lines · Nidhi Gupta
Sanitize the system state before starting the subtest.
Signed-off-by Nidhi Gupta <[email protected]>--- tests/kms_writeback.c | 2 ++ 1 file changed, 2 insertions(+)tests/kms_writeback.c +0
-0
tests/kms_writeback.c igt_main_args("b:c:dl", long_options, help_str, opt_handler, NULL) · line 526
Quoted 6 lines
tests/kms_writeback.c +2
-0@@ -521,6 +521,8 @@ igt_main_args("b:c:dl", long_options, help_str, opt_handler, NULL)kmstest_set_vt_graphics_mode (); +igt_display_reset (display); +igt_display_require (&display, display.drm_fd);
Please drop this I can see igt_display_require() is already present.
https://cgit.freedesktop.org/drm/igt-gpu-tools/tree/tests/kms_writeback.c#n493
Found some other cleanups:
Example:
https://cgit.freedesktop.org/drm/igt-gpu-tools/tree/tests/kms_writeback.c#n113
https://cgit.freedesktop.org/drm/igt-gpu-tools/tree/tests/kms_writeback.c#n144
Why do we need hard-coded values for override_mode? Can't we use default mode?
https://cgit.freedesktop.org/drm/igt-gpu-tools/tree/tests/kms_writeback.c#n536
https://cgit.freedesktop.org/drm/igt-gpu-tools/tree/tests/kms_writeback.c#n559
https://cgit.freedesktop.org/drm/igt-gpu-tools/tree/tests/kms_writeback.c#n576
https://cgit.freedesktop.org/drm/igt-gpu-tools/tree/tests/kms_writeback.c#n592
As this check is common in all subtests, please move this to igt_fixture
- Bhanu
Quoted 2 lines
tests/kms_writeback.c +0
-0igt_require (display.is_atomic);
Patchwork
CI[igt-dev] ✗ Fi.CI.BUILD: failure for tests/kms_writeback: Test Cleanup (rev3)
In reply to Nidhi Gupta== Series Details ==
== Series Details ==
Series: tests/kms_writeback: Test Cleanup (rev3)
URL : https://patchwork.freedesktop.org/series/107764/
State : failure
== Summary ==
IGT patchset build failed on latest successful build 129bea58b9424f0a0da995311a219fdf57732594 kms_flip_event_leak: Create dynamic subtests
[325/672] Linking target tests/kms_dp_aux_dev
[326/672] Linking target tests/kms_display_modes
[327/672] Linking target tests/kms_flip
[328/672] Linking target tests/kms_dp_tiled_display
[329/672] Linking target tests/kms_invalid_mode
[330/672] Linking target tests/kms_hdmi_inject
[331/672] Linking target tests/kms_flip_event_leak
[332/672] Linking target benchmarks/gem_blt
[333/672] Linking target benchmarks/gem_busy
[334/672] Linking target tests/kms_getfb
[335/672] Linking target tests/kms_hdr
[336/672] Linking target tests/kms_dsc
[337/672] Linking target tests/gen3_render_tiledy_blits
[338/672] Linking target tests/kms_lease
[339/672] Linking target tests/kms_multipipe_modeset
[340/672] Linking target tests/kms_panel_fitting
[341/672] Linking target tests/kms_pipe_crc_basic
[342/672] Linking target tests/kms_plane_cursor
[343/672] Linking target tests/kms_plane
[344/672] Linking target tests/kms_plane_alpha_blend
[345/672] Linking target tests/kms_plane_lowres
[346/672] Linking target tests/kms_plane_scaling
[347/672] Linking target tests/kms_plane_multiple
[348/672] Linking target tests/kms_prop_blob
[349/672] Linking target tests/kms_prime
[350/672] Linking target tests/kms_rotation_crc
[351/672] Linking target tests/kms_properties
[352/672] Linking target tests/kms_rmfb
[353/672] Linking target tests/kms_scaling_modes
[354/672] Linking target tests/kms_selftest
[355/672] Linking target tests/kms_sequence
[356/672] Linking target tests/kms_vrr
[357/672] Linking target tests/kms_setmode
[358/672] Linking target tests/kms_sysfs_edid_timing
[359/672] Linking target tests/kms_tv_load_detect
[360/672] Linking target tests/kms_universal_plane
[361/672] Linking target tests/kms_vblank
[362/672] Compiling C object tests/kms_writeback.p/kms_writeback.c.o
FAILED: tests/kms_writeback.p/kms_writeback.c.o
ccache cc -Itests/kms_writeback.p -Itests -I../tests -I../include/drm-uapi -I../include/linux-uapi -Ilib -I../lib -I../lib/stubs/syscalls -I. -I.. -I/usr/include/cairo -I/usr/include/glib-2.0 -I/usr/lib/x86_64-linux-gnu/glib-2.0/include -I/usr/include/pixman-1 -I/usr/include/freetype2 -I/usr/include/libpng16 -I/usr/include/libpng12 -I/usr/include/libdrm -I/usr/include/libdrm/nouveau -I/usr/include/x86_64-linux-gnu -I/usr/include/alsa -I/usr/include -I/home/cidrm/kernel_headers/include -fdiagnostics-color=always -D_FILE_OFFSET_BITS=64 -Wall -Winvalid-pch -Wextra -std=gnu11 -O2 -g -D_GNU_SOURCE -include config.h -D_FORTIFY_SOURCE=2 -Wbad-function-cast -Wdeclaration-after-statement -Wformat=2 -Wimplicit-fallthrough=0 -Wlogical-op -Wmissing-declarations -Wmissing-format-attribute -Wmissing-noreturn -Wmissing-prototypes -Wnested-externs -Wold-style-definition -Wpointer-arith -Wredundant-decls -Wshadow -Wstrict-prototypes -Wuninitialized -Wunused -Wno-clobbered -Wno-maybe-uninitialized -Wno-missing-field-initializers -Wno-pointer-arith -Wno-sign-compare -Wno-type-limits -Wno-unused-parameter -Wno-unused-result -Werror=address -Werror=array-bounds -Werror=implicit -Werror=init-self -Werror=int-to-pointer-cast -Werror=main -Werror=missing-braces -Werror=nonnull -Werror=pointer-to-int-cast -Werror=return-type -Werror=sequence-point -Werror=trigraphs -Werror=write-strings -fno-builtin-malloc -fno-builtin-calloc -fcommon -pthread -MD -MQ tests/kms_writeback.p/kms_writeback.c.o -MF tests/kms_writeback.p/kms_writeback.c.o.d -o tests/kms_writeback.p/kms_writeback.c.o -c ../tests/kms_writeback.c ../tests/kms_writeback.c: In function ‘__igt_unique____real_main507’:../tests/kms_writeback.c:524:21: error: incompatible type for argument 1 of ‘igt_display_reset’
igt_display_reset(display);
^~~~~~~
In file included from ../lib/igt.h:38,
from ../tests/kms_writeback.c:31:
../lib/igt_kms.h:455:39: note: expected ‘igt_display_t *’ {aka ‘struct igt_display *’} but argument is of type ‘igt_display_t’ {aka ‘struct igt_display’}
void igt_display_reset(igt_display_t *display);
~~~~~~~~~~~~~~~^~~~~~~ninja: build stopped: subcommand failed.