Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp22730720rwd; Fri, 30 Jun 2023 11:46:54 -0700 (PDT) X-Google-Smtp-Source: APBJJlHuIlV5uuPfzxAQgACu7tp/3lu6izbAZlYFhNACyhI8LDaAUlKtDPsFBrCTDCyeFSLBPvc7 X-Received: by 2002:a17:90a:ac01:b0:263:70d5:6d60 with SMTP id o1-20020a17090aac0100b0026370d56d60mr2380283pjq.30.1688150814266; Fri, 30 Jun 2023 11:46:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1688150814; cv=none; d=google.com; s=arc-20160816; b=DKPGJLG0v5ymzKrgjrvYUku70SIc6WBEoZ3j5m4lG/W8Sg7igwK+aVx3Gqm+aJzQQb 62ciJ5StJTUaB88nFKa6SOa86xFIwY1VJtSAQX9/4okGUustJscF8XeYAEDAU18u5pmz dPWBQaBWW1krvOK3pKhGq8sHa1rsP9jdmIAJnHkhuhFxgBFKEBJB6SZzttOtmM6ttGeU ZRlkcwcPoeIUN6ar8hu8cGwQF1ogTjPAkElAEiCcyvy97jiPGqi13Bw3ewM3RxjrLFpx a0Y/NpQTjriAU4OLRg/UDMLeVq3nwLtPKj4TtqrHzYCfsQwKMwfVBTrUqQkdiLLHhBoQ G/UA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:feedback-id :dkim-signature; bh=UqvAUyb2tsPBhVSd0pIEgVQNyRCdhhmwRegA/E/fvz0=; fh=v5jlfsdYqO824y9aw7pv7qQGEU8OB/McF4wSpXymCMc=; b=oW3m184n3pUCvgdHvFMMtM7aDfD2jPIk9GRyZp/92QvAW4tzUbuyQn5Uu3KFliyZ1q bxXvpRJ6x7b/qChcTk2qDBkpzdpZN4mEZ7FWBuNBL9P8d55CyllIIHoE2Kf1F8Ycvs/r 9N1x6rXCfJREDusXRfSMGySvOjF95yuhhdTfBdHm9nKqNNcViA0AVKDit8WLcGovsRFT 203ljQPKA3tiesZV9uir1hnp5KUENxh+cZNiBE6noWsKRL+VycU3KixqyeWdF2m6MDyy vz9CVBPOet4OCcjQYQYHYMtHJ+GW1epK3WUJuvf17G6LQJ6kF3apW4GPJ3IdtknEpfOm QMUw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20221208 header.b=duN6wGf0; 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=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id s138-20020a632c90000000b0055ae207577csi9598045pgs.650.2023.06.30.11.46.39; Fri, 30 Jun 2023 11:46:54 -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=@gmail.com header.s=20221208 header.b=duN6wGf0; 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=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233001AbjF3SSF (ORCPT + 99 others); Fri, 30 Jun 2023 14:18:05 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35326 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232361AbjF3SSE (ORCPT ); Fri, 30 Jun 2023 14:18:04 -0400 Received: from mail-ej1-x62d.google.com (mail-ej1-x62d.google.com [IPv6:2a00:1450:4864:20::62d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CA0AE3AA7; Fri, 30 Jun 2023 11:18:02 -0700 (PDT) Received: by mail-ej1-x62d.google.com with SMTP id a640c23a62f3a-9926623e367so253298466b.0; Fri, 30 Jun 2023 11:18:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1688149081; x=1690741081; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:feedback-id:from:to:cc:subject:date :message-id:reply-to; bh=UqvAUyb2tsPBhVSd0pIEgVQNyRCdhhmwRegA/E/fvz0=; b=duN6wGf0bxxTJFbCNwVHPjr7piWFkTJPQZgv1afCEzKQwDw2lMrEF4OAbr2HfhaUYO jh1l0QSgxaxHS98eIs1HPD6HdKQIHWxS+07MIZxUX/1iFNd9QHrzRh2dAeD6EGhY48/a lDu1N5z37d2hHaPoFA9FAzXklnk7gw/2jVeZKpiHZ/UsT8NYih5egxqa1LM46oK2CRn2 0yquiQaU1DnmIP6JZXLb1G6mjm7s/1amNXQGGLuWXC+75LdLsQFlwtUbJfV2X3Qnoo1d fogyq6pGmOxyC3U8EdekDn4KS7hP0zlhLulQVu1kqHoExtNaH+fbsskVmMt+BExs4div KoLw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1688149081; x=1690741081; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:feedback-id:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=UqvAUyb2tsPBhVSd0pIEgVQNyRCdhhmwRegA/E/fvz0=; b=fdkjAAs4J6U3yq9k/8nv67NlOpMY7rTDK+qgvyNupqgNl1KcJCL/Oybk0my5DfCO3g 8/Pvm72guToAcdqVSa80UIGYaeW6WFHCSNNiQUAR5gs8mRhLqFWmmpfbxxu20lppEsux xHTSR2+4P8GM2bkEKxL48LxECupDpqrJRVBpNRz1+aHjtqFRLrYCedXvOXQqV39ERFz0 b7D42V7bLzCg0oE70s7oISWF7PpuicE/sIkGUM+BT1hII2NozsRsBPB9Gy2mDN+zyYm+ q2zWYVOV8au0Ep2gEYA7ICo7a59/PFrj+GxYHBbAXPJvUhofGUeEUSqCRYehfsFa6oVk x+Jg== X-Gm-Message-State: ABy/qLZdTuT+F7hHcai98N52+5ArHDgfTIBthAV9teEXTlMGhz4rjyLi FWgq6K0Le4JxeKvJS4h6pn4= X-Received: by 2002:a17:906:4e52:b0:992:9a5e:3172 with SMTP id g18-20020a1709064e5200b009929a5e3172mr2089125ejw.59.1688149080879; Fri, 30 Jun 2023 11:18:00 -0700 (PDT) Received: from auth2-smtp.messagingengine.com (auth2-smtp.messagingengine.com. [66.111.4.228]) by smtp.gmail.com with ESMTPSA id qp7-20020a170907206700b0098d0c01d9aasm8319773ejb.87.2023.06.30.11.17.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 30 Jun 2023 11:18:00 -0700 (PDT) Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailauth.nyi.internal (Postfix) with ESMTP id 86A5827C0071; Fri, 30 Jun 2023 14:17:57 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute4.internal (MEProxy); Fri, 30 Jun 2023 14:17:57 -0400 X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedviedrtdeigdduvdduucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhepfffhvfevuffkfhggtggujgesthdtredttddtvdenucfhrhhomhepuehoqhhu nhcuhfgvnhhguceosghoqhhunhdrfhgvnhhgsehgmhgrihhlrdgtohhmqeenucggtffrrg htthgvrhhnpeehudfgudffffetuedtvdehueevledvhfelleeivedtgeeuhfegueeviedu ffeivdenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpe gsohhquhhnodhmvghsmhhtphgruhhthhhpvghrshhonhgrlhhithihqdeiledvgeehtdei gedqudejjeekheehhedvqdgsohhquhhnrdhfvghngheppehgmhgrihhlrdgtohhmsehfih igmhgvrdhnrghmvg X-ME-Proxy: Feedback-ID: iad51458e:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Fri, 30 Jun 2023 14:17:53 -0400 (EDT) Date: Fri, 30 Jun 2023 11:17:25 -0700 From: Boqun Feng To: Miguel Ojeda Cc: David Gow , Brendan Higgins , Wedson Almeida Filho , Alex Gaynor , Gary Guo , =?iso-8859-1?Q?Bj=F6rn?= Roy Baron , 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: Re: [PATCH 5/6] rust: support running Rust documentation tests as KUnit ones Message-ID: References: <20230614180837.630180-1-ojeda@kernel.org> <20230614180837.630180-6-ojeda@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20230614180837.630180-6-ojeda@kernel.org> X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE 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 On Wed, Jun 14, 2023 at 08:08:29PM +0200, Miguel Ojeda wrote: > diff --git a/rust/helpers.c b/rust/helpers.c > index bb594da56137..49a5e1a4f0ae 100644 > --- a/rust/helpers.c > +++ b/rust/helpers.c > @@ -18,6 +18,7 @@ > * accidentally exposed. > */ > > +#include When CONFIG_KUNIT=n, the above file is mostly just a function that returns "NULL", however, since "NULL" is not defined: kunit/test-bug.h includes nothing if CONFIG_KUNIT=n, bindgen is not happy about it: ./include/kunit/test-bug.h:63:67: error: use of undeclared identifier 'NULL' , we can fix this in Rust side by adding linux/stddef.h before kunit/test-bug.h as below, but maybe it's better fixed inside kunit/test-bug.h? Regards, Boqun -------------------------------->8 diff --git a/rust/helpers.c b/rust/helpers.c index 49a5e1a4f0ae..048d11c7d796 100644 --- a/rust/helpers.c +++ b/rust/helpers.c @@ -18,6 +18,7 @@ * accidentally exposed. */ +#include #include #include #include > #include > #include > #include > @@ -135,6 +136,12 @@ void rust_helper_put_task_struct(struct task_struct *t) > } > EXPORT_SYMBOL_GPL(rust_helper_put_task_struct); > > +struct kunit *rust_helper_kunit_get_current_test(void) > +{ > + return kunit_get_current_test(); > +} > +EXPORT_SYMBOL_GPL(rust_helper_kunit_get_current_test); > + > /* > * We use `bindgen`'s `--size_t-is-usize` option to bind the C `size_t` type > * as the Rust `usize` type, so we can use it in contexts where Rust