MCPcopy Create free account
hub / github.com/Bareflank/hypervisor / tests

Function tests

loader/tests/src/test_stop_vmm.cpp:50–81  ·  view source on GitHub ↗

<!-- description --> @brief Used to execute the actual checks. We put the checks in this function so that we can validate the tests both at compile-time and at run-time. If a bsl::ut_check fails, the tests will either fail fast at run-time, or will produce a compile-time error. <!-- inputs/outputs --> @return Always returns bsl::exit_success.

Source from the content-addressed store, hash-verified

48 /// @return Always returns bsl::exit_success.
49 ///
50 [[nodiscard]] constexpr auto
51 tests() noexcept -> bsl::exit_code
52 {
53 helpers::init();
54 constexpr auto func{&stop_vmm};
55
56 bsl::ut_scenario{"success"} = [&]() noexcept {
57 bsl::ut_given{} = [&]() noexcept {
58 stop_vmm_args_t mut_stop_args{};
59 start_vmm_args_t mut_start_args{};
60 helpers::file_t mut_mk_elf_file{};
61 helpers::file_t mut_ext_elf_files{};
62 bsl::ut_when{} = [&]() noexcept {
63 helpers::init_file(mut_mk_elf_file);
64 helpers::init_file(mut_ext_elf_files);
65 mut_stop_args.ver = bsl::safe_u64::magic_1().get();
66 mut_start_args.ver = bsl::safe_u64::magic_1().get();
67 mut_start_args.num_pages_in_page_pool = bsl::safe_u32::magic_1().get();
68 mut_start_args.mk_elf_file.addr = helpers::to_u8_ptr(&mut_mk_elf_file);
69 mut_start_args.mk_elf_file.size = sizeof(mut_mk_elf_file);
70 mut_start_args.ext_elf_files[0].addr = helpers::to_u8_ptr(&mut_ext_elf_files);
71 mut_start_args.ext_elf_files[0].size = sizeof(mut_ext_elf_files);
72 helpers::ut_check(loader_init());
73 helpers::ut_check(start_vmm(&mut_start_args));
74 bsl::ut_then{} = [&]() noexcept {
75 helpers::ut_check(func(&mut_stop_args));
76 };
77 bsl::ut_cleanup{} = [&]() noexcept {
78 helpers::ut_check(loader_fini());
79 helpers::reset();
80 };
81 };
82 };
83 };
84

Callers 1

mainFunction · 0.70

Calls 8

initFunction · 0.85
init_fileFunction · 0.85
to_u8_ptrFunction · 0.85
ut_checkFunction · 0.85
loader_initFunction · 0.85
start_vmmFunction · 0.85
loader_finiFunction · 0.85
resetFunction · 0.85

Tested by

no test coverage detected