From patchwork Wed Jun 15 13:58:18 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Ma=C3=ADra_Canal?= X-Patchwork-Id: 12882397 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id D89AAC433EF for ; Wed, 15 Jun 2022 13:59:36 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 08E9010F5C8; Wed, 15 Jun 2022 13:59:36 +0000 (UTC) Received: from mail-ot1-x336.google.com (mail-ot1-x336.google.com [IPv6:2607:f8b0:4864:20::336]) by gabe.freedesktop.org (Postfix) with ESMTPS id D506D10F5C8 for ; Wed, 15 Jun 2022 13:59:34 +0000 (UTC) Received: by mail-ot1-x336.google.com with SMTP id e67-20020a9d01c9000000b0060c221b1420so8931665ote.0 for ; Wed, 15 Jun 2022 06:59:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=usp.br; s=usp-google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=1YgpDW8OcfuUaHGsXGtV0UPJNBs2IDjKm2IqsW8qdoA=; b=rULljSkkSIIpiMsl9QbL8SEy9VxDXfYZTzhckRrYPn840UuL6cgvfC9w7FQvfBnFtf EIti0pqPs7i4jrO8ginb49DdR+LN1ExxWcx6uA4OSmfN69HclVUVqcmjNUykUF39jNGB Y2a6NlFfOPyaA1AYJK81CpyVD9Fto22S78duQU9VT2+fSClif41Vu8KnpkeVXCrcFBwt DXwiXD1vE0GdFTVPcf9Bzv0eTWrE7ARXFsioSvIcDj/K3iA3DIglzSYvWv+HwX7FCS3v b+RU8qFl7ZlHuMqwnGkLtW7JXPxcylW9r+DhIfQ5nWm5Vkwm7Qnp9MnHmBrroAyRcdpK Q4yQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=1YgpDW8OcfuUaHGsXGtV0UPJNBs2IDjKm2IqsW8qdoA=; b=oU0RcKM+9G/2/ojux6OCJppvP9Idxjn4daTp4dkBH65UF4KtYjv6x2fkzz6xTjD7Wl +fMHCU8b4BjjNulzN8Ubc+O1llbT+Y32UtBbdl6zwpIep2WfX6YO6nJUhJUHT//hAm1t monpn8L5V7fTSrCfFoEIxmt8T68roeK7FvmA+NFPseUgZVcbIo6El3EyZu0/tuILX+io syHjcIOVoxWWfa68CSPytLOQz70YxhGApaCP9JstWEpnLD3/YIksRoM7ZkmN1ZtsFfN3 kmJ7BlX96BCkYHJtRfvEPoMRfZB5p0DDOWAfSdNzeEMCYhy2TwDk+EyFRxR+cqtqF+Q4 fJRg== X-Gm-Message-State: AOAM532/f0CiMMpVGjsmj0sPp20kGlLOXk2V6irMwnU/x8FbUXvyQeYK tXGiL0MAtyM+Tl2waXQZdeMSvA== X-Google-Smtp-Source: ABdhPJwCP1tUNPBFjXJBT5TCCkC2QS5ArKRIC3u0+lel14vofiWNrdzoRJish+Xa1sU6L81jZLUMbQ== X-Received: by 2002:a05:6830:1691:b0:60c:1eb1:6ddf with SMTP id k17-20020a056830169100b0060c1eb16ddfmr4269841otr.205.1655301574035; Wed, 15 Jun 2022 06:59:34 -0700 (PDT) Received: from fedora.. ([2804:14d:8084:84c6:fe26:c42d:aab9:fa8a]) by smtp.gmail.com with ESMTPSA id u7-20020a056830248700b0060bfebb96e5sm6056928ots.35.2022.06.15.06.59.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 15 Jun 2022 06:59:33 -0700 (PDT) From: =?utf-8?q?Ma=C3=ADra_Canal?= To: Isabella Basso , magalilemes00@gmail.com, tales.aparecida@gmail.com, mwen@igalia.com, andrealmeid@riseup.net, Trevor Woerner , leandro.ribeiro@collabora.com, n@nfraprado.net, Daniel Vetter , Shuah Khan , David Airlie , Maxime Ripard , Thomas Zimmermann , michal.winiarski@intel.com, Javier Martinez Canillas , =?utf-8?b?Sm9zw6kgRXhww7NzaXRv?= , David Gow , Daniel Latypov , brendanhiggins@google.com Subject: [PATCH 04/10] drm: selftest: convert drm_rect selftest to KUnit Date: Wed, 15 Jun 2022 10:58:18 -0300 Message-Id: <20220615135824.15522-5-maira.canal@usp.br> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220615135824.15522-1-maira.canal@usp.br> References: <20220615135824.15522-1-maira.canal@usp.br> MIME-Version: 1.0 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Carlos Veras , =?utf-8?q?Ma=C3=ADra_Canal?= , linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, Matheus Vieira , linux-kselftest@vger.kernel.org, kunit-dev@googlegroups.com Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" Considering the current adoption of the KUnit framework, convert the DRM rect selftest to the KUnit API. Co-developed-by: Carlos Veras Signed-off-by: Carlos Veras Co-developed-by: Matheus Vieira Signed-off-by: Matheus Vieira Signed-off-by: MaĆ­ra Canal --- drivers/gpu/drm/selftests/Makefile | 2 +- .../gpu/drm/selftests/drm_modeset_selftests.h | 4 - .../drm/selftests/test-drm_modeset_common.h | 4 - drivers/gpu/drm/tests/Kconfig | 12 ++ drivers/gpu/drm/tests/Makefile | 1 + .../drm/{selftests => tests}/test-drm_rect.c | 124 +++++++++--------- 6 files changed, 79 insertions(+), 68 deletions(-) rename drivers/gpu/drm/{selftests => tests}/test-drm_rect.c (53%) diff --git a/drivers/gpu/drm/selftests/Makefile b/drivers/gpu/drm/selftests/Makefile index 8633bb9ea717..8a794914e328 100644 --- a/drivers/gpu/drm/selftests/Makefile +++ b/drivers/gpu/drm/selftests/Makefile @@ -1,7 +1,7 @@ # SPDX-License-Identifier: GPL-2.0-only test-drm_modeset-y := test-drm_modeset_common.o test-drm_plane_helper.o \ test-drm_format.o test-drm_framebuffer.o \ - test-drm_dp_mst_helper.o test-drm_rect.o + test-drm_dp_mst_helper.o obj-$(CONFIG_DRM_DEBUG_SELFTEST) += test-drm_mm.o test-drm_modeset.o \ test-drm_buddy.o diff --git a/drivers/gpu/drm/selftests/drm_modeset_selftests.h b/drivers/gpu/drm/selftests/drm_modeset_selftests.h index 4787b3b70709..a3ca90307364 100644 --- a/drivers/gpu/drm/selftests/drm_modeset_selftests.h +++ b/drivers/gpu/drm/selftests/drm_modeset_selftests.h @@ -6,10 +6,6 @@ * * Tests are executed in order by igt/drm_selftests_helper */ -selftest(drm_rect_clip_scaled_div_by_zero, igt_drm_rect_clip_scaled_div_by_zero) -selftest(drm_rect_clip_scaled_not_clipped, igt_drm_rect_clip_scaled_not_clipped) -selftest(drm_rect_clip_scaled_clipped, igt_drm_rect_clip_scaled_clipped) -selftest(drm_rect_clip_scaled_signed_vs_unsigned, igt_drm_rect_clip_scaled_signed_vs_unsigned) selftest(check_plane_state, igt_check_plane_state) selftest(check_drm_format_block_width, igt_check_drm_format_block_width) selftest(check_drm_format_block_height, igt_check_drm_format_block_height) diff --git a/drivers/gpu/drm/selftests/test-drm_modeset_common.h b/drivers/gpu/drm/selftests/test-drm_modeset_common.h index c29354e59cec..42a10d7da51c 100644 --- a/drivers/gpu/drm/selftests/test-drm_modeset_common.h +++ b/drivers/gpu/drm/selftests/test-drm_modeset_common.h @@ -16,10 +16,6 @@ #define FAIL_ON(x) FAIL((x), "%s", "FAIL_ON(" __stringify(x) ")\n") -int igt_drm_rect_clip_scaled_div_by_zero(void *ignored); -int igt_drm_rect_clip_scaled_not_clipped(void *ignored); -int igt_drm_rect_clip_scaled_clipped(void *ignored); -int igt_drm_rect_clip_scaled_signed_vs_unsigned(void *ignored); int igt_check_plane_state(void *ignored); int igt_check_drm_format_block_width(void *ignored); int igt_check_drm_format_block_height(void *ignored); diff --git a/drivers/gpu/drm/tests/Kconfig b/drivers/gpu/drm/tests/Kconfig index 14ee077cca54..bab6bf363363 100644 --- a/drivers/gpu/drm/tests/Kconfig +++ b/drivers/gpu/drm/tests/Kconfig @@ -37,4 +37,16 @@ config DRM_CMDLINE_PARSER_KUNIT_TEST If in doubt, say "N". +config DRM_RECT_KUNIT_TEST + tristate "KUnit tests for DRM rect" if !DRM_KUNIT_TEST + select DRM_KMS_HELPER + default y if DRM_KUNIT_TEST + help + This option provides a KUnit module that can be used to run + an unit test on the DRM rect API. This option is not + useful for distributions or general kernels, but only for kernel + developers working on DRM and associated drivers. + + If in doubt, say "N". + endmenu diff --git a/drivers/gpu/drm/tests/Makefile b/drivers/gpu/drm/tests/Makefile index 3ded14858e8c..d03e28724d47 100644 --- a/drivers/gpu/drm/tests/Makefile +++ b/drivers/gpu/drm/tests/Makefile @@ -1,3 +1,4 @@ # SPDX-License-Identifier: GPL-2.0-only obj-$(CONFIG_DRM_DAMAGE_HELPER_KUNIT_TEST) += test-drm_damage_helper.o obj-$(CONFIG_DRM_CMDLINE_PARSER_KUNIT_TEST) += test-drm_cmdline_parser.o +obj-$(CONFIG_DRM_RECT_KUNIT_TEST) += test-drm_rect.o diff --git a/drivers/gpu/drm/selftests/test-drm_rect.c b/drivers/gpu/drm/tests/test-drm_rect.c similarity index 53% rename from drivers/gpu/drm/selftests/test-drm_rect.c rename to drivers/gpu/drm/tests/test-drm_rect.c index 3a5ff38321f4..94336412d32d 100644 --- a/drivers/gpu/drm/selftests/test-drm_rect.c +++ b/drivers/gpu/drm/tests/test-drm_rect.c @@ -3,15 +3,10 @@ * Test cases for the drm_rect functions */ -#define pr_fmt(fmt) "drm_rect: " fmt - -#include - +#include #include -#include "test-drm_modeset_common.h" - -int igt_drm_rect_clip_scaled_div_by_zero(void *ignored) +static void igt_drm_rect_clip_scaled_div_by_zero(struct kunit *test) { struct drm_rect src, dst, clip; bool visible; @@ -24,20 +19,20 @@ int igt_drm_rect_clip_scaled_div_by_zero(void *ignored) drm_rect_init(&dst, 0, 0, 0, 0); drm_rect_init(&clip, 1, 1, 1, 1); visible = drm_rect_clip_scaled(&src, &dst, &clip); - FAIL(visible, "Destination not be visible\n"); - FAIL(drm_rect_visible(&src), "Source should not be visible\n"); + + KUNIT_EXPECT_FALSE_MSG(test, visible, "Destination not be visible\n"); + KUNIT_EXPECT_FALSE_MSG(test, drm_rect_visible(&src), "Source should not be visible\n"); drm_rect_init(&src, 0, 0, 0, 0); drm_rect_init(&dst, 3, 3, 0, 0); drm_rect_init(&clip, 1, 1, 1, 1); visible = drm_rect_clip_scaled(&src, &dst, &clip); - FAIL(visible, "Destination not be visible\n"); - FAIL(drm_rect_visible(&src), "Source should not be visible\n"); - return 0; + KUNIT_EXPECT_FALSE_MSG(test, visible, "Destination not be visible\n"); + KUNIT_EXPECT_FALSE_MSG(test, drm_rect_visible(&src), "Source should not be visible\n"); } -int igt_drm_rect_clip_scaled_not_clipped(void *ignored) +static void igt_drm_rect_clip_scaled_not_clipped(struct kunit *test) { struct drm_rect src, dst, clip; bool visible; @@ -49,14 +44,14 @@ int igt_drm_rect_clip_scaled_not_clipped(void *ignored) visible = drm_rect_clip_scaled(&src, &dst, &clip); - FAIL(src.x1 != 0 || src.x2 != 1 << 16 || + KUNIT_EXPECT_FALSE_MSG(test, src.x1 != 0 || src.x2 != 1 << 16 || src.y1 != 0 || src.y2 != 1 << 16, "Source badly clipped\n"); - FAIL(dst.x1 != 0 || dst.x2 != 1 || + KUNIT_EXPECT_FALSE_MSG(test, dst.x1 != 0 || dst.x2 != 1 || dst.y1 != 0 || dst.y2 != 1, "Destination badly clipped\n"); - FAIL(!visible, "Destination should be visible\n"); - FAIL(!drm_rect_visible(&src), "Source should be visible\n"); + KUNIT_EXPECT_TRUE_MSG(test, visible, "Destination should be visible\n"); + KUNIT_EXPECT_TRUE_MSG(test, drm_rect_visible(&src), "Source should be visible\n"); /* 2:1 scaling */ drm_rect_init(&src, 0, 0, 2 << 16, 2 << 16); @@ -65,14 +60,14 @@ int igt_drm_rect_clip_scaled_not_clipped(void *ignored) visible = drm_rect_clip_scaled(&src, &dst, &clip); - FAIL(src.x1 != 0 || src.x2 != 2 << 16 || + KUNIT_EXPECT_FALSE_MSG(test, src.x1 != 0 || src.x2 != 2 << 16 || src.y1 != 0 || src.y2 != 2 << 16, "Source badly clipped\n"); - FAIL(dst.x1 != 0 || dst.x2 != 1 || + KUNIT_EXPECT_FALSE_MSG(test, dst.x1 != 0 || dst.x2 != 1 || dst.y1 != 0 || dst.y2 != 1, "Destination badly clipped\n"); - FAIL(!visible, "Destination should be visible\n"); - FAIL(!drm_rect_visible(&src), "Source should be visible\n"); + KUNIT_EXPECT_TRUE_MSG(test, visible, "Destination should be visible\n"); + KUNIT_EXPECT_TRUE_MSG(test, drm_rect_visible(&src), "Source should be visible\n"); /* 1:2 scaling */ drm_rect_init(&src, 0, 0, 1 << 16, 1 << 16); @@ -81,19 +76,17 @@ int igt_drm_rect_clip_scaled_not_clipped(void *ignored) visible = drm_rect_clip_scaled(&src, &dst, &clip); - FAIL(src.x1 != 0 || src.x2 != 1 << 16 || + KUNIT_EXPECT_FALSE_MSG(test, src.x1 != 0 || src.x2 != 1 << 16 || src.y1 != 0 || src.y2 != 1 << 16, "Source badly clipped\n"); - FAIL(dst.x1 != 0 || dst.x2 != 2 || + KUNIT_EXPECT_FALSE_MSG(test, dst.x1 != 0 || dst.x2 != 2 || dst.y1 != 0 || dst.y2 != 2, "Destination badly clipped\n"); - FAIL(!visible, "Destination should be visible\n"); - FAIL(!drm_rect_visible(&src), "Source should be visible\n"); - - return 0; + KUNIT_EXPECT_TRUE_MSG(test, visible, "Destination should be visible\n"); + KUNIT_EXPECT_TRUE_MSG(test, drm_rect_visible(&src), "Source should be visible\n"); } -int igt_drm_rect_clip_scaled_clipped(void *ignored) +static void igt_drm_rect_clip_scaled_clipped(struct kunit *test) { struct drm_rect src, dst, clip; bool visible; @@ -105,14 +98,14 @@ int igt_drm_rect_clip_scaled_clipped(void *ignored) visible = drm_rect_clip_scaled(&src, &dst, &clip); - FAIL(src.x1 != 0 || src.x2 != 1 << 16 || + KUNIT_EXPECT_FALSE_MSG(test, src.x1 != 0 || src.x2 != 1 << 16 || src.y1 != 0 || src.y2 != 1 << 16, "Source badly clipped\n"); - FAIL(dst.x1 != 0 || dst.x2 != 1 || + KUNIT_EXPECT_FALSE_MSG(test, dst.x1 != 0 || dst.x2 != 1 || dst.y1 != 0 || dst.y2 != 1, "Destination badly clipped\n"); - FAIL(!visible, "Destination should be visible\n"); - FAIL(!drm_rect_visible(&src), "Source should be visible\n"); + KUNIT_EXPECT_TRUE_MSG(test, visible, "Destination should be visible\n"); + KUNIT_EXPECT_TRUE_MSG(test, drm_rect_visible(&src), "Source should be visible\n"); /* 1:1 scaling bottom/right clip */ drm_rect_init(&src, 0, 0, 2 << 16, 2 << 16); @@ -121,14 +114,14 @@ int igt_drm_rect_clip_scaled_clipped(void *ignored) visible = drm_rect_clip_scaled(&src, &dst, &clip); - FAIL(src.x1 != 1 << 16 || src.x2 != 2 << 16 || + KUNIT_EXPECT_FALSE_MSG(test, src.x1 != 1 << 16 || src.x2 != 2 << 16 || src.y1 != 1 << 16 || src.y2 != 2 << 16, "Source badly clipped\n"); - FAIL(dst.x1 != 1 || dst.x2 != 2 || + KUNIT_EXPECT_FALSE_MSG(test, dst.x1 != 1 || dst.x2 != 2 || dst.y1 != 1 || dst.y2 != 2, "Destination badly clipped\n"); - FAIL(!visible, "Destination should be visible\n"); - FAIL(!drm_rect_visible(&src), "Source should be visible\n"); + KUNIT_EXPECT_TRUE_MSG(test, visible, "Destination should be visible\n"); + KUNIT_EXPECT_TRUE_MSG(test, drm_rect_visible(&src), "Source should be visible\n"); /* 2:1 scaling top/left clip */ drm_rect_init(&src, 0, 0, 4 << 16, 4 << 16); @@ -137,14 +130,14 @@ int igt_drm_rect_clip_scaled_clipped(void *ignored) visible = drm_rect_clip_scaled(&src, &dst, &clip); - FAIL(src.x1 != 0 || src.x2 != 2 << 16 || + KUNIT_EXPECT_FALSE_MSG(test, src.x1 != 0 || src.x2 != 2 << 16 || src.y1 != 0 || src.y2 != 2 << 16, "Source badly clipped\n"); - FAIL(dst.x1 != 0 || dst.x2 != 1 || + KUNIT_EXPECT_FALSE_MSG(test, dst.x1 != 0 || dst.x2 != 1 || dst.y1 != 0 || dst.y2 != 1, "Destination badly clipped\n"); - FAIL(!visible, "Destination should be visible\n"); - FAIL(!drm_rect_visible(&src), "Source should be visible\n"); + KUNIT_EXPECT_TRUE_MSG(test, visible, "Destination should be visible\n"); + KUNIT_EXPECT_TRUE_MSG(test, drm_rect_visible(&src), "Source should be visible\n"); /* 2:1 scaling bottom/right clip */ drm_rect_init(&src, 0, 0, 4 << 16, 4 << 16); @@ -153,14 +146,14 @@ int igt_drm_rect_clip_scaled_clipped(void *ignored) visible = drm_rect_clip_scaled(&src, &dst, &clip); - FAIL(src.x1 != 2 << 16 || src.x2 != 4 << 16 || + KUNIT_EXPECT_FALSE_MSG(test, src.x1 != 2 << 16 || src.x2 != 4 << 16 || src.y1 != 2 << 16 || src.y2 != 4 << 16, "Source badly clipped\n"); - FAIL(dst.x1 != 1 || dst.x2 != 2 || + KUNIT_EXPECT_FALSE_MSG(test, dst.x1 != 1 || dst.x2 != 2 || dst.y1 != 1 || dst.y2 != 2, "Destination badly clipped\n"); - FAIL(!visible, "Destination should be visible\n"); - FAIL(!drm_rect_visible(&src), "Source should be visible\n"); + KUNIT_EXPECT_TRUE_MSG(test, visible, "Destination should be visible\n"); + KUNIT_EXPECT_TRUE_MSG(test, drm_rect_visible(&src), "Source should be visible\n"); /* 1:2 scaling top/left clip */ drm_rect_init(&src, 0, 0, 2 << 16, 2 << 16); @@ -169,14 +162,14 @@ int igt_drm_rect_clip_scaled_clipped(void *ignored) visible = drm_rect_clip_scaled(&src, &dst, &clip); - FAIL(src.x1 != 0 || src.x2 != 1 << 16 || + KUNIT_EXPECT_FALSE_MSG(test, src.x1 != 0 || src.x2 != 1 << 16 || src.y1 != 0 || src.y2 != 1 << 16, "Source badly clipped\n"); - FAIL(dst.x1 != 0 || dst.x2 != 2 || + KUNIT_EXPECT_FALSE_MSG(test, dst.x1 != 0 || dst.x2 != 2 || dst.y1 != 0 || dst.y2 != 2, "Destination badly clipped\n"); - FAIL(!visible, "Destination should be visible\n"); - FAIL(!drm_rect_visible(&src), "Source should be visible\n"); + KUNIT_EXPECT_TRUE_MSG(test, visible, "Destination should be visible\n"); + KUNIT_EXPECT_TRUE_MSG(test, drm_rect_visible(&src), "Source should be visible\n"); /* 1:2 scaling bottom/right clip */ drm_rect_init(&src, 0, 0, 2 << 16, 2 << 16); @@ -185,19 +178,17 @@ int igt_drm_rect_clip_scaled_clipped(void *ignored) visible = drm_rect_clip_scaled(&src, &dst, &clip); - FAIL(src.x1 != 1 << 16 || src.x2 != 2 << 16 || + KUNIT_EXPECT_FALSE_MSG(test, src.x1 != 1 << 16 || src.x2 != 2 << 16 || src.y1 != 1 << 16 || src.y2 != 2 << 16, "Source badly clipped\n"); - FAIL(dst.x1 != 2 || dst.x2 != 4 || + KUNIT_EXPECT_FALSE_MSG(test, dst.x1 != 2 || dst.x2 != 4 || dst.y1 != 2 || dst.y2 != 4, "Destination badly clipped\n"); - FAIL(!visible, "Destination should be visible\n"); - FAIL(!drm_rect_visible(&src), "Source should be visible\n"); - - return 0; + KUNIT_EXPECT_TRUE_MSG(test, visible, "Destination should be visible\n"); + KUNIT_EXPECT_TRUE_MSG(test, drm_rect_visible(&src), "Source should be visible\n"); } -int igt_drm_rect_clip_scaled_signed_vs_unsigned(void *ignored) +static void igt_drm_rect_clip_scaled_signed_vs_unsigned(struct kunit *test) { struct drm_rect src, dst, clip; bool visible; @@ -216,8 +207,23 @@ int igt_drm_rect_clip_scaled_signed_vs_unsigned(void *ignored) visible = drm_rect_clip_scaled(&src, &dst, &clip); - FAIL(visible, "Destination should not be visible\n"); - FAIL(drm_rect_visible(&src), "Source should not be visible\n"); - - return 0; + KUNIT_EXPECT_FALSE_MSG(test, visible, "Destination should not be visible\n"); + KUNIT_EXPECT_FALSE_MSG(test, drm_rect_visible(&src), "Source should not be visible\n"); } + +static struct kunit_case drm_rect_tests[] = { + KUNIT_CASE(igt_drm_rect_clip_scaled_div_by_zero), + KUNIT_CASE(igt_drm_rect_clip_scaled_not_clipped), + KUNIT_CASE(igt_drm_rect_clip_scaled_clipped), + KUNIT_CASE(igt_drm_rect_clip_scaled_signed_vs_unsigned), + { } +}; + +static struct kunit_suite drm_rect_test_suite = { + .name = "drm_rect_tests", + .test_cases = drm_rect_tests, +}; + +kunit_test_suite(drm_rect_test_suite); + +MODULE_LICENSE("GPL");