[0/3] Add KUnit support for i915 mock selftests

Message ID cover.1669897668.git.mchehab@kernel.org
Headers
Series Add KUnit support for i915 mock selftests |

Message

Mauro Carvalho Chehab Dec. 1, 2022, 12:32 p.m. UTC
  That's an updated version of my previous KUnit RFC series:
	https://patchwork.freedesktop.org/series/110481/

While the RFC series added support for live and perf, let's start with
mock, as running tests in bare metal is not the current focus of KUnit.
So, basically patch 1 was changed to export just mock functions,
and the bare metal patches got removed from this version.

As before, running KUnit on i915 driver requires the --arch parameter:

./tools/testing/kunit/kunit.py run --arch=x86_64 --kunitconfig=drivers/gpu/drm/i915/selftests/  --jobs=`nproc --all`
[13:18:40] Configuring KUnit Kernel ...
[13:18:40] Building KUnit Kernel ...
Populating config with:
$ make ARCH=x86_64 O=.kunit olddefconfig
Building with:
$ make ARCH=x86_64 O=.kunit --jobs=8
[13:23:20] Starting KUnit Kernel (1/1)...
[13:23:20] ============================================================
Running tests with:
$ qemu-system-x86_64 -nodefaults -m 1024 -kernel .kunit/arch/x86/boot/bzImage -append 'kunit.enable=1 console=ttyS0 kunit_shutdown=reboot' -no-reboot -nographic -serial stdio
[13:23:21] ============ i915 mock selftests (18 subtests) =============
[13:23:21] [PASSED] mock_sanitycheck
[13:23:21] [PASSED] mock_shmem
[13:23:24] [PASSED] mock_fence
[13:23:25] [PASSED] mock_scatterlist
[13:23:27] [PASSED] mock_syncmap
[13:23:27] [PASSED] mock_uncore
[13:23:27] [PASSED] mock_ring
[13:23:27] [PASSED] mock_engine
[13:23:31] [PASSED] mock_timelines
[13:23:32] [PASSED] mock_requests
[13:23:32] [PASSED] mock_objects
[13:23:32] [PASSED] mock_phys
[13:23:32] [PASSED] mock_dmabuf
[13:23:38] [PASSED] mock_vma
[13:23:38] [PASSED] mock_evict
[13:23:41] [PASSED] mock_gtt
[13:23:42] [PASSED] mock_hugepages
[13:23:42] [PASSED] mock_memory_region
[13:23:42] =============== [PASSED] i915 mock selftests ===============
[13:23:42] ============================================================
[13:23:42] Testing complete. Ran 18 tests: passed: 18
[13:23:42] Elapsed time: 302.766s total, 0.003s configuring, 280.393s building, 22.341s running

Mauro Carvalho Chehab (3):
  drm/i915: place selftest preparation on a separate function
  drm/i915: export all mock selftest functions
  drm/i915: allow running mock selftests via Kunit

 drivers/gpu/drm/i915/Kconfig                  | 15 +++
 drivers/gpu/drm/i915/Makefile                 |  5 +
 .../gpu/drm/i915/gem/selftests/huge_pages.c   |  1 +
 .../drm/i915/gem/selftests/i915_gem_dmabuf.c  |  1 +
 .../drm/i915/gem/selftests/i915_gem_object.c  |  1 +
 .../drm/i915/gem/selftests/i915_gem_phys.c    |  1 +
 drivers/gpu/drm/i915/gt/selftest_engine_cs.c  |  1 +
 drivers/gpu/drm/i915/gt/selftest_ring.c       |  1 +
 drivers/gpu/drm/i915/gt/selftest_timeline.c   |  1 +
 drivers/gpu/drm/i915/gt/st_shmem_utils.c      |  1 +
 drivers/gpu/drm/i915/i915_selftest.h          |  2 +
 drivers/gpu/drm/i915/selftests/.kunitconfig   | 12 +++
 .../gpu/drm/i915/selftests/i915_gem_evict.c   |  1 +
 drivers/gpu/drm/i915/selftests/i915_gem_gtt.c |  1 +
 drivers/gpu/drm/i915/selftests/i915_kunit.c   | 95 +++++++++++++++++++
 drivers/gpu/drm/i915/selftests/i915_request.c |  1 +
 .../gpu/drm/i915/selftests/i915_selftest.c    | 23 +++--
 .../gpu/drm/i915/selftests/i915_sw_fence.c    |  1 +
 drivers/gpu/drm/i915/selftests/i915_syncmap.c |  1 +
 drivers/gpu/drm/i915/selftests/i915_vma.c     |  1 +
 .../drm/i915/selftests/intel_memory_region.c  |  1 +
 drivers/gpu/drm/i915/selftests/intel_uncore.c |  1 +
 drivers/gpu/drm/i915/selftests/scatterlist.c  |  1 +
 23 files changed, 161 insertions(+), 8 deletions(-)
 create mode 100644 drivers/gpu/drm/i915/selftests/.kunitconfig
 create mode 100644 drivers/gpu/drm/i915/selftests/i915_kunit.c