Skip to content

Commit 8564ab7

Browse files
committed
Format with cargo fmt
1 parent a87e34d commit 8564ab7

File tree

5 files changed

+34
-24
lines changed

5 files changed

+34
-24
lines changed

tests/default_settings.rs

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,14 @@
11
use bootloader_test_runner::define_test;
22
const BASIC_BOOT_KERNEL: &str = env!("CARGO_BIN_FILE_TEST_KERNEL_DEFAULT_SETTINGS_basic_boot");
33
const SHOULD_PANIC_KERNEL: &str = env!("CARGO_BIN_FILE_TEST_KERNEL_DEFAULT_SETTINGS_should_panic");
4-
const CHECK_BOOT_INFO_KERNEL: &str = env!("CARGO_BIN_FILE_TEST_KERNEL_DEFAULT_SETTINGS_check_boot_info");
4+
const CHECK_BOOT_INFO_KERNEL: &str =
5+
env!("CARGO_BIN_FILE_TEST_KERNEL_DEFAULT_SETTINGS_check_boot_info");
56

67
define_test!(basic_boot, BASIC_BOOT_KERNEL);
78
define_test!(should_panic, SHOULD_PANIC_KERNEL);
89
define_test!(check_boot_info, CHECK_BOOT_INFO_KERNEL);
9-
define_test!(disable_default_ramdisk_macro_test, BASIC_BOOT_KERNEL, without_ramdisk_tests);
10+
define_test!(
11+
disable_default_ramdisk_macro_test,
12+
BASIC_BOOT_KERNEL,
13+
without_ramdisk_tests
14+
);

tests/higher_half.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@ use bootloader_test_runner::define_test;
22
const BASIC_BOOT_KERNEL: &str = env!("CARGO_BIN_FILE_TEST_KERNEL_HIGHER_HALF_basic_boot");
33
const SHOULD_PANIC_KERNEL: &str = env!("CARGO_BIN_FILE_TEST_KERNEL_HIGHER_HALF_should_panic");
44
const CHECK_BOOT_INFO_KERNEL: &str = env!("CARGO_BIN_FILE_TEST_KERNEL_HIGHER_HALF_check_boot_info");
5-
const VERIFY_HIGHER_HALF_KERNEL: &str = env!("CARGO_BIN_FILE_TEST_KERNEL_HIGHER_HALF_verify_higher_half");
5+
const VERIFY_HIGHER_HALF_KERNEL: &str =
6+
env!("CARGO_BIN_FILE_TEST_KERNEL_HIGHER_HALF_verify_higher_half");
67

78
define_test!(basic_boot, BASIC_BOOT_KERNEL);
89
define_test!(should_panic, SHOULD_PANIC_KERNEL);

tests/map_phys_mem.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
use bootloader_test_runner::define_test;
2-
const CHECK_BOOT_INFO_KERNEL: &str = env!("CARGO_BIN_FILE_TEST_KERNEL_MAP_PHYS_MEM_check_boot_info");
3-
const ACCESS_PHYS_MEM_KERNEL: &str = env!("CARGO_BIN_FILE_TEST_KERNEL_MAP_PHYS_MEM_access_phys_mem");
2+
const CHECK_BOOT_INFO_KERNEL: &str =
3+
env!("CARGO_BIN_FILE_TEST_KERNEL_MAP_PHYS_MEM_check_boot_info");
4+
const ACCESS_PHYS_MEM_KERNEL: &str =
5+
env!("CARGO_BIN_FILE_TEST_KERNEL_MAP_PHYS_MEM_access_phys_mem");
46

57
define_test!(check_boot_info, CHECK_BOOT_INFO_KERNEL);
68
define_test!(access_phys_mem, ACCESS_PHYS_MEM_KERNEL);

tests/ramdisk.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,4 @@ static RAMDISK_PATH: &str = "tests/ramdisk.txt";
33
static BASIC_BOOT_KERNEL: &str = env!("CARGO_BIN_FILE_TEST_KERNEL_RAMDISK_basic_boot");
44
static RAMDISK_KERNEL: &str = env!("CARGO_BIN_FILE_TEST_KERNEL_RAMDISK_ramdisk");
55
define_test!(basic_boot, BASIC_BOOT_KERNEL, RAMDISK_PATH);
6-
define_test!(ramdisk, RAMDISK_KERNEL, RAMDISK_PATH);
6+
define_test!(ramdisk, RAMDISK_KERNEL, RAMDISK_PATH);

tests/runner/src/lib.rs

Lines changed: 20 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,15 @@
1-
use std::{io::Write, path::{Path, PathBuf}, process::Command};
1+
use std::{
2+
io::Write,
3+
path::{Path, PathBuf},
4+
process::Command,
5+
};
26

37
pub extern crate lazy_static;
48
pub extern crate paste;
59
#[doc(hidden)]
6-
pub use paste::paste;
7-
#[doc(hidden)]
810
pub use lazy_static::lazy_static;
11+
#[doc(hidden)]
12+
pub use paste::paste;
913
use rand::Rng;
1014

1115
const QEMU_ARGS: &[&str] = &[
@@ -20,10 +24,10 @@ const QEMU_ARGS: &[&str] = &[
2024

2125
pub fn generate_test_image_filename(path: &Path) -> PathBuf {
2226
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();
2731
path.with_file_name(s)
2832
}
2933

@@ -66,7 +70,6 @@ pub fn run_test_kernel_uefi(kernel_binary_path: &str, ramdisk_path: Option<&str>
6670

6771
uefi_builder.create_disk_image(&gpt_path).unwrap();
6872

69-
7073
run_test_kernel_on_uefi(&gpt_path);
7174
}
7275

@@ -76,7 +79,6 @@ pub fn run_test_kernel(kernel_binary_path: &str, ramdisk_path: Option<&str>) {
7679
run_test_kernel_tftp(kernel_binary_path, ramdisk_path);
7780
}
7881

79-
8082
pub fn run_test_kernel_tftp(kernel_binary_path: &str, ramdisk_path: Option<&str>) {
8183
let kernel_path = Path::new(kernel_binary_path);
8284
let ramdisk_path = match ramdisk_path {
@@ -171,12 +173,12 @@ pub fn run_test_kernel_on_uefi_pxe(out_tftp_path: &Path) {
171173

172174
#[macro_export]
173175
/// Creates a series of test functions for a given kernel image to cover bios, uefi, and tftp
174-
///
176+
///
175177
/// define_test!(name, kernel) will generate all 3 tests, with a ramdisk and no-ramdisk variant.
176178
/// define_test!(name, kernel, ramdisk) will generate all 3 tests, with the specified ramdisk
177179
/// 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) => {
180182
$crate::paste! {
181183
#[test]
182184
fn [< $test_name _uefi_without_ramdisk >]() {
@@ -227,8 +229,8 @@ pub fn run_test_kernel_on_uefi_pxe(out_tftp_path: &Path) {
227229
);
228230
}
229231
}
230-
);
231-
($test_name: ident, $bin:tt, without_ramdisk_tests) => (
232+
};
233+
($test_name: ident, $bin:tt, without_ramdisk_tests) => {
232234
$crate::paste! {
233235
#[test]
234236
fn [< $test_name _uefi_without_ramdisk >]() {
@@ -254,8 +256,8 @@ pub fn run_test_kernel_on_uefi_pxe(out_tftp_path: &Path) {
254256
);
255257
}
256258
}
257-
);
258-
($test_name: ident, $bin: tt, $ramdisk: tt) => (
259+
};
260+
($test_name: ident, $bin: tt, $ramdisk: tt) => {
259261
$crate::paste! {
260262
#[test]
261263
fn [< $test_name _uefi_with_ramdisk >]() {
@@ -281,5 +283,5 @@ pub fn run_test_kernel_on_uefi_pxe(out_tftp_path: &Path) {
281283
);
282284
}
283285
}
284-
);
285-
}
286+
};
287+
}

0 commit comments

Comments
 (0)