On Tue, Jan 18, 2022 at 12:22:49AM +0100, Michał Winiarski wrote: > KUnit unifies the test structure and provides helper tools that simplify > the development. Basic use case allows running tests as regular processes, > leveraging User Mode Linux. > For example, to execute all DRM unit tests: > ./tools/testing/kunit/kunit.py run --kunitconfig=drivers/gpu/drm > (the tool also allows using QEMU instead of UML by adding e.g. --arch=x86_64) > > For developers - it means that it's easier to run unit tests on the development > machine, tightening the feedback loop. When using UML, it also simplifies using > gdb for debug (since the kernel is just a regular process). > For CI systems - DRM tests can be moved from being executed on device under > test (that's also running IGTs and so on) to being executed on buildsystem > during build (just like checkpatch.pl). > > All tests were renamed - IGT prefix is no longer used. > > Compared to selftests executed by CI using IGT, there's one functional > regression - KUnit test runner is not catching WARNs. > To solve this, we could either go in the similar direction that UBSAN went in: > 1195505 ("kunit: ubsan integration") > Or we could expand the test runner to catch WARN signature in dmesg. I think catching WARN signature in dmesg makes sense, assuming Kunit has a standard WARN format. It would be nice to be consistent here. I haven't looked at any details, but yes so much I want to see this done. I'll cc a bunch of people I've talked with about this conversion, hopefully I got them all. Maybe they can help with review and getting this all landed! Cheers, Daniel > Pastebin to preview the output and execution times: > https://gitlab.freedesktop.org/-/snippets/4139 > > -Michał > > Michał Winiarski (10): > drm: test-drm_cmdline_parser: Convert to KUnit > drm: test-drm_plane_helper: Convert to KUnit > drm: test-drm_format: Convert to KUnit > drm: test-drm_framebuffer: Convert to KUnit > drm: test-drm_damage_helper: Convert to KUnit > drm: test-drm_dp_mst_helper: Convert to KUnit > drm: test-drm_rect: Convert to KUnit > drm: test-drm_mm: Convert to KUnit > drm: selftests: Convert to KUnit > drm: test: Simplify testing on UML with kunit.py > > drivers/gpu/drm/.kunitconfig | 3 + > drivers/gpu/drm/Kconfig | 22 +- > drivers/gpu/drm/Makefile | 2 +- > drivers/gpu/drm/i915/Kconfig.debug | 1 - > drivers/gpu/drm/selftests/Makefile | 7 - > .../gpu/drm/selftests/drm_cmdline_selftests.h | 68 - > drivers/gpu/drm/selftests/drm_mm_selftests.h | 28 - > .../gpu/drm/selftests/drm_modeset_selftests.h | 40 - > drivers/gpu/drm/selftests/drm_selftest.c | 109 - > drivers/gpu/drm/selftests/drm_selftest.h | 41 - > .../drm/selftests/test-drm_cmdline_parser.c | 1141 -------- > .../drm/selftests/test-drm_damage_helper.c | 667 ----- > .../drm/selftests/test-drm_dp_mst_helper.c | 273 -- > drivers/gpu/drm/selftests/test-drm_format.c | 280 -- > drivers/gpu/drm/selftests/test-drm_mm.c | 2487 ----------------- > .../drm/selftests/test-drm_modeset_common.c | 32 - > .../drm/selftests/test-drm_modeset_common.h | 52 - > .../gpu/drm/selftests/test-drm_plane_helper.c | 223 -- > drivers/gpu/drm/selftests/test-drm_rect.c | 223 -- > drivers/gpu/drm/test/Makefile | 7 + > .../gpu/drm/test/test-drm_cmdline_parser.c | 1027 +++++++ > drivers/gpu/drm/test/test-drm_damage_helper.c | 667 +++++ > drivers/gpu/drm/test/test-drm_dp_mst_helper.c | 429 +++ > drivers/gpu/drm/test/test-drm_format.c | 356 +++ > .../test-drm_framebuffer.c | 109 +- > drivers/gpu/drm/test/test-drm_mm.c | 2426 ++++++++++++++++ > drivers/gpu/drm/test/test-drm_plane_helper.c | 312 +++ > drivers/gpu/drm/test/test-drm_rect.c | 249 ++ > drivers/video/Kconfig | 4 + > 29 files changed, 5558 insertions(+), 5727 deletions(-) > create mode 100644 drivers/gpu/drm/.kunitconfig > delete mode 100644 drivers/gpu/drm/selftests/Makefile > delete mode 100644 drivers/gpu/drm/selftests/drm_cmdline_selftests.h > delete mode 100644 drivers/gpu/drm/selftests/drm_mm_selftests.h > delete mode 100644 drivers/gpu/drm/selftests/drm_modeset_selftests.h > delete mode 100644 drivers/gpu/drm/selftests/drm_selftest.c > delete mode 100644 drivers/gpu/drm/selftests/drm_selftest.h > delete mode 100644 drivers/gpu/drm/selftests/test-drm_cmdline_parser.c > delete mode 100644 drivers/gpu/drm/selftests/test-drm_damage_helper.c > delete mode 100644 drivers/gpu/drm/selftests/test-drm_dp_mst_helper.c > delete mode 100644 drivers/gpu/drm/selftests/test-drm_format.c > delete mode 100644 drivers/gpu/drm/selftests/test-drm_mm.c > delete mode 100644 drivers/gpu/drm/selftests/test-drm_modeset_common.c > delete mode 100644 drivers/gpu/drm/selftests/test-drm_modeset_common.h > delete mode 100644 drivers/gpu/drm/selftests/test-drm_plane_helper.c > delete mode 100644 drivers/gpu/drm/selftests/test-drm_rect.c > create mode 100644 drivers/gpu/drm/test/Makefile > create mode 100644 drivers/gpu/drm/test/test-drm_cmdline_parser.c > create mode 100644 drivers/gpu/drm/test/test-drm_damage_helper.c > create mode 100644 drivers/gpu/drm/test/test-drm_dp_mst_helper.c > create mode 100644 drivers/gpu/drm/test/test-drm_format.c > rename drivers/gpu/drm/{selftests => test}/test-drm_framebuffer.c (91%) > create mode 100644 drivers/gpu/drm/test/test-drm_mm.c > create mode 100644 drivers/gpu/drm/test/test-drm_plane_helper.c > create mode 100644 drivers/gpu/drm/test/test-drm_rect.c > > -- > 2.34.1 > -- Daniel Vetter Software Engineer, Intel Corporation http://blog.ffwll.ch