[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20240624030327.90301-2-ethan.twardy@gmail.com>
Date: Sun, 23 Jun 2024 22:03:03 -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>,
Aswin Unnikrishnan <aswinunni01@...il.com>,
Trevor Gross <tmgross@...ch.edu>,
rust-for-linux@...r.kernel.org (open list:RUST),
linux-kernel@...r.kernel.org (open list)
Subject: [PATCH 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..de58f0cae23b 100644
--- a/rust/Makefile
+++ b/rust/Makefile
@@ -147,6 +147,23 @@ rusttestlib-macros: private rustc_test_library_proc = yes
rusttestlib-macros: $(src)/macros/lib.rs rusttest-prepare FORCE
+$(call if_changed,rustc_test_library)
+rusttestlib-build_error: $(src)/build_error.rs $(obj)/compiler_builtins.o FORCE
+ +$(call if_changed,rustc_test_library)
+
+rusttestlib-uapi: $(src)/uapi/lib.rs \
+ $(obj)/compiler_builtins.o \
+ $(obj)/uapi/uapi_generated.rs 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 +262,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