test.h
Go to the documentation of this file.
1 //
2 // Bareflank Hypervisor
3 //
4 // Copyright (C) 2015 Assured Information Security, Inc.
5 // Author: Rian Quinn <quinnr@ainfosec.com>
6 // Author: Brendan Kerrigan <kerriganb@ainfosec.com>
7 //
8 // This library is free software; you can redistribute it and/or
9 // modify it under the terms of the GNU Lesser General Public
10 // License as published by the Free Software Foundation; either
11 // version 2.1 of the License, or (at your option) any later version.
12 //
13 // This library is distributed in the hope that it will be useful,
14 // but WITHOUT ANY WARRANTY; without even the implied warranty of
15 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 // Lesser General Public License for more details.
17 //
18 // You should have received a copy of the GNU Lesser General Public
19 // License along with this library; if not, write to the Free Software
20 // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
21 
22 #ifndef TEST_H
23 #define TEST_H
24 
25 #include <unittest.h>
26 
28 {
29 public:
30 
32  ~exit_handler_intel_x64_ut() override = default;
33 
34 protected:
35 
36  bool init() override;
37  bool fini() override;
38  bool list() override;
39 
40 private:
41 
42  void test_entry_valid();
43  void test_entry_throws_general_exception();
44  void test_entry_throws_standard_exception();
45  void test_entry_throws_any_exception();
46 
47  void test_vm_exit_reason_unknown();
48  void test_vm_exit_reason_cpuid();
49  void test_vm_exit_reason_invd();
50  void test_vm_exit_reason_vmcall_invalid_opcode();
51  void test_vm_exit_reason_vmcall_invalid_magic();
52  void test_vm_exit_reason_vmcall_protocol_version();
53  void test_vm_exit_reason_vmcall_bareflank_version();
54  void test_vm_exit_reason_vmcall_user_version();
55  void test_vm_exit_reason_vmcall_unknown_version();
56  void test_vm_exit_reason_vmcall_registers();
57  void test_vm_exit_reason_vmcall_unittest();
58  void test_vm_exit_reason_vmcall_event();
59  void test_vm_exit_reason_vmcall_start();
60  void test_vm_exit_reason_vmcall_stop();
61  void test_vm_exit_reason_vmcall_data_unknown();
62  void test_vm_exit_reason_vmcall_data_string_unformatted_input_nullptr();
63  void test_vm_exit_reason_vmcall_data_string_unformatted_output_nullptr();
64  void test_vm_exit_reason_vmcall_data_string_unformatted_input_size_0();
65  void test_vm_exit_reason_vmcall_data_string_unformatted_output_size_0();
66  void test_vm_exit_reason_vmcall_data_string_unformatted_output_size_too_small();
67  void test_vm_exit_reason_vmcall_data_string_unformatted_input_size_too_big();
68  void test_vm_exit_reason_vmcall_data_string_unformatted_output_size_too_big();
69  void test_vm_exit_reason_vmcall_data_string_unformatted_map_fails();
70  void test_vm_exit_reason_vmcall_data_string_unformatted_success();
71  void test_vm_exit_reason_vmcall_data_string_json_input_nullptr();
72  void test_vm_exit_reason_vmcall_data_string_json_output_nullptr();
73  void test_vm_exit_reason_vmcall_data_string_json_input_size_0();
74  void test_vm_exit_reason_vmcall_data_string_json_output_size_0();
75  void test_vm_exit_reason_vmcall_data_string_json_output_size_too_small();
76  void test_vm_exit_reason_vmcall_data_string_json_input_size_too_big();
77  void test_vm_exit_reason_vmcall_data_string_json_output_size_too_big();
78  void test_vm_exit_reason_vmcall_data_string_json_map_fails();
79  void test_vm_exit_reason_vmcall_data_string_json_invalid();
80  void test_vm_exit_reason_vmcall_data_string_json_success();
81  void test_vm_exit_reason_vmcall_data_data_unformatted_input_nullptr();
82  void test_vm_exit_reason_vmcall_data_data_unformatted_output_nullptr();
83  void test_vm_exit_reason_vmcall_data_data_unformatted_input_size_0();
84  void test_vm_exit_reason_vmcall_data_data_unformatted_output_size_0();
85  void test_vm_exit_reason_vmcall_data_data_unformatted_output_size_too_small();
86  void test_vm_exit_reason_vmcall_data_data_unformatted_input_size_too_big();
87  void test_vm_exit_reason_vmcall_data_data_unformatted_output_size_too_big();
88  void test_vm_exit_reason_vmcall_data_data_unformatted_map_fails();
89  void test_vm_exit_reason_vmcall_data_data_unformatted_success();
90  void test_vm_exit_reason_vmxoff();
91  void test_vm_exit_reason_rdmsr_debug_ctl();
92  void test_vm_exit_reason_rdmsr_pat();
93  void test_vm_exit_reason_rdmsr_efer();
94  void test_vm_exit_reason_rdmsr_perf();
95  void test_vm_exit_reason_rdmsr_cs();
96  void test_vm_exit_reason_rdmsr_esp();
97  void test_vm_exit_reason_rdmsr_eip();
98  void test_vm_exit_reason_rdmsr_fs_base();
99  void test_vm_exit_reason_rdmsr_gs_base();
100  void test_vm_exit_reason_rdmsr_default();
101  void test_vm_exit_reason_rdmsr_ignore();
102  void test_vm_exit_reason_wrmsr_debug_ctrl();
103  void test_vm_exit_reason_wrmsr_pat();
104  void test_vm_exit_reason_wrmsr_efer();
105  void test_vm_exit_reason_wrmsr_perf();
106  void test_vm_exit_reason_wrmsr_cs();
107  void test_vm_exit_reason_wrmsr_esp();
108  void test_vm_exit_reason_wrmsr_eip();
109  void test_vm_exit_reason_wrmsr_fs_base();
110  void test_vm_exit_reason_wrmsr_gs_base();
111  void test_vm_exit_reason_wrmsr_default();
112  void test_vm_exit_failure_check();
113  void test_halt();
114 };
115 
116 #endif
bool init() override
Definition: test.cpp:29
bool fini() override
Definition: test.cpp:35
bool list() override
Definition: test.cpp:41
~exit_handler_intel_x64_ut() override=default