From patchwork Mon Jan 17 23:22:58 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Micha=C5=82_Winiarski?= X-Patchwork-Id: 12715734 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 CC0CAC433EF for ; Mon, 17 Jan 2022 23:25:03 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 150F7112551; Mon, 17 Jan 2022 23:25:03 +0000 (UTC) Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) by gabe.freedesktop.org (Postfix) with ESMTPS id A9A1F112553 for ; Mon, 17 Jan 2022 23:25:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1642461901; x=1673997901; h=from:to:cc:subject:date:message-id:in-reply-to: references:content-transfer-encoding:mime-version; bh=7SZ5FkscuxR8Fu6Dmn9NNsNOTopG57Z6VqpuNtW5J8E=; b=R77yLJfNyp0l0U4uO602QR+xH8NBmAhccHtgZAkTH0PvmBoS89DivVMU Q6YE4p9dHLAUsY3zhmlcyOlQVATbPANwRQrecX83Q8RPiGQ9cdrCO99yK gqMoL4J2aiWyjwreQH9BdFwOaKvbUHk+dM0YzdwqNKTvP0unRUxqyHt2A Aqq7Emd3biSbYcNNPBMAgzWVAAPXC6evlyJoBKdU8FZzHOqHmMMOF49hz kO229CRCGkWPnF4aAdZXP/zkULiH+HOF6RidRfljJOo1bwhzRCPB5i/7R 1FQUCJWVh51E6GO/mVtRYv/Ql+5SjjCdFz+VfOPUCsEOBn0Z3+KxGKOXq w==; X-IronPort-AV: E=McAfee;i="6200,9189,10230"; a="269082595" X-IronPort-AV: E=Sophos;i="5.88,296,1635231600"; d="scan'208";a="269082595" Received: from orsmga007.jf.intel.com ([10.7.209.58]) by fmsmga101.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 17 Jan 2022 15:25:01 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.88,296,1635231600"; d="scan'208";a="517554470" Received: from orsmsx605.amr.corp.intel.com ([10.22.229.18]) by orsmga007.jf.intel.com with ESMTP; 17 Jan 2022 15:25:01 -0800 Received: from orsmsx609.amr.corp.intel.com (10.22.229.22) by ORSMSX605.amr.corp.intel.com (10.22.229.18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2308.20; Mon, 17 Jan 2022 15:25:00 -0800 Received: from orsmsx609.amr.corp.intel.com (10.22.229.22) by ORSMSX609.amr.corp.intel.com (10.22.229.22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2308.20; Mon, 17 Jan 2022 15:25:00 -0800 Received: from ORSEDG602.ED.cps.intel.com (10.7.248.7) by orsmsx609.amr.corp.intel.com (10.22.229.22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2308.20 via Frontend Transport; Mon, 17 Jan 2022 15:25:00 -0800 Received: from NAM12-DM6-obe.outbound.protection.outlook.com (104.47.59.169) by edgegateway.intel.com (134.134.137.103) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2308.20; Mon, 17 Jan 2022 15:25:00 -0800 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=j0Ghs3ihrHzAChHBnIY0YYjHuaKG6n5NvPim9I7wbZ/v4fs2qdxmuJrn1J3x0Q0RC2uZZDsXwXrNcZ+lj2TIN5FmBl1saXdM5vLur2n2h5hTolHZROmkhIs0C1oN7yoAOPFzuyEC7tNSel9Y+tFL0VN1dMGQ/Dc30sBlyzab3gib64IOQCxV32u8B3j+E5whi3XHMkXPfx/fhXEngKVdc/tQzD4oDJnwGl89QXl81hMJxXqDmC5TJp+EmPxdaQeRGbnBGOl73TcPjx7NF9MOjjc1r+/wnPDpCm5DmrQ0TTZzB3Uvn/L9Q07YJP+6Zp4i1NbpTON3UVJ2ENezT96Niw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=lKlHknuBE7WK6xRv+9R+AldWiYg3irUWS2IbYi9xaQo=; b=P3gUgdf5GkRE2Dr8VEaSXbKoVD7/OYNP45OWKMO25sjthP2QoC9nocb/mdHG+ayrcfKLeCO0Qu+m3NNY0hF72L67h4563s9JEp85EPouFepjV4Ds6uu0BTRm5MklncLSXZLkGHLPCcGJ4ugYJlFdyK4rdRIcWrWNdpMHUM1HdUxTMiDsOFSvUjkqA9WDm1igyW/fJQnwK/XPDGcUPz5YLA8ZfADlqjKGMpwelX7JknrimK7wA932gycrJXj+fvQPwO54i7eZMFglDe/s8EhvwpWImQejznOeyyxJvhYYZnKNTBdZ712FFkNUnA3sJjxFWoEygNmBIM76QpTy2BIWKQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=intel.com; dmarc=pass action=none header.from=intel.com; dkim=pass header.d=intel.com; arc=none Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=intel.com; Received: from DM4PR11MB5373.namprd11.prod.outlook.com (2603:10b6:5:394::7) by DM4PR11MB5550.namprd11.prod.outlook.com (2603:10b6:5:38b::24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4888.9; Mon, 17 Jan 2022 23:24:58 +0000 Received: from DM4PR11MB5373.namprd11.prod.outlook.com ([fe80::fc15:bd26:128a:f5f5]) by DM4PR11MB5373.namprd11.prod.outlook.com ([fe80::fc15:bd26:128a:f5f5%8]) with mapi id 15.20.4888.014; Mon, 17 Jan 2022 23:24:58 +0000 From: =?utf-8?q?Micha=C5=82_Winiarski?= To: , Subject: [RFC 09/10] drm: selftests: Convert to KUnit Date: Tue, 18 Jan 2022 00:22:58 +0100 Message-ID: <20220117232259.180459-10-michal.winiarski@intel.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220117232259.180459-1-michal.winiarski@intel.com> References: <20220117232259.180459-1-michal.winiarski@intel.com> X-ClientProxiedBy: AS9PR06CA0409.eurprd06.prod.outlook.com (2603:10a6:20b:461::18) To DM4PR11MB5373.namprd11.prod.outlook.com (2603:10b6:5:394::7) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 8064ead1-3a13-439f-570f-08d9da109389 X-MS-TrafficTypeDiagnostic: DM4PR11MB5550:EE_ X-LD-Processed: 46c98d88-e344-4ed4-8496-4ed7712e255d,ExtAddr X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:4303; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: ktiPXdK1Yd1LWonUumMbng9XDIEiz9nVmFya20gGVrcPoEEUE98vKbmQfxpeSt/F4XOSzRaEySCmkBHd6LW2csWrHObh3vF/Su1AtRlVHYJcUBxOxuvpOBHM0LPmRw2Fq6ETYLvVP1UAQR/dFIfIcGe4tQM8phJ+dzJH3191DBjjqT3Z7n46Iv75FeNvXkpMGPVlZMHQFdlzxoN406k69K5cCxtODeBkecafL5Tsb8Fqsd+ScxhMX090UGzQc2SEwNc6sHnQNNmOOJGHTGHySz287bVQYub4lGJmyt1JSmZkmGo7Ag4eR5JEdHddOG3hTL6zaj6ErUnsn1hZ+ugxBQmMJJf9pS4VIRdCv05R+GxFiP+Vxpg6xVOT4q/99DSR+eHNAVNZ2QzOnSGs77wGrEc6jRPWt5+U9SH3n/r4lIcIzbWwq3wDrCpzADdAzJ7/mYHmdswXFKlvaZWrslz8frD0Cnke/1GCFCpBKrfbqRrMckqlkunZiURVVQbsj45WQrFENnMdY+1Owdpf22iHYVxEN4aeqlxiA1nj4qAhLMrcEt8/F+boFuBSE6tYZMKTXncbwPbMXx0ZbPLjM8K22BULnmuPzFjhcUvLpeyfPIKHE3Dyd5JZ8OwEtRUBsIuM9I0Lr9W6zk3CfKZo22Dddg== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DM4PR11MB5373.namprd11.prod.outlook.com; PTR:; CAT:NONE; SFS:(366004)(86362001)(82960400001)(4326008)(5660300002)(36756003)(186003)(6506007)(7416002)(1076003)(54906003)(6512007)(83380400001)(26005)(66946007)(66476007)(66556008)(316002)(6486002)(38100700002)(8936002)(508600001)(2906002)(30864003)(8676002)(2616005); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?q?HXEReh4osXyfhzeWQ7zqZkGHwChE?= =?utf-8?q?b4PeIz0Z9ldjCYiut+2jFuQUt/wfUjH54mzX8aEz2Zc8pxXfC7diPVYPWeHIJ5X84?= =?utf-8?q?4vEoXjsQtleQk9zRnpuBw+VF2TNon0ergCg2/orNZrE6r+Wt9htJM8V5bL0RczTZP?= =?utf-8?q?HbcbQgtxwIn//PR4TZgNy/SiyAbXzvmG6XrL9wgt1Q0RQBrrlOBr+uJIWU6W6XcDl?= =?utf-8?q?PfJeEMlPgCf0Vt+LHqkRbAcRd4EWmHkXDkE7f4XaXuFboII8ke6HdL3uMFT5kpDwq?= =?utf-8?q?hFFhxR9xrpGHxsfHI6Ko+wMJAuEEIBq+iRHHBragri/SYZ314cQCjVwy/NzYIwG1z?= =?utf-8?q?yFqDRFUui1KAD3ZL31Q8L+5wwNZwuemYiKcXC8vqimKPEVzlH2OajC2tU5xWdYtKM?= =?utf-8?q?qH8oF0mfivmCMMXDq2A/e6HQCm7ljgNeibGE0CMGy/U8XY8b8Efl3RsL+rOdSgBZC?= =?utf-8?q?BeF6oWRJ6Cr/ImVE2HaEM/9u1/ouJFgK2B7Eh0J9M5maCvG1XAx697eMmfv2TCCrK?= =?utf-8?q?JJBbClU1YtaS6AxbF553NEnNtKrYnKUYQOmfcRUzkZxfrCZ5fkuof+IlHYk08vEq+?= =?utf-8?q?L7E+zgg1tDc4Pc1z67yHDlWP8gg5V3ScJJATNQ+EnSgj2A5NpXuPqfGbqFG+vWT8A?= =?utf-8?q?zuzaV2Gw/E41UpqgPJhKOfWXnryX8BeVX4NzuiFofQ/mQc+/J4ik7aoj89EbR5XKp?= =?utf-8?q?XYi189FiFjX2RCm8YhIxUJSGevEJap1ZXoONN0rPaoOiMWpzVd0nFx1sSiN9CqsRA?= =?utf-8?q?Ln25uNVwbi+BwSNm5/lSGt3wi08wPc4hJIg1w9Ff84sLHdC2hol9HZ9q5m9LY6PCS?= =?utf-8?q?WTReVciUbHba/laBRKIlSdNfqyzZ8UyhvGspS1Jgyw7kGd1cg5cTtoVuFok7+lYlw?= =?utf-8?q?GQuXXcnnUHhqfOZGjmC+9DSvVLQQggOCCl/gwthxt2U6/99rBIiw+AdeO65ubNN3/?= =?utf-8?q?D+LCFg+oQs4zp402mkq/V5IxVKpQa5QlKTHKjhCnsk6Y0gkjBcbtLFRtoQV9Ka1tG?= =?utf-8?q?6xiclDrjwKiyT21rQqlz+WK7LGz3jZQCkqYpRGKU65kp0Wt4fXeihbnCcSvYporZA?= =?utf-8?q?fTahpNm0iEmGjBC58/CJh4/sLLDFWkig9K4jMy+OoLkokBgYOy43OIPX+qrH+35Yb?= =?utf-8?q?fkrtuuVnCX5p+WZuIe3Lt84d84o5HaG6R15tdJkzUw03h75Q2CPxLtirgUDhwb+u3?= =?utf-8?q?e7nMIqi7uHQQuagwYz9yPzPeY+w/RhB5myELz60eoYbPf9HIG1mYscm1np7LQACJR?= =?utf-8?q?zmlscxwkV5If6U7Oyb9tqi3Iz9DkWH5ja+zygJ2eaw2DWSoL7YZFqH+a/EKbHi8qx?= =?utf-8?q?o2AQSLzT1VRPTE5OVs07zO/iJQ+W/YG/BwZNxPjz09E6MgFDBYX7N85LnjNsp85Dj?= =?utf-8?q?aKmBh1jkTmoPT2J2oFPKXXIVhg/DGniz1h7dUZu/9WQwVvdwf51s2TUEHIKEFNsi2?= =?utf-8?q?rW9OU8lSe2BGcTlXb+dcHMqSTdopQ2WOlzDeKWFct+oXjg/tWd1Lji6WtGCdc3bVH?= =?utf-8?q?gNWnB0m7SRUjDP0CC3+zU5urV/Ct7CLThyhiQdGR8CGWHFrU/IJ6vO7+G99VuDQH+?= =?utf-8?q?A+ZJdCZXCrnJdojODXI4QCBQ8QGOgFj8g=3D=3D?= X-MS-Exchange-CrossTenant-Network-Message-Id: 8064ead1-3a13-439f-570f-08d9da109389 X-MS-Exchange-CrossTenant-AuthSource: DM4PR11MB5373.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 17 Jan 2022 23:24:58.0312 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 46c98d88-e344-4ed4-8496-4ed7712e255d X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: XawDAc8gBKZyQBAIVbzg2W7e80Pi4Z4h/OMPtQf5cRaPbqTIPOO98iOctAZtM0LoYDDGlh5tYAbtOQoVtzX0axqWyGmwODyeovrzW3MfKD4= X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM4PR11MB5550 X-OriginatorOrg: intel.com 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: =?utf-8?q?Micha=C5=82_Winiarski?= , Thomas Zimmermann , David Airlie , Brendan Higgins , Daniel Latypov , Arkadiusz Hiler , Petri Latvala Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" Now that all tests were converted, remove the content that's no longer used and rename the directory to "test". Signed-off-by: Michał Winiarski --- drivers/gpu/drm/Kconfig | 17 --- drivers/gpu/drm/Makefile | 2 +- drivers/gpu/drm/i915/Kconfig.debug | 1 - drivers/gpu/drm/selftests/drm_selftest.c | 109 ------------------ drivers/gpu/drm/selftests/drm_selftest.h | 41 ------- drivers/gpu/drm/{selftests => test}/Makefile | 0 .../test-drm_cmdline_parser.c | 0 .../test-drm_damage_helper.c | 0 .../test-drm_dp_mst_helper.c | 0 .../drm/{selftests => test}/test-drm_format.c | 0 .../test-drm_framebuffer.c | 0 .../gpu/drm/{selftests => test}/test-drm_mm.c | 0 .../test-drm_plane_helper.c | 0 .../drm/{selftests => test}/test-drm_rect.c | 0 14 files changed, 1 insertion(+), 169 deletions(-) delete mode 100644 drivers/gpu/drm/selftests/drm_selftest.c delete mode 100644 drivers/gpu/drm/selftests/drm_selftest.h rename drivers/gpu/drm/{selftests => test}/Makefile (100%) rename drivers/gpu/drm/{selftests => test}/test-drm_cmdline_parser.c (100%) rename drivers/gpu/drm/{selftests => test}/test-drm_damage_helper.c (100%) rename drivers/gpu/drm/{selftests => test}/test-drm_dp_mst_helper.c (100%) rename drivers/gpu/drm/{selftests => test}/test-drm_format.c (100%) rename drivers/gpu/drm/{selftests => test}/test-drm_framebuffer.c (100%) rename drivers/gpu/drm/{selftests => test}/test-drm_mm.c (100%) rename drivers/gpu/drm/{selftests => test}/test-drm_plane_helper.c (100%) rename drivers/gpu/drm/{selftests => test}/test-drm_rect.c (100%) diff --git a/drivers/gpu/drm/Kconfig b/drivers/gpu/drm/Kconfig index c567324c96b9..7b18540a1b8a 100644 --- a/drivers/gpu/drm/Kconfig +++ b/drivers/gpu/drm/Kconfig @@ -63,23 +63,6 @@ config DRM_DEBUG_MM If in doubt, say "N". -config DRM_DEBUG_SELFTEST - tristate "kselftests for DRM" - depends on DRM - depends on DEBUG_KERNEL - select PRIME_NUMBERS - select DRM_LIB_RANDOM - select DRM_KMS_HELPER - select DRM_EXPORT_FOR_TESTS if m - default n - help - This option provides kernel modules that can be used to run - various selftests on parts of the DRM 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". - config DRM_KUNIT_TEST bool "DRM tests" if !KUNIT_ALL_TESTS depends on DRM=y && KUNIT=y diff --git a/drivers/gpu/drm/Makefile b/drivers/gpu/drm/Makefile index 550800e81836..6fe8143c43e7 100644 --- a/drivers/gpu/drm/Makefile +++ b/drivers/gpu/drm/Makefile @@ -65,7 +65,7 @@ drm_kms_helper-$(CONFIG_DRM_DP_AUX_CHARDEV) += drm_dp_aux_dev.o drm_kms_helper-$(CONFIG_DRM_DP_CEC) += drm_dp_cec.o obj-$(CONFIG_DRM_KMS_HELPER) += drm_kms_helper.o -obj-y += selftests/ +obj-y += test/ obj-$(CONFIG_DRM) += drm.o obj-$(CONFIG_DRM_MIPI_DBI) += drm_mipi_dbi.o diff --git a/drivers/gpu/drm/i915/Kconfig.debug b/drivers/gpu/drm/i915/Kconfig.debug index e7fd3e76f8a2..425189f55d37 100644 --- a/drivers/gpu/drm/i915/Kconfig.debug +++ b/drivers/gpu/drm/i915/Kconfig.debug @@ -38,7 +38,6 @@ config DRM_I915_DEBUG select DRM_VGEM # used by igt/prime_vgem (dmabuf interop checks) select DRM_DEBUG_MM if DRM=y select DRM_EXPORT_FOR_TESTS if m - select DRM_DEBUG_SELFTEST select DMABUF_SELFTESTS select SW_SYNC # signaling validation framework (igt/syncobj*) select DRM_I915_WERROR diff --git a/drivers/gpu/drm/selftests/drm_selftest.c b/drivers/gpu/drm/selftests/drm_selftest.c deleted file mode 100644 index e29ed9faef5b..000000000000 --- a/drivers/gpu/drm/selftests/drm_selftest.c +++ /dev/null @@ -1,109 +0,0 @@ -/* - * Copyright © 2016 Intel Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice (including the next - * paragraph) shall be included in all copies or substantial portions of the - * Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING - * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS - * IN THE SOFTWARE. - */ - -#include - -#define selftest(name, func) __idx_##name, -enum { -#include TESTS -}; -#undef selftest - -#define selftest(n, f) [__idx_##n] = { .name = #n, .func = f }, -static struct drm_selftest { - bool enabled; - const char *name; - int (*func)(void *); -} selftests[] = { -#include TESTS -}; -#undef selftest - -/* Embed the line number into the parameter name so that we can order tests */ -#define param(n) __PASTE(igt__, __PASTE(__PASTE(__LINE__, __), n)) -#define selftest_0(n, func, id) \ -module_param_named(id, selftests[__idx_##n].enabled, bool, 0400); -#define selftest(n, func) selftest_0(n, func, param(n)) -#include TESTS -#undef selftest - -static void set_default_test_all(struct drm_selftest *st, unsigned long count) -{ - unsigned long i; - - for (i = 0; i < count; i++) - if (st[i].enabled) - return; - - for (i = 0; i < count; i++) - st[i].enabled = true; -} - -static int run_selftests(struct drm_selftest *st, - unsigned long count, - void *data) -{ - int err = 0; - - set_default_test_all(st, count); - - /* Tests are listed in natural order in drm_*_selftests.h */ - for (; count--; st++) { - if (!st->enabled) - continue; - - pr_debug("drm: Running %s\n", st->name); - err = st->func(data); - if (err) - break; - } - - if (WARN(err > 0 || err == -ENOTTY, - "%s returned %d, conflicting with selftest's magic values!\n", - st->name, err)) - err = -1; - - rcu_barrier(); - return err; -} - -static int __maybe_unused -__drm_subtests(const char *caller, - const struct drm_subtest *st, - int count, - void *data) -{ - int err; - - for (; count--; st++) { - pr_debug("Running %s/%s\n", caller, st->name); - err = st->func(data); - if (err) { - pr_err("%s: %s failed with error %d\n", - caller, st->name, err); - return err; - } - } - - return 0; -} diff --git a/drivers/gpu/drm/selftests/drm_selftest.h b/drivers/gpu/drm/selftests/drm_selftest.h deleted file mode 100644 index c784ec02ff53..000000000000 --- a/drivers/gpu/drm/selftests/drm_selftest.h +++ /dev/null @@ -1,41 +0,0 @@ -/* - * Copyright © 2016 Intel Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice (including the next - * paragraph) shall be included in all copies or substantial portions of the - * Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING - * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS - * IN THE SOFTWARE. - */ - -#ifndef __DRM_SELFTEST_H__ -#define __DRM_SELFTEST_H__ - -struct drm_subtest { - int (*func)(void *data); - const char *name; -}; - -static int __drm_subtests(const char *caller, - const struct drm_subtest *st, - int count, - void *data); -#define drm_subtests(T, data) \ - __drm_subtests(__func__, T, ARRAY_SIZE(T), data) - -#define SUBTEST(x) { x, #x } - -#endif /* __DRM_SELFTEST_H__ */ diff --git a/drivers/gpu/drm/selftests/Makefile b/drivers/gpu/drm/test/Makefile similarity index 100% rename from drivers/gpu/drm/selftests/Makefile rename to drivers/gpu/drm/test/Makefile diff --git a/drivers/gpu/drm/selftests/test-drm_cmdline_parser.c b/drivers/gpu/drm/test/test-drm_cmdline_parser.c similarity index 100% rename from drivers/gpu/drm/selftests/test-drm_cmdline_parser.c rename to drivers/gpu/drm/test/test-drm_cmdline_parser.c diff --git a/drivers/gpu/drm/selftests/test-drm_damage_helper.c b/drivers/gpu/drm/test/test-drm_damage_helper.c similarity index 100% rename from drivers/gpu/drm/selftests/test-drm_damage_helper.c rename to drivers/gpu/drm/test/test-drm_damage_helper.c diff --git a/drivers/gpu/drm/selftests/test-drm_dp_mst_helper.c b/drivers/gpu/drm/test/test-drm_dp_mst_helper.c similarity index 100% rename from drivers/gpu/drm/selftests/test-drm_dp_mst_helper.c rename to drivers/gpu/drm/test/test-drm_dp_mst_helper.c diff --git a/drivers/gpu/drm/selftests/test-drm_format.c b/drivers/gpu/drm/test/test-drm_format.c similarity index 100% rename from drivers/gpu/drm/selftests/test-drm_format.c rename to drivers/gpu/drm/test/test-drm_format.c diff --git a/drivers/gpu/drm/selftests/test-drm_framebuffer.c b/drivers/gpu/drm/test/test-drm_framebuffer.c similarity index 100% rename from drivers/gpu/drm/selftests/test-drm_framebuffer.c rename to drivers/gpu/drm/test/test-drm_framebuffer.c diff --git a/drivers/gpu/drm/selftests/test-drm_mm.c b/drivers/gpu/drm/test/test-drm_mm.c similarity index 100% rename from drivers/gpu/drm/selftests/test-drm_mm.c rename to drivers/gpu/drm/test/test-drm_mm.c diff --git a/drivers/gpu/drm/selftests/test-drm_plane_helper.c b/drivers/gpu/drm/test/test-drm_plane_helper.c similarity index 100% rename from drivers/gpu/drm/selftests/test-drm_plane_helper.c rename to drivers/gpu/drm/test/test-drm_plane_helper.c diff --git a/drivers/gpu/drm/selftests/test-drm_rect.c b/drivers/gpu/drm/test/test-drm_rect.c similarity index 100% rename from drivers/gpu/drm/selftests/test-drm_rect.c rename to drivers/gpu/drm/test/test-drm_rect.c