From patchwork Wed May 31 09:54:01 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marco Pagani X-Patchwork-Id: 10093 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp2769078vqr; Wed, 31 May 2023 03:20:35 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ7ke7y3etwOfdCKjw5oMKR/9g3Rbpv+WtaurdHzGjpCgnsnzLg6JoR4Oi92rUxxBI3YSWMY X-Received: by 2002:a05:6358:e494:b0:123:4843:e7ea with SMTP id by20-20020a056358e49400b001234843e7eamr329305rwb.21.1685528435315; Wed, 31 May 2023 03:20:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1685528435; cv=none; d=google.com; s=arc-20160816; b=rhljWkweHsaic98Xqb4H+sCeRH/r6BNZCburaMEFHtMsO/kHMc2tmS1Jx+yZgIPqK3 PKY9sW0Fxy7G2vpqXAXggQHoyI13YWRBAiBmxEjflJfDQwlYNa0KieOYgubpHF00YXLw VDKhQXaeK1il3kVrrJmcc/iK2kauHp3+5hr1M5grLayiwr77lgNHWA+K1vxQYlvcBfKJ RTJ/tram5qWSU0raU49JqN00wpK6MJzNB/HAUd97O+K3J0MiiRGykC6t9NfQwSaZ0+uk Tg8zmIK+edW45QtTct2dgHaHCJtirQGje/jpr6JrmO7WqcXj/PgM2kNy6wzxUWEy9Rg1 alyw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=4FZ3pIxtK0+0afJMzjTGCDky4aLUv5zQ5hfVyGzhYL8=; b=yyEdpMKx1Y5wg7/rqTWwaTDw9rIncyBvyq38dCxk8x+7//QKSSFOZDOvzn2Jxap6Fp oEzP6KpT7NYZOs8+QH+zi9XdaMlB/Lv1HL1pWWvgg6Tfmkit56j29vGTDbDNXBNViKZH Rs3mccpDjjcBEw9evI8aZ4rndm1PZssaipS6mfGUIw93MzGYeC7FPLrsh+xaQ4mCu5c2 7i7lHpqRu1SiUuCpQPiQyW+PM5FlF0HiMgd1I1wEUWHsQQ6h98NXcVBnQtC3738gwzVc Yi6eVNOl0fu6PyYSIlUiMqe3JxbtSdPbzaScPjmez4ZeIBCcfCgphqI0yLqm6gq1RqIN GtEQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=YwQRAJ3d; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id v14-20020a17090a898e00b00244a45cb5c0si744539pjn.42.2023.05.31.03.20.23; Wed, 31 May 2023 03:20:35 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=YwQRAJ3d; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235051AbjEaJzE (ORCPT + 99 others); Wed, 31 May 2023 05:55:04 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50584 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232671AbjEaJzB (ORCPT ); Wed, 31 May 2023 05:55:01 -0400 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 70EA310F for ; Wed, 31 May 2023 02:54:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1685526853; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=4FZ3pIxtK0+0afJMzjTGCDky4aLUv5zQ5hfVyGzhYL8=; b=YwQRAJ3dpkxPtK8wWDcYT3CviAhZwe/VH51T/AZPXJqHiBpSx91W8AOOyscGD2jZ8XxTHB Fm985OpjcBZqEO9KcArqt9z71PYCXiDBWcmG5e1EiICQHzS7ib0U6b/wp9NzIsNwdBo7/U 5SjMvfzzmnfyQMMG1PuR0vtPDvpZrgQ= Received: from mail-qk1-f197.google.com (mail-qk1-f197.google.com [209.85.222.197]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-518-YxHJRUcYOKeGEUiRyyiiGQ-1; Wed, 31 May 2023 05:54:12 -0400 X-MC-Unique: YxHJRUcYOKeGEUiRyyiiGQ-1 Received: by mail-qk1-f197.google.com with SMTP id af79cd13be357-75b06a31daaso870477085a.2 for ; Wed, 31 May 2023 02:54:12 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1685526852; x=1688118852; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=4FZ3pIxtK0+0afJMzjTGCDky4aLUv5zQ5hfVyGzhYL8=; b=TS1NtNcbzPO2SgULB/SuMCqTQiXtCuVECCsuOrgeHf7ZeTwVszMPSnHDtnR0lcUqZa NzpnBj1VDRHqBlYXy5CoB635aZ7UGFA+UyqCaDX2HLDmQMagaUmgmvTh9X9lrjp6DO/I A0L7h6LJ8Eh0/3Tc4C7VdQw1zAngsfkHxW2VKFuM8wtIuRExhU1gc8ez+ljUCpFSaF5J takO60HCfgqk0QBU2Pd2rcHR+JZjf7DeSKCZgIwdGz8vKkVcp/Ef+aJRkv6ZzVP/MWna MPcPU8MXokWsWIu0csR/ugmggs1oG9QJEsDBPL7P1TsMduH87MAXnZZC8krkMMmUjAYw RYow== X-Gm-Message-State: AC+VfDwRJyfjZ0SOuF0AUulYqGFSdhu1Tjl9T2b3VIGX2M9vlIDH2clw Gk0GIlQohHdtPLHOWuopwJRYwwdGk7m4Lxys172zfbyF+OLYbCECIF0d1VL9ply3aVOpFBqqsh9 jiBZ9bhNB5Ep6rHkLFoicg20= X-Received: by 2002:a37:ad17:0:b0:75b:23a0:dec9 with SMTP id f23-20020a37ad17000000b0075b23a0dec9mr4287379qkm.71.1685526852231; Wed, 31 May 2023 02:54:12 -0700 (PDT) X-Received: by 2002:a37:ad17:0:b0:75b:23a0:dec9 with SMTP id f23-20020a37ad17000000b0075b23a0dec9mr4287364qkm.71.1685526851983; Wed, 31 May 2023 02:54:11 -0700 (PDT) Received: from klayman.redhat.com (net-2-34-28-169.cust.vodafonedsl.it. [2.34.28.169]) by smtp.gmail.com with ESMTPSA id k25-20020a05620a139900b0074def53eca5sm4902404qki.53.2023.05.31.02.54.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 31 May 2023 02:54:11 -0700 (PDT) From: Marco Pagani To: Moritz Fischer , Wu Hao , Xu Yilun , Tom Rix Cc: Marco Pagani , linux-kernel@vger.kernel.org, linux-fpga@vger.kernel.org Subject: [RFC PATCH v6 0/4] fpga: add initial KUnit tests for the subsystem Date: Wed, 31 May 2023 11:54:01 +0200 Message-Id: <20230531095405.342080-1-marpagan@redhat.com> X-Mailer: git-send-email 2.40.1 MIME-Version: 1.0 X-Spam-Status: No, score=-2.3 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_NONE,T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1767404664941778025?= X-GMAIL-MSGID: =?utf-8?q?1767404664941778025?= This patch set introduces initial KUnit test suites for the core components of the FPGA subsystem. Tests can be run using: [user@localhost linux]$ ./tools/testing/kunit/kunit.py run --kunitconfig=drivers/fpga/tests v6: - Restructured the code into self-contained test modules - Added tests for the basic behaviors of the components - Improved programming tests for the FPGA Manager - Fixed code/comments mismatch in the list of Bridges test case v5: - Removed most of the exported functions using shared buffers for stats - Moved all KUnit expectations/assertions to the main test module - Removed standalone use case to simplify the code - Removed instances counters from fake components (using device.id instead) - Set header size in the .parse_header op - Improved bridge get_put_list test case v4: - Fix build error v3: - Calling fpga_bridges_put() between reconfigurations - Functions for registering fake modules allocate and return context structs v2: - Restructured code into multiple suites to test components in isolation - Reduced code duplication using init and exit methods - Using a get_bridges() method to build the list of bridges just before programming - Regions and Bridges are organized topologically - Changed bitstream/bit to images - Allocate images dynamically - Renamed fpga-tests to fpga-test - Simplified Kconfig - Add license info to the fpga-test module Marco Pagani (4): fpga: add an initial KUnit suite for the FPGA Manager fpga: add an initial KUnit suite for the FPGA Bridge fpga: add an initial KUnit suite for the FPGA Region fpga: add configuration for the KUnit test suites. drivers/fpga/Kconfig | 2 + drivers/fpga/Makefile | 3 + drivers/fpga/tests/.kunitconfig | 5 + drivers/fpga/tests/Kconfig | 11 + drivers/fpga/tests/Makefile | 5 + drivers/fpga/tests/fpga-bridge-test.c | 164 +++++++++++++++ drivers/fpga/tests/fpga-mgr-test.c | 289 ++++++++++++++++++++++++++ drivers/fpga/tests/fpga-region-test.c | 186 +++++++++++++++++ 8 files changed, 665 insertions(+) create mode 100644 drivers/fpga/tests/.kunitconfig create mode 100644 drivers/fpga/tests/Kconfig create mode 100644 drivers/fpga/tests/Makefile create mode 100644 drivers/fpga/tests/fpga-bridge-test.c create mode 100644 drivers/fpga/tests/fpga-mgr-test.c create mode 100644 drivers/fpga/tests/fpga-region-test.c base-commit: 7877cb91f1081754a1487c144d85dc0d2e2e7fc4