Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp5598rwd; Wed, 14 Jun 2023 11:19:37 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ5nx74SrnRMwDgAmwbRnDA4g/6TgDDoSoylcSGsrwNQz6c0imcHLq3EqJT6dgD2PqfDJj/D X-Received: by 2002:a05:6a20:72ac:b0:10c:2349:459d with SMTP id o44-20020a056a2072ac00b0010c2349459dmr2942135pzk.11.1686766777553; Wed, 14 Jun 2023 11:19:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1686766777; cv=none; d=google.com; s=arc-20160816; b=doWNfs/H+5QcR4beaBnq0WFex3+3+bgENonRkx9wFueXX09bV4snnBjkkxO8ZS2xoI r/EfTd2J2+HbFaB47BFI60/zDelQKJ2VCki/YyQEKE+nej5TuR/VXB+F2d00gwiRwJcT tMSNijglrwFriZl2Ec1rDVuwRXNZpC6N//Q97/XyOWx29q4eV2IedIPrYCZ1JZVk6Bk3 ThyBGZJk0YyHahUAXhNL1tSbxmTfsuZj79YSDGOBIs+DfE+5tbG4PZ+M1lwH//TUpnvm FtgGr2hBSL10TVCi2oC6ELycw33i9RKWbPF1/+Z2qjUXr06luBETBtk77ltDhqkPv1EZ /rrQ== 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=mey2i7qFB4jjn3mjcf4L+HbHEw1hILJTxAwExZqmi5U=; b=FYq7tSPOupRSlOjmHYxZVgA49OA4pHprkg88Ow7l9AdRpHK/CmVh0+J18uNlK04oGt u0SXSDBa9SjnHryNP7UWUzwAwupuuXGrBV4sOYDbrNfsZ5BPvzAdeELF2f3LitZWHFza hSCS3L+V9UwJuwsbxbxeziwvXlPCn9vVGguOYUf6rG1X5s3BmltEtCUJMPRcVg+dOA3b SOjjIT/Jc/PDegXTkbrJPHKMHwicgvV5BxOVszsnOaN6MdPpqbZBHkhpCb7cFNVaIuQ8 u8qWq0j54qCVJ2roA7Hle4L/ngVntrl0ROUeeL7p6xD88Nd7HzwLAYRNj0O1SpClLQN0 1R1g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=T0w5Clw6; 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=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id z189-20020a6333c6000000b00543ec968227si10891602pgz.289.2023.06.14.11.19.24; Wed, 14 Jun 2023 11:19:37 -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=@kernel.org header.s=k20201202 header.b=T0w5Clw6; 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=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233242AbjFNSLN (ORCPT + 99 others); Wed, 14 Jun 2023 14:11:13 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38922 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240402AbjFNSKu (ORCPT ); Wed, 14 Jun 2023 14:10:50 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 18FCD30C4; Wed, 14 Jun 2023 11:10:16 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 427A16455E; Wed, 14 Jun 2023 18:09:22 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id EAA94C433C0; Wed, 14 Jun 2023 18:09:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1686766161; bh=fXHMpfERvexjC1cBZRBzlkhrqEdvS6t8XukfGExQ9rE=; h=From:To:Cc:Subject:Date:From; b=T0w5Clw6D4NpCHTogWpArssUXW2986IdhYro40TmZhV+LtKFz6dSaRaikAvt5XheN gns0l1bPss9Nt4D/PIWJTOti/EYwrF5vvVwflkW8e5n1OccZ39RQNJ9l4K29zn/qQ0 Yhc31ewVSDSm5RRWPdKyHSSFaFETQYbBMr2xeZh+9eYsg5ov906SSTX52WUs38mQtF AAaZlNB2T49Ix361pzTvDWu0aqP/ZDnjPAlSTdJzy3QgCUYIZaua0jK/tzd4TuS17p 0DRXPAM1lXrOe1bf0wqzLqcfJXNaIrXp85SBe8sLyJIgec60v35blJICTjgZAAh/Wq veL2T6ul3pjPw== From: Miguel Ojeda To: David Gow , Brendan Higgins , Miguel Ojeda , Wedson Almeida Filho , Alex Gaynor Cc: Boqun Feng , Gary Guo , =?UTF-8?q?Bj=C3=B6rn=20Roy=20Baron?= , Benno Lossin , Alice Ryhl , Andreas Hindborg , Philip Li , kunit-dev@googlegroups.com, linux-kselftest@vger.kernel.org, rust-for-linux@vger.kernel.org, linux-kernel@vger.kernel.org, patches@lists.linux.dev Subject: [PATCH 0/6] KUnit integration for Rust doctests Date: Wed, 14 Jun 2023 20:08:24 +0200 Message-ID: <20230614180837.630180-1-ojeda@kernel.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS,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 is the initial KUnit integration for running Rust documentation tests within the kernel. Thank you to the KUnit team for all the input and feedback on this over the months, as well as the Intel LKP 0-Day team! This may be merged through either the KUnit or the Rust trees. If the KUnit team wants to merge it, then that would be great. Please see the message in the main commit for the details. Miguel Ojeda (6): rust: init: make doctests compilable/testable rust: str: make doctests compilable/testable rust: sync: make doctests compilable/testable rust: types: make doctests compilable/testable rust: support running Rust documentation tests as KUnit ones MAINTAINERS: add Rust KUnit files to the KUnit entry MAINTAINERS | 2 + lib/Kconfig.debug | 13 +++ rust/.gitignore | 2 + rust/Makefile | 29 ++++++ rust/bindings/bindings_helper.h | 1 + rust/helpers.c | 7 ++ rust/kernel/init.rs | 25 +++-- rust/kernel/kunit.rs | 156 ++++++++++++++++++++++++++++ rust/kernel/lib.rs | 2 + rust/kernel/str.rs | 4 +- rust/kernel/sync/arc.rs | 9 +- rust/kernel/sync/lock/mutex.rs | 1 + rust/kernel/sync/lock/spinlock.rs | 1 + rust/kernel/types.rs | 6 +- scripts/.gitignore | 2 + scripts/Makefile | 4 + scripts/rustdoc_test_builder.rs | 73 ++++++++++++++ scripts/rustdoc_test_gen.rs | 162 ++++++++++++++++++++++++++++++ 18 files changed, 484 insertions(+), 15 deletions(-) create mode 100644 rust/kernel/kunit.rs create mode 100644 scripts/rustdoc_test_builder.rs create mode 100644 scripts/rustdoc_test_gen.rs base-commit: d2e3115d717197cb2bc020dd1f06b06538474ac3 -- 2.41.0