[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20240704145607.17732-2-ethan.twardy@gmail.com>
Date: Thu, 4 Jul 2024 09:55:42 -0500
From: "Ethan D. Twardy" <ethan.twardy@...il.com>
To: Miguel Ojeda <ojeda@...nel.org>,
Alex Gaynor <alex.gaynor@...il.com>,
Wedson Almeida Filho <wedsonaf@...il.com>,
Boqun Feng <boqun.feng@...il.com>,
Gary Guo <gary@...yguo.net>,
Björn Roy Baron <bjorn3_gh@...tonmail.com>,
Benno Lossin <benno.lossin@...ton.me>,
Andreas Hindborg <a.hindborg@...sung.com>,
Alice Ryhl <aliceryhl@...gle.com>,
Martin Rodriguez Reboredo <yakoyoku@...il.com>,
"Ethan D. Twardy" <ethan.twardy@...il.com>,
Trevor Gross <tmgross@...ch.edu>,
Aswin Unnikrishnan <aswinunni01@...il.com>,
rust-for-linux@...r.kernel.org (open list:RUST),
linux-kernel@...r.kernel.org (open list)
Subject: [PATCH v3 1/4] kbuild: rust: Expand rusttest target for macros
Previously, the rusttest target for the macros crate did not specify
the dependencies necessary to run the rustdoc tests. These test rely on
the kernel crate, so add a specialized rustdoc tests command for this
particular crate.
Signed-off-by: Ethan D. Twardy <ethan.twardy@...il.com>
diff --git a/rust/Makefile b/rust/Makefile
index f70d5e244fee..df389df4db9c 100644
--- a/rust/Makefile
+++ b/rust/Makefile
@@ -147,6 +147,15 @@ rusttestlib-macros: private rustc_test_library_proc = yes
rusttestlib-macros: $(src)/macros/lib.rs rusttest-prepare FORCE
+$(call if_changed,rustc_test_library)
+rusttestlib-kernel: private rustc_target_flags = --extern alloc \
+ --extern build_error --extern macros=$(objtree)/$(obj)/libmacros.so \
+ --extern bindings --extern uapi
+rusttestlib-kernel: $(src)/kernel/lib.rs rustdoc-compiler_builtins \
+ rustdoc-alloc rusttestlib-bindings rusttestlib-uapi rusttestlib-build_error \
+ $(obj)/libmacros.so \
+ $(obj)/bindings.o FORCE
+ +$(call if_changed,rustc_test_library)
+
rusttestlib-bindings: $(src)/bindings/lib.rs rusttest-prepare FORCE
+$(call if_changed,rustc_test_library)
@@ -245,11 +254,24 @@ quiet_cmd_rustsysroot = RUSTSYSROOT
rusttest-prepare: FORCE
+$(call if_changed,rustsysroot)
-rusttest-macros: private rustc_target_flags = --extern proc_macro
+quiet_cmd_rustdoc_test_macros = RUSTDOC T $<
+ cmd_rustdoc_test_macros = \
+ OBJTREE=$(abspath $(objtree)) \
+ $(RUSTDOC) --test $(rust_common_flags) \
+ @$(objtree)/include/generated/rustc_cfg \
+ $(rustc_target_flags) $(rustdoc_test_target_flags) \
+ --sysroot $(objtree)/$(obj)/test/sysroot $(rustdoc_test_quiet) \
+ -L$(objtree)/$(obj)/test --output $(rustdoc_output) \
+ -Zproc-macro-backtrace \
+ --crate-name $(subst rusttest-,,$@) $<
+
+rusttest-macros: private rustc_target_flags = --extern proc_macro \
+ --extern macros=$(objtree)/$(obj)/libmacros.so --extern kernel
rusttest-macros: private rustdoc_test_target_flags = --crate-type proc-macro
-rusttest-macros: $(src)/macros/lib.rs rusttest-prepare FORCE
+rusttest-macros: $(src)/macros/lib.rs rusttest-prepare \
+ rusttestlib-macros rusttestlib-kernel FORCE
+$(call if_changed,rustc_test)
- +$(call if_changed,rustdoc_test)
+ +$(call if_changed,rustdoc_test_macros)
rusttest-kernel: private rustc_target_flags = --extern alloc \
--extern build_error --extern macros --extern bindings --extern uapi
--
2.44.2
Powered by blists - more mailing lists