File tree Expand file tree Collapse file tree 5 files changed +56
-9
lines changed Expand file tree Collapse file tree 5 files changed +56
-9
lines changed Original file line number Diff line number Diff line change 7474 # At least one unit test, for make_boxed() currently, has different behaviour dependent on
7575 # the unstable feature.
7676 - name : Run cargo test (with unstable)
77- run : cargo xtask test --include- unstable
77+ run : cargo xtask test --unstable
7878
7979 lints :
8080 name : Lints
@@ -169,3 +169,19 @@ jobs:
169169
170170 - name : Build
171171 run : cargo xtask build --feature-permutations
172+
173+ vm_test_unstable :
174+ name : Run uefi-test-runner with `unstable` on x86_64
175+ runs-on : ubuntu-latest
176+ steps :
177+ - name : Checkout sources
178+ uses : actions/checkout@v3
179+
180+ - name : Install qemu and OVMF
181+ run : |
182+ sudo apt-get update
183+ sudo apt-get install qemu-system-x86 ovmf -y
184+
185+ - name : Run VM tests
186+ run : cargo xtask run --target x86_64 --headless --ci --unstable
187+ timeout-minutes : 4
Original file line number Diff line number Diff line change @@ -6,8 +6,7 @@ publish = false
66edition = " 2021"
77
88[dependencies ]
9- # TODO we should let the uefi-test-runner run with and without unstable.
10- uefi = { path = " ../uefi" , features = [" alloc" , " unstable" ] }
9+ uefi = { path = " ../uefi" , features = [" alloc" ] }
1110uefi-services = { path = " ../uefi-services" }
1211
1312log = { version = " 0.4.17" , default-features = false }
@@ -21,6 +20,9 @@ multi_processor = []
2120# Enable the PXE test.
2221pxe = []
2322
23+ # Enable the `unstable` feature of the `uefi` crate.
24+ unstable = [" uefi/unstable" ]
25+
2426# Enable the TPM v1 test.
2527tpm_v1 = []
2628
Original file line number Diff line number Diff line change @@ -60,6 +60,7 @@ pub enum Feature {
6060 // `uefi-test-runner` features.
6161 MultiProcessor ,
6262 Pxe ,
63+ TestUnstable ,
6364 TpmV1 ,
6465 TpmV2 ,
6566}
@@ -79,6 +80,7 @@ impl Feature {
7980
8081 Self :: MultiProcessor => "uefi-test-runner/multi_processor" ,
8182 Self :: Pxe => "uefi-test-runner/pxe" ,
83+ Self :: TestUnstable => "uefi-test-runner/unstable" ,
8284 Self :: TpmV1 => "uefi-test-runner/tpm_v1" ,
8385 Self :: TpmV2 => "uefi-test-runner/tpm_v2" ,
8486 }
@@ -96,7 +98,13 @@ impl Feature {
9698 ] ,
9799 Package :: UefiServices => vec ! [ Self :: PanicHandler , Self :: Qemu , Self :: ServicesLogger ] ,
98100 Package :: UefiTestRunner => {
99- vec ! [ Self :: MultiProcessor , Self :: Pxe , Self :: TpmV1 , Self :: TpmV2 ]
101+ vec ! [
102+ Self :: MultiProcessor ,
103+ Self :: Pxe ,
104+ Self :: TestUnstable ,
105+ Self :: TpmV1 ,
106+ Self :: TpmV2 ,
107+ ]
100108 }
101109 _ => vec ! [ ] ,
102110 }
Original file line number Diff line number Diff line change @@ -142,6 +142,11 @@ fn run_vm_tests(opt: &QemuOpt) -> Result<()> {
142142 features. push ( Feature :: MultiProcessor ) ;
143143 }
144144
145+ // Enable `unstable` if requested.
146+ if * opt. unstable {
147+ features. push ( Feature :: TestUnstable ) ;
148+ }
149+
145150 // Build uefi-test-runner.
146151 let cargo = Cargo {
147152 action : CargoAction :: Build ,
@@ -180,7 +185,7 @@ fn run_host_tests(test_opt: &TestOpt) -> Result<()> {
180185 // the unstable feature. Because of this, we need to allow to test both variants. Runtime
181186 // features is set to no as it is not possible as as soon a #[global_allocator] is
182187 // registered, the Rust runtime executing the tests uses it as well.
183- features : Feature :: more_code ( test_opt. include_unstable , false ) ,
188+ features : Feature :: more_code ( * test_opt. unstable , false ) ,
184189 // Don't test uefi-services (or the packages that depend on it)
185190 // as it has lang items that conflict with `std`.
186191 packages : vec ! [ Package :: Uefi , Package :: UefiMacros ] ,
Original file line number Diff line number Diff line change @@ -34,6 +34,21 @@ pub struct BuildModeOpt {
3434 pub release : bool ,
3535}
3636
37+ #[ derive( Debug , Parser ) ]
38+ pub struct UnstableOpt {
39+ /// Enable the `unstable` feature (requires nightly).
40+ #[ clap( long, action) ]
41+ pub unstable : bool ,
42+ }
43+
44+ impl Deref for UnstableOpt {
45+ type Target = bool ;
46+
47+ fn deref ( & self ) -> & Self :: Target {
48+ & self . unstable
49+ }
50+ }
51+
3752#[ derive( Debug , Parser ) ]
3853pub struct WarningOpt {
3954 /// Treat warnings as errors.
@@ -156,15 +171,16 @@ pub struct QemuOpt {
156171 /// Run an example instead of the main binary.
157172 #[ clap( long, action) ]
158173 pub example : Option < String > ,
174+
175+ #[ clap( flatten) ]
176+ pub unstable : UnstableOpt ,
159177}
160178
161179/// Run unit tests and doctests on the host.
162180#[ derive( Debug , Parser ) ]
163181pub struct TestOpt {
164- /// Include all features behind the "unstable" gate. uefi-rs must build without unstable
165- /// functionality on stable (eventually) and with it in our nightly MSRV.
166- #[ clap( long, action) ]
167- pub include_unstable : bool ,
182+ #[ clap( flatten) ]
183+ pub unstable : UnstableOpt ,
168184}
169185
170186/// Build the template against the crates.io packages.
You can’t perform that action at this time.
0 commit comments