Skip to content

Commit 3009d5d

Browse files
committed
tests: add test cases for bootinfo prefilling feature
This adds two test cases for bootinfo prefilling feature: test_mr_prefill_bootinfo_valid: the tool should successully parse the SDF that includes a valid bootinfo prefilling MR. test_mr_prefill_path_bootinfo_both_specified: the error should be detected when both 'prefill_path' and 'prefill_bootinfo' are specified. Signed-off-by: Terry Bai <tianyi.bai@unsw.edu.au>
1 parent 1339887 commit 3009d5d

3 files changed

Lines changed: 45 additions & 0 deletions

File tree

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!--
3+
Copyright 2026, UNSW
4+
5+
SPDX-License-Identifier: BSD-2-Clause
6+
-->
7+
<system>
8+
<memory_region name="bootinfo" prefill_bootinfo="x86_tsc_freq" />
9+
10+
<protection_domain name="mr_bootinfo" priority="100" >
11+
<program_image path="mr_bootinfo.elf" />
12+
<map mr="bootinfo" vaddr="0x20000000" setvar_vaddr="bootinfo_mr" />
13+
</protection_domain>
14+
</system>
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!--
3+
Copyright 2026, UNSW
4+
5+
SPDX-License-Identifier: BSD-2-Clause
6+
-->
7+
<system>
8+
<memory_region name="prefilled" prefill_path="small.bin" prefill_bootinfo="x86_tsc_freq" />
9+
10+
<protection_domain name="mr_prefill" priority="100" >
11+
<program_image path="mr_prefill.elf" />
12+
<map mr="prefilled" vaddr="0x20000000" setvar_vaddr="filled_mr" setvar_prefill_size="filled_mr_data_size"/>
13+
</protection_domain>
14+
</system>

tool/microkit/tests/test.rs

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -236,6 +236,23 @@ mod memory_region {
236236
"mr_prefill_sized_valid.system",
237237
)
238238
}
239+
240+
#[test]
241+
fn test_mr_prefill_bootinfo_valid() {
242+
check_success(
243+
&DEFAULT_X86_64_KERNEL_CONFIG,
244+
"mr_prefill_bootinfo_valid.system",
245+
)
246+
}
247+
248+
#[test]
249+
fn test_mr_prefill_path_bootinfo_both_specified() {
250+
check_error(
251+
&DEFAULT_X86_64_KERNEL_CONFIG,
252+
"mr_prefill_path_bootinfo_both_specified.system",
253+
"Error: prefill_path and prefill_bootinfo cannot be both specified on element 'memory_region'",
254+
)
255+
}
239256
}
240257

241258
#[cfg(test)]

0 commit comments

Comments
 (0)