1
- use std:: { io:: Write , path:: { Path , PathBuf } , process:: Command } ;
1
+ use std:: {
2
+ io:: Write ,
3
+ path:: { Path , PathBuf } ,
4
+ process:: Command ,
5
+ } ;
2
6
3
7
pub extern crate lazy_static;
4
8
pub extern crate paste;
5
9
#[ doc( hidden) ]
6
- pub use paste:: paste;
7
- #[ doc( hidden) ]
8
10
pub use lazy_static:: lazy_static;
11
+ #[ doc( hidden) ]
12
+ pub use paste:: paste;
9
13
use rand:: Rng ;
10
14
11
15
const QEMU_ARGS : & [ & str ] = & [
@@ -20,10 +24,10 @@ const QEMU_ARGS: &[&str] = &[
20
24
21
25
pub fn generate_test_image_filename ( path : & Path ) -> PathBuf {
22
26
let s: String = rand:: thread_rng ( )
23
- . sample_iter ( & rand:: distributions:: Alphanumeric )
24
- . take ( 8 )
25
- . map ( char:: from)
26
- . collect ( ) ;
27
+ . sample_iter ( & rand:: distributions:: Alphanumeric )
28
+ . take ( 8 )
29
+ . map ( char:: from)
30
+ . collect ( ) ;
27
31
path. with_file_name ( s)
28
32
}
29
33
@@ -66,7 +70,6 @@ pub fn run_test_kernel_uefi(kernel_binary_path: &str, ramdisk_path: Option<&str>
66
70
67
71
uefi_builder. create_disk_image ( & gpt_path) . unwrap ( ) ;
68
72
69
-
70
73
run_test_kernel_on_uefi ( & gpt_path) ;
71
74
}
72
75
@@ -76,7 +79,6 @@ pub fn run_test_kernel(kernel_binary_path: &str, ramdisk_path: Option<&str>) {
76
79
run_test_kernel_tftp ( kernel_binary_path, ramdisk_path) ;
77
80
}
78
81
79
-
80
82
pub fn run_test_kernel_tftp ( kernel_binary_path : & str , ramdisk_path : Option < & str > ) {
81
83
let kernel_path = Path :: new ( kernel_binary_path) ;
82
84
let ramdisk_path = match ramdisk_path {
@@ -171,12 +173,12 @@ pub fn run_test_kernel_on_uefi_pxe(out_tftp_path: &Path) {
171
173
172
174
#[ macro_export]
173
175
/// Creates a series of test functions for a given kernel image to cover bios, uefi, and tftp
174
- ///
176
+ ///
175
177
/// define_test!(name, kernel) will generate all 3 tests, with a ramdisk and no-ramdisk variant.
176
178
/// define_test!(name, kernel, ramdisk) will generate all 3 tests, with the specified ramdisk
177
179
/// define_test!(name, kernel, without_ramdisk_tests) will generate all 3 tests, with only the no-ramdisk variant
178
- macro_rules! define_test {
179
- ( $test_name: ident, $bin: tt) => (
180
+ macro_rules! define_test {
181
+ ( $test_name: ident, $bin: tt) => {
180
182
$crate:: paste! {
181
183
#[ test]
182
184
fn [ < $test_name _uefi_without_ramdisk >] ( ) {
@@ -227,8 +229,8 @@ pub fn run_test_kernel_on_uefi_pxe(out_tftp_path: &Path) {
227
229
) ;
228
230
}
229
231
}
230
- ) ;
231
- ( $test_name: ident, $bin: tt, without_ramdisk_tests) => (
232
+ } ;
233
+ ( $test_name: ident, $bin: tt, without_ramdisk_tests) => {
232
234
$crate:: paste! {
233
235
#[ test]
234
236
fn [ < $test_name _uefi_without_ramdisk >] ( ) {
@@ -254,8 +256,8 @@ pub fn run_test_kernel_on_uefi_pxe(out_tftp_path: &Path) {
254
256
) ;
255
257
}
256
258
}
257
- ) ;
258
- ( $test_name: ident, $bin: tt, $ramdisk: tt) => (
259
+ } ;
260
+ ( $test_name: ident, $bin: tt, $ramdisk: tt) => {
259
261
$crate:: paste! {
260
262
#[ test]
261
263
fn [ < $test_name _uefi_with_ramdisk >] ( ) {
@@ -281,5 +283,5 @@ pub fn run_test_kernel_on_uefi_pxe(out_tftp_path: &Path) {
281
283
) ;
282
284
}
283
285
}
284
- ) ;
285
- }
286
+ } ;
287
+ }
0 commit comments