Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp2851449rwd; Fri, 16 Jun 2023 09:00:49 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ4z2PyRIuimUaNhS5GL45aw+4Oosl+GJ7sdEi3M4qlcaH3B/rD7EDBLCp/x5W7QU1eZYi2q X-Received: by 2002:a17:90a:19ca:b0:25e:c008:5df5 with SMTP id 10-20020a17090a19ca00b0025ec0085df5mr1101144pjj.2.1686931249521; Fri, 16 Jun 2023 09:00:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1686931249; cv=none; d=google.com; s=arc-20160816; b=PaVC/3rUeUzcMoU/wRNT74lV0R3pSAFpaSKT37wqbB+6jjGBqoPEeaF6ET5xZInL0d hY/azFD+pGUx2bmAzNgi5Y6sJYO557vY/2D7EVu1w+eOOI9pvFcpai3+B1B63vo0zsNt AXcL45jwVpvgs/Amg2vT4j4B67wZlJdsLw9koIHadXxfor4u5caeXkHukrPnU4LGqCRY gG+DBnHtKwW7eZzpxPH4GShKC4CKUaz6BVl6EDoTHPRFOCR9sJLvd6384crngnB4P3b7 jZpc5lwqaU+WKv0UFM86mtG+yigoULg+XF2736UtcY+Pcmi2+Kcn46ivZWk3T0R4kv3b y4xw== 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=+g1pX8kL0ywRot5Ot6dsLwBfrWbbWL9qZYh2h2zCWlA=; b=oWNBIas0kKeJlQ5YM3gMAuYJugUqTb+g3HSXMj8lg0xNXIiUGBbn6Zn2VDhorfZKU7 sC5INgijiD8vbzgvJ257zT2uCg9ugAHxSPaXovZDJiTNQAk/MAvyBpfCYb8r/Cyn7bA4 4kwLMQQaexVwPX0DfsUYEo8oY5BEsW2YeSC67eCmXPkmuUeVhyx5Bc1FwRxwyzymsOX2 DJB+XfAkCpSiaxSnHmE/tVjvwmP9u5k7U5AeXEeFAso1/yxBSvlLaJQFQiBBQzjCukYm O0hHkVtzNeM7vmQfIN5FpKEAE6Oq9ZxuQb+uA3rc9eMTXgA6f5gU0Hzl2+S/IRJVY0VK TmZw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=a15J1dRV; 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id f15-20020a17090a664f00b0024c1ddfa1bfsi1830540pjm.92.2023.06.16.09.00.35; Fri, 16 Jun 2023 09:00:49 -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=a15J1dRV; 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 S1345097AbjFPPpX (ORCPT + 99 others); Fri, 16 Jun 2023 11:45:23 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55082 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1346123AbjFPPpK (ORCPT ); Fri, 16 Jun 2023 11:45:10 -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 759C0295C for ; Fri, 16 Jun 2023 08:44:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1686930259; 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=+g1pX8kL0ywRot5Ot6dsLwBfrWbbWL9qZYh2h2zCWlA=; b=a15J1dRVsesGqDNCepfiPPIai5biI0J9iVJUO9aX9hkjz0nlW0KDKqUzdrqIAtM25l4Umo OHFXTH6PRjGR4LSx0O7Jq5O7Lo1/Hxg2xeKTHHFIZN3LDAO9sZTLwBuGIsdimn/IDo3jAe bZvEfDAfhbbe1q1RJNUL4IHA1tLF4aY= Received: from mail-qk1-f198.google.com (mail-qk1-f198.google.com [209.85.222.198]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-358-WqvzgqaXO56kNJ1qLK2WrQ-1; Fri, 16 Jun 2023 11:44:18 -0400 X-MC-Unique: WqvzgqaXO56kNJ1qLK2WrQ-1 Received: by mail-qk1-f198.google.com with SMTP id af79cd13be357-75caeec5545so148408885a.0 for ; Fri, 16 Jun 2023 08:44:18 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1686930258; x=1689522258; 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=+g1pX8kL0ywRot5Ot6dsLwBfrWbbWL9qZYh2h2zCWlA=; b=T0ze/68ozq0AQigBd4fEolxWzUiMXmdqJx374y9SmH1BklyFrndKHFkN1nzPjuJ/aL JecJLwjrqQqIGnjqCDYV7jqmKrZUhCccM8S5te+b9OqU5E/97KHo7EqGQCth/Knh7Sbo sbtXAGyfSlwXe2lo7t1bTWtBMtesUQVA6ZGmzl72p4tIwKtAuj52kr9ENzB9lQ8FrKin iaX4nRTaq+svUP0wFEf9mHzgGvCjuJm9y5SaXK8ruvD3hgodgBYprFD6wUf0ZXdguYVE RS9oB6jOawCwAMcbsuATekdA7JSE5TjeEwjYXoeUCPKa4CrqXgZiaEzwJd9TJy7WaXvA Omrg== X-Gm-Message-State: AC+VfDwLzPe31Efm2iZapKDuOXOFZ7pTiQtxwZDQVNbO8h0CLIqsunNR yFjB8zEkAQj4ZVFQvNahBZsS3gaW0Mqbz4GXKHXQ/62ttTurkN6aB76oAaRb62d+mvHEcxFzirP S61TTyYIvnFj73Vz1HF89Kok= X-Received: by 2002:a05:620a:8d09:b0:75f:2c0:8e6b with SMTP id rb9-20020a05620a8d0900b0075f02c08e6bmr1736544qkn.43.1686930258275; Fri, 16 Jun 2023 08:44:18 -0700 (PDT) X-Received: by 2002:a05:620a:8d09:b0:75f:2c0:8e6b with SMTP id rb9-20020a05620a8d0900b0075f02c08e6bmr1736528qkn.43.1686930258049; Fri, 16 Jun 2023 08:44:18 -0700 (PDT) Received: from klayman.redhat.com (net-2-34-28-201.cust.vodafonedsl.it. [2.34.28.201]) by smtp.gmail.com with ESMTPSA id 27-20020a05620a079b00b007607ecd58ecsm4436931qka.59.2023.06.16.08.44.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 16 Jun 2023 08:44:17 -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: [PATCH v7 0/4] fpga: add initial KUnit tests for the subsystem Date: Fri, 16 Jun 2023 17:44:01 +0200 Message-Id: <20230616154405.220502-1-marpagan@redhat.com> X-Mailer: git-send-email 2.40.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H5,RCVD_IN_MSPIKE_WL,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 This patch set introduces an initial set of 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 v7: - Dropped RFC prefix - Add comments to explain fakes and helper functions - Changed the implementation of the Bridge used in the Region suite 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 FPGA 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 | 175 +++++++++++++++ drivers/fpga/tests/fpga-mgr-test.c | 302 ++++++++++++++++++++++++++ drivers/fpga/tests/fpga-region-test.c | 211 ++++++++++++++++++ 8 files changed, 714 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: 858fd168a95c5b9669aac8db6c14a9aeab446375 -- 2.40.1