From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-wm1-f74.google.com (mail-wm1-f74.google.com [209.85.128.74]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 590B31FDE31 for ; Thu, 16 Apr 2026 06:59:49 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.74 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1776322790; cv=none; b=ZHrpSR7tOZVNI/ODgntuMtrdiSxy2kB1i4D8PFLGROHPhYHKlI4oG3b1ifxmc9ox3VQipkMPeC/sfyXUrRDGxbleaOJxVa846M1TIKQkprUxTx2f9js22PkEbHWqWgREa9XXV3a8QLk3KCYQith+3dvLKBU7UXGSycM80okJQpI= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1776322790; c=relaxed/simple; bh=osa/wtOqVSu/A+mS8MJxXf1eJNAapoVRgn26WEjvBmQ=; h=Date:In-Reply-To:Mime-Version:References:Message-ID:Subject:From: To:Cc:Content-Type; b=NeG6AdGTr5IYCYtzyny0QTEGS0ieDaVURam6YxWg+rNTpVuhY0i/UhvvpEuoekFDAkEXJxmFVRSvSWcya3Id8TITwYIWfkIHMakUHzja9uEddI8cpPjdK6gPb4/dnvBtBo6FK+FqgINzjqNgk6Uy+A7igMoPR/pOGkIO12SsSPE= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=flex--aliceryhl.bounces.google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=pebqwl4w; arc=none smtp.client-ip=209.85.128.74 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=flex--aliceryhl.bounces.google.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="pebqwl4w" Received: by mail-wm1-f74.google.com with SMTP id 5b1f17b1804b1-488e12db7e0so44868315e9.3 for ; Wed, 15 Apr 2026 23:59:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20251104; t=1776322788; x=1776927588; darn=vger.kernel.org; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:from:to:cc:subject:date:message-id:reply-to; bh=p5aFmDnuvFPblx4c0gjd64DFbv9jYF68Xx/BpImY+Xk=; b=pebqwl4wk3XglnhLiwd85MS0nfs2OvZkLwFUiOyRdfwCQYRp28wc84LQakIyjxa6qj jUAI0tOuboI9CVV2NBl7fJS7MJz9v1DO3WZuw1Ol5jCK78fRIHvkH/mFGu7ZaSoIAvfF zefjjs03znlvg1pD7tgpwmH+mWKYAburd5Rcoa1dosUhWB+fuAHCMAhesdu5q8I984zR YywXPuHmRvETT/9FMnzi2aDTqfoCgUaIGRY7Gk6ldOBl6b89irSB6NQAYXkt78RK7A08 HJrnDqANwt3uCjqphW0lFqVB8MoMs57KrW4RsJHGtmfFE0d+TU+oKgX8aAQiXQRk4REJ n9bw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1776322788; x=1776927588; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=p5aFmDnuvFPblx4c0gjd64DFbv9jYF68Xx/BpImY+Xk=; b=Zjc2TBhkrWJg+nK4MawyVfB++azzmnPjFZQ7tpPMvUjL70ANHVlPPVr4n91ry+1xBm xWVGAWq+YA9/sTg+txH6Vo1+08P8S6qBbVdwa2W/loOL4UEkBpfpNVrluVqe4VBoXzcp cFgnm5PD8CCt8eaqLVh46SAonOjw5dKSenH1fhc6582KDn3ly5DPTB2DFTqaDfl84Qdx MAsPhorSbks98pl5BbPStVQxyPj1YQSCku+9j2KO7up1Ffj74H2rzAPnnjnpzr+ZX4RI uStwTXGKAuap6xhNCEk/G3YHNeb38yPaLluvu9xK692eN4ZNN+qQrkFMjH+KG+Pugi7B PlJw== X-Forwarded-Encrypted: i=1; AFNElJ8gySYkvKlltvK8wvZnqCZL+VzEhXSYGWVWL/EYp5AeEv6rrwHx3H9FRlV+CKY8X2Z0nY1X4tMPiA+0tiI=@vger.kernel.org X-Gm-Message-State: AOJu0Yy2U4bSi2pouUtink2Ho3cRafQxY5pFcD14JC1SRfSzEZD2IsSW bW3d3/YBL8cfjAybgVuyG/GhvUK75EMf1fYZyxGyT2XlVYTwseKhBLpXDw03VGfo06AHW32C1WZ LF++SEDVEOcqonrav4g== X-Received: from wmbgz10.prod.google.com ([2002:a05:600c:888a:b0:488:e127:aca1]) (user=aliceryhl job=prod-delivery.src-stubby-dispatcher) by 2002:a05:600c:a415:b0:487:1108:48af with SMTP id 5b1f17b1804b1-488d67bf7c7mr256452475e9.4.1776322787516; Wed, 15 Apr 2026 23:59:47 -0700 (PDT) Date: Thu, 16 Apr 2026 06:59:46 +0000 In-Reply-To: Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 References: <20260409-bitfield-v2-0-23ac400071cb@nvidia.com> <20260409-bitfield-v2-2-23ac400071cb@nvidia.com> Message-ID: Subject: Re: [PATCH v2 2/3] rust: bitfield: Add KUNIT tests for bitfield From: Alice Ryhl To: Yury Norov Cc: Alexandre Courbot , Joel Fernandes , Yury Norov , Miguel Ojeda , Boqun Feng , Gary Guo , "=?utf-8?B?QmrDtnJu?= Roy Baron" , Benno Lossin , Andreas Hindborg , Trevor Gross , Danilo Krummrich , Daniel Almeida , David Airlie , Simona Vetter , John Hubbard , Alistair Popple , Timur Tabi , Zhi Wang , Eliot Courtney , linux-kernel@vger.kernel.org, rust-for-linux@vger.kernel.org, driver-core@lists.linux.dev, dri-devel@lists.freedesktop.org Content-Type: text/plain; charset="utf-8" On Wed, Apr 15, 2026 at 10:44:01PM -0400, Yury Norov wrote: > On Thu, Apr 09, 2026 at 11:58:48PM +0900, Alexandre Courbot wrote: > > From: Joel Fernandes > > > > Add KUNIT tests to make sure the macro is working correctly. > > > > Signed-off-by: Joel Fernandes > > [acourbot: update code to latest bitfield! macro.] > > Signed-off-by: Alexandre Courbot > > --- > > rust/kernel/bitfield.rs | 318 ++++++++++++++++++++++++++++++++++++++++++++++++ > > 1 file changed, 318 insertions(+) > > > > diff --git a/rust/kernel/bitfield.rs b/rust/kernel/bitfield.rs > > index f5948eec8a76..9ab8dafff36c 100644 > > --- a/rust/kernel/bitfield.rs > > +++ b/rust/kernel/bitfield.rs > > @@ -489,3 +489,321 @@ fn fmt(&self, f: &mut ::kernel::fmt::Formatter<'_>) -> ::kernel::fmt::Result { > > } > > }; > > } > > + > > +#[::kernel::macros::kunit_tests(kernel_bitfield)] > > Reading the Documentation/rust/testing.rst, and can't understand how > should one configure it to _not_ build the tests? This should be the > default behavior. > > There's half a dozen already existing unit tests, and I didn't find > a mechanism to individually control them. If you want this set of kunit tests to have its own config option, then you can declare a Kconfig option for it and do this: #[cfg(CONFIG_MY_RUST_KCONFIG_OPTION)] #[kunit_tests(kernel_bitfield)] mod tests { ... } Alice