Received: by 2002:a05:7412:8d08:b0:f9:2d0a:d759 with SMTP id bj8csp67747rdb; Sun, 17 Dec 2023 02:31:07 -0800 (PST) X-Google-Smtp-Source: AGHT+IEjhtPZXYV90cHQZKt/VVG7MGoh5VgyEy9KvaGxp/ao5YvLUJMAiH2KC3auUgcjYHHLXoYk X-Received: by 2002:a50:aad0:0:b0:553:3a99:4ca7 with SMTP id r16-20020a50aad0000000b005533a994ca7mr176780edc.78.1702809067596; Sun, 17 Dec 2023 02:31:07 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1702809067; cv=none; d=google.com; s=arc-20160816; b=fMP4SnRTvZWfG3y3Ms0Ho5exezZBjnzjJVPRTjHte+jgsOGTv63TJrhP/bSBy2znSP 9YjofOCe/KOtRu0Vr+qXW8gmN3NHLLWk2wqoJPHCSCNWkGkvxOJW9+KlgLr8BC9LCCpw UxKlEe/EH4oR30U2MM1E/ne0O9zmYX+A+mKouYLWydMNm0u4mdPe8K/62pnockw5kObP Ae3iYWzpGhNorG0XWRoYZTnrxFDJU6KnlI5tohNY92nsQgr2znMMdC4CHeSO7IsEQSUJ ceogbrd+niXobz0rFQKMp8ber0TmW/XfA0HCteFz/wxnbbczO2PSIqqMMRFDlYURBjF0 0ZsA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:feedback-id:dkim-signature:dkim-signature; bh=zuT1CkGiLdT6oVSTIHR17WNH4PptubpxnOyzoYj857U=; fh=29+NP+Avo3KW5WAFiPrv+jdOjQZBDMQJMXZlHI+I9m4=; b=YQTLT+/wpa6j0DdwD4gAiGl1mOBHW3/5/lR7pm0RTyhdFFWpNlXRx6cH8JAOOnL6Bh IeZUDXAaBmQjtOdTTRFiMWai3UFohwsV+k80skkmRYJVvSN6bTmr1FzNP+5zCEzTVxej 7wQ1+kQuMMF3MP2ZplBGO4afeDCU7qM/DZfeZd7Lgoib2OohRCdrZl6nF73WgDv4rmM0 1wxPqwrE6mfgTuzgZulk0K2MgLT0+IV+APel19+5vi5mSxIjUJdav/NWdzcGLSQFyDkp NIPxP+oa1uXhQdIeeLv2950u1IZsvDNJ0SmQ/8Ajd/GFWa4+TlKy/IaQYVeOIGCbTIX5 LgEw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@sakamocchi.jp header.s=fm2 header.b=WBo7FkL2; dkim=pass header.i=@messagingengine.com header.s=fm2 header.b=jkJryLQ0; spf=pass (google.com: domain of linux-kernel+bounces-2528-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-2528-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=sakamocchi.jp Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id j22-20020a170906279600b00a235495d018si134679ejc.345.2023.12.17.02.31.07 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 17 Dec 2023 02:31:07 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-2528-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; dkim=pass header.i=@sakamocchi.jp header.s=fm2 header.b=WBo7FkL2; dkim=pass header.i=@messagingengine.com header.s=fm2 header.b=jkJryLQ0; spf=pass (google.com: domain of linux-kernel+bounces-2528-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-2528-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=sakamocchi.jp Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id 5C2381F21FF2 for ; Sun, 17 Dec 2023 10:31:07 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id DE5756105; Sun, 17 Dec 2023 10:30:25 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=sakamocchi.jp header.i=@sakamocchi.jp header.b="WBo7FkL2"; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b="jkJryLQ0" X-Original-To: linux-kernel@vger.kernel.org Received: from out3-smtp.messagingengine.com (out3-smtp.messagingengine.com [66.111.4.27]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 0B3976FBB for ; Sun, 17 Dec 2023 10:30:22 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=sakamocchi.jp Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=sakamocchi.jp Received: from compute2.internal (compute2.nyi.internal [10.202.2.46]) by mailout.nyi.internal (Postfix) with ESMTP id 16B1F5C011D; Sun, 17 Dec 2023 05:30:22 -0500 (EST) Received: from mailfrontend2 ([10.202.2.163]) by compute2.internal (MEProxy); Sun, 17 Dec 2023 05:30:22 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sakamocchi.jp; h=cc:cc:content-transfer-encoding:content-type:date:date:from :from:in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:subject:subject:to:to; s=fm2; t=1702809022; x= 1702895422; bh=zuT1CkGiLdT6oVSTIHR17WNH4PptubpxnOyzoYj857U=; b=W Bo7FkL2AwPXvHa40KrLdpILElFQK7ysX5Rdd9C+ESvBqiQH0UM1VRVNmlfbPYT+r V2rMkimslZnvyUC2FSuXbBV6J+UggE3/Tw6VSN7z2KUera1x63QbT1x/MT7NWA1U +VSADRs8M1sR40ezaePmu2xGXsS3JfTduykhMZ+6FJbO4K06GxLREb2K3dtCC8sw frB11UCPtc296UaFJ0qkRrW45/kYT3xqhYp6d1b2JITIOf3KYPOvvp4yYfi7xXXV epdjiYHxBWml0eJeyX5vWlo+B3Jc/SgUCSf2UqaV1jjeh84JF6BO/hwQWCZbXNvc LcO6pheSLyrIzZZgIG2oQ== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :content-type:date:date:feedback-id:feedback-id:from:from :in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:subject:subject:to:to:x-me-proxy:x-me-proxy :x-me-sender:x-me-sender:x-sasl-enc; s=fm2; t=1702809022; x= 1702895422; bh=zuT1CkGiLdT6oVSTIHR17WNH4PptubpxnOyzoYj857U=; b=j kJryLQ0fhJvwgnsAkGHT8zFdqlgWmpOozHDyK5JIeC1YOrGOfmi1KnRhGp8AMXRP U8hLKw+TIayJYkYCaspdZl0XR31wl+Z91TUf7COrbnSfCcovfcqHZSAaSVQcg3qt Va2FFmPJUCD3A+GbrShHMdgU3GGbmqaMcHb0TdDkUpiEju9uBRTuOgkZ3WnA4sN1 LCIUMiaethl7HL1S3fZ7ll+3qxLgvnLmpr+VOVS5I/GdkvY7i0i05d6jazN5ylUI dseAo6fbbL1pgQu2QohhUy0jJDkNMSiRK/R0IwYyOt4HPP9znOavhEvV08edbZuK +HheYbfvtbxB9vwBI8CBQ== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvkedrvddtiedgudehucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucenucfjughrpefhvfevufffkffojghfggfgsedtke ertdertddtnecuhfhrohhmpefvrghkrghshhhiucfurghkrghmohhtohcuoehoqdhtrghk rghshhhisehsrghkrghmohgttghhihdrjhhpqeenucggtffrrghtthgvrhhnpeeugfevtd efhfeffeeuudduhfekhffgveejfeeiiefftdethfduudevjeekveffleenucffohhmrghi nhepthgvshhtrghnhihthhhinhhgrdhorhhgnecuvehluhhsthgvrhfuihiivgeptdenuc frrghrrghmpehmrghilhhfrhhomhepohdqthgrkhgrshhhihesshgrkhgrmhhotggthhhi rdhjph X-ME-Proxy: Feedback-ID: ie8e14432:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Sun, 17 Dec 2023 05:30:20 -0500 (EST) From: Takashi Sakamoto To: linux1394-devel@lists.sourceforge.net, linux-kernel@vger.kernel.org Cc: adamg@pobox.com Subject: [RFC PATCH 3/8] firewire: test: add KUnit test for internal CSR API Date: Sun, 17 Dec 2023 19:30:06 +0900 Message-Id: <20231217103012.41273-4-o-takashi@sakamocchi.jp> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20231217103012.41273-1-o-takashi@sakamocchi.jp> References: <20231217103012.41273-1-o-takashi@sakamocchi.jp> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit The operation over CSR space is important since it is related to detection of nodes and units, addition of system devices. Any test of the operation is enough useful. This commit adds a skeleton of KUnit test for the purpose. Signed-off-by: Takashi Sakamoto --- drivers/firewire/.kunitconfig | 1 + drivers/firewire/Kconfig | 16 ++++++++++++++++ drivers/firewire/core-device.c | 4 ++++ drivers/firewire/csr-api-test.c | 19 +++++++++++++++++++ 4 files changed, 40 insertions(+) create mode 100644 drivers/firewire/csr-api-test.c diff --git a/drivers/firewire/.kunitconfig b/drivers/firewire/.kunitconfig index 1599e069395f..03104cdd06eb 100644 --- a/drivers/firewire/.kunitconfig +++ b/drivers/firewire/.kunitconfig @@ -2,3 +2,4 @@ CONFIG_KUNIT=y CONFIG_PCI=y CONFIG_FIREWIRE=y CONFIG_FIREWIRE_KUNIT_UAPI_TEST=y +CONFIG_FIREWIRE_KUNIT_CSR_API_TEST=y diff --git a/drivers/firewire/Kconfig b/drivers/firewire/Kconfig index 0a6596b027db..184906fdb77a 100644 --- a/drivers/firewire/Kconfig +++ b/drivers/firewire/Kconfig @@ -34,6 +34,22 @@ config FIREWIRE_KUNIT_UAPI_TEST For more information on KUnit and unit tests in general, refer to the KUnit documentation in Documentation/dev-tools/kunit/. +config FIREWIRE_KUNIT_CSR_API_TEST + tristate "KUnit tests for internal CSR API" if !KUNIT_ALL_TESTS + depends on FIREWIRE && KUNIT + default KUNIT_ALL_TESTS + help + This builds the KUnit tests for internal API for Control and + Status Registers. + + KUnit tests run during boot and output the results to the debug + log in TAP format (https://testanything.org/). Only useful for + kernel devs running KUnit test harness and are not for inclusion + into a production build. + + For more information on KUnit and unit tests in general, refer + to the KUnit documentation in Documentation/dev-tools/kunit/. + config FIREWIRE_OHCI tristate "OHCI-1394 controllers" depends on PCI && FIREWIRE && MMU diff --git a/drivers/firewire/core-device.c b/drivers/firewire/core-device.c index 137001f8a695..14c7461c05f6 100644 --- a/drivers/firewire/core-device.c +++ b/drivers/firewire/core-device.c @@ -1313,3 +1313,7 @@ void fw_node_event(struct fw_card *card, struct fw_node *node, int event) break; } } + +#ifdef CONFIG_FIREWIRE_KUNIT_CSR_API_TEST +#include "csr-api-test.c" +#endif diff --git a/drivers/firewire/csr-api-test.c b/drivers/firewire/csr-api-test.c new file mode 100644 index 000000000000..a76d767373e9 --- /dev/null +++ b/drivers/firewire/csr-api-test.c @@ -0,0 +1,19 @@ +// SPDX-License-Identifier: GPL-2.0-only +// +// csr-api-test.c - An application of Kunit to test implementation for CSR operation. +// +// Copyright (c) 2023 Takashi Sakamoto +// +// This file can not be built independently since it is intentionally included in core-device.c. + +#include + +static struct kunit_case csr_api_test_cases[] = { + {} +}; + +static struct kunit_suite csr_api_test_suite = { + .name = "firewire-csr-api", + .test_cases = csr_api_test_cases, +}; +kunit_test_suite(csr_api_test_suite); -- 2.39.2