@@ -9,6 +9,7 @@ mod platform;
9
9
mod qemu;
10
10
mod util;
11
11
12
+ use crate :: opt:: TestOpt ;
12
13
use anyhow:: Result ;
13
14
use cargo:: { fix_nested_cargo_env, Cargo , CargoAction , Feature , Package , TargetTypes } ;
14
15
use clap:: Parser ;
@@ -47,7 +48,7 @@ fn build(opt: &BuildOpt) -> Result<()> {
47
48
48
49
let cargo = Cargo {
49
50
action : CargoAction :: Build ,
50
- features : Feature :: more_code ( ) ,
51
+ features : Feature :: more_code ( opt . include_unstable , true ) ,
51
52
packages : Package :: all_except_xtask ( ) ,
52
53
release : opt. build_mode . release ,
53
54
target : Some ( * opt. target ) ,
@@ -61,7 +62,8 @@ fn clippy(opt: &ClippyOpt) -> Result<()> {
61
62
// Run clippy on all the UEFI packages.
62
63
let cargo = Cargo {
63
64
action : CargoAction :: Clippy ,
64
- features : Feature :: more_code ( ) ,
65
+ // for all possible features
66
+ features : Feature :: more_code ( true , true ) ,
65
67
packages : Package :: all_except_xtask ( ) ,
66
68
release : false ,
67
69
target : Some ( * opt. target ) ,
@@ -87,7 +89,8 @@ fn clippy(opt: &ClippyOpt) -> Result<()> {
87
89
fn doc ( opt : & DocOpt ) -> Result < ( ) > {
88
90
let cargo = Cargo {
89
91
action : CargoAction :: Doc { open : opt. open } ,
90
- features : Feature :: more_code ( ) ,
92
+ // for all possible features
93
+ features : Feature :: more_code ( true , true ) ,
91
94
packages : Package :: published ( ) ,
92
95
release : false ,
93
96
target : None ,
@@ -140,7 +143,7 @@ fn run_vm_tests(opt: &QemuOpt) -> Result<()> {
140
143
/// Run unit tests and doctests on the host. Most of uefi-rs is tested
141
144
/// with VM tests, but a few things like macros and data types can be
142
145
/// tested with regular tests.
143
- fn run_host_tests ( ) -> Result < ( ) > {
146
+ fn run_host_tests ( test_opt : & TestOpt ) -> Result < ( ) > {
144
147
// Run xtask tests.
145
148
let cargo = Cargo {
146
149
action : CargoAction :: Test ,
@@ -156,7 +159,8 @@ fn run_host_tests() -> Result<()> {
156
159
// Run uefi-rs and uefi-macros tests.
157
160
let cargo = Cargo {
158
161
action : CargoAction :: Test ,
159
- features : vec ! [ Feature :: Alloc ] ,
162
+ // No runtime features as it is not possible to test a #[global_allocator] in Rust tests
163
+ features : Feature :: more_code ( test_opt. include_unstable , false ) ,
160
164
// Don't test uefi-services (or the packages that depend on it)
161
165
// as it has lang items that conflict with `std`.
162
166
packages : vec ! [ Package :: Uefi , Package :: UefiMacros ] ,
@@ -219,7 +223,7 @@ fn main() -> Result<()> {
219
223
Action :: GenCode ( gen_opt) => device_path:: gen_code ( gen_opt) ,
220
224
Action :: Miri ( _) => run_miri ( ) ,
221
225
Action :: Run ( qemu_opt) => run_vm_tests ( qemu_opt) ,
222
- Action :: Test ( _ ) => run_host_tests ( ) ,
226
+ Action :: Test ( test_opt ) => run_host_tests ( test_opt ) ,
223
227
Action :: TestLatestRelease ( _) => test_latest_release ( ) ,
224
228
}
225
229
}
0 commit comments