test.cpp
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 #include <test.h>
23 #include <new_delete.h>
24 
25 #include <exception>
26 
28 {
29 }
30 
31 bool
33 {
34  return true;
35 }
36 
37 bool
39 {
40  return true;
41 }
42 
43 bool
45 {
46  this->test_mem_pool_free_zero();
47  this->test_mem_pool_free_heap_twice();
48  this->test_mem_pool_invalid_pool();
49  this->test_mem_pool_malloc_zero();
50  this->test_mem_pool_multiple_malloc_heap_should_be_contiguous();
51  this->test_mem_pool_malloc_heap_all_of_memory();
52  this->test_mem_pool_malloc_heap_all_of_memory_one_block();
53  this->test_mem_pool_malloc_heap_all_memory_fragmented();
54  this->test_mem_pool_malloc_heap_too_much_memory_one_block();
55  this->test_mem_pool_malloc_heap_too_much_memory_non_block_size();
56  this->test_mem_pool_malloc_heap_massive();
57  this->test_mem_pool_size_out_of_bounds();
58  this->test_mem_pool_size_unallocated();
59  this->test_mem_pool_size();
60  this->test_mem_pool_contains_out_of_bounds();
61  this->test_mem_pool_contains();
62 
63  this->test_memory_manager_x64_size_out_of_bounds();
64  this->test_memory_manager_x64_malloc_out_of_memory();
65  this->test_memory_manager_x64_malloc_heap();
66  this->test_memory_manager_x64_malloc_page();
67  this->test_memory_manager_x64_malloc_map();
68  this->test_memory_manager_x64_add_md();
69  this->test_memory_manager_x64_add_md_invalid_type();
70  this->test_memory_manager_x64_add_md_unaligned_physical();
71  this->test_memory_manager_x64_add_md_unaligned_virtual();
72  this->test_memory_manager_x64_remove_md_invalid_virt();
73  this->test_memory_manager_x64_virtint_to_physint_failure();
74  this->test_memory_manager_x64_physint_to_virtint_failure();
75  this->test_memory_manager_x64_virtint_to_attrint_failure();
76  this->test_memory_manager_x64_virtint_to_physint_random_address();
77  this->test_memory_manager_x64_virtint_to_physint_nullptr();
78  this->test_memory_manager_x64_physint_to_virtint_random_address();
79  this->test_memory_manager_x64_physint_to_virtint_nullptr();
80  this->test_memory_manager_x64_virtint_to_attrint_random_address();
81  this->test_memory_manager_x64_virtint_to_attrint_nullptr();
82 
83  this->test_page_table_x64_add_remove_page_success_without_setting();
84  this->test_page_table_x64_add_remove_page_1g_success();
85  this->test_page_table_x64_add_remove_page_2m_success();
86  this->test_page_table_x64_add_remove_page_4k_success();
87  this->test_page_table_x64_add_remove_page_swap_success();
88  this->test_page_table_x64_add_page_twice_success();
89  this->test_page_table_x64_remove_page_twice_success();
90  this->test_page_table_x64_remove_page_unknown_success();
91  this->test_page_table_x64_virt_to_pte_invalid();
92  this->test_page_table_x64_virt_to_pte_success();
93  this->test_page_table_x64_pt_to_mdl_success();
94 
95  this->test_page_table_entry_x64_present();
96  this->test_page_table_entry_x64_rw();
97  this->test_page_table_entry_x64_us();
98  this->test_page_table_entry_x64_pwt();
99  this->test_page_table_entry_x64_pcd();
100  this->test_page_table_entry_x64_accessed();
101  this->test_page_table_entry_x64_dirty();
102  this->test_page_table_entry_x64_pat();
103  this->test_page_table_entry_x64_ps();
104  this->test_page_table_entry_x64_global();
105  this->test_page_table_entry_x64_nx();
106  this->test_page_table_entry_x64_phys_addr();
107  this->test_page_table_entry_x64_pat_index();
108  this->test_page_table_entry_x64_clear();
109 
110  this->test_unique_map_ptr_x64_default_constructor();
111  this->test_unique_map_ptr_x64_phys_constructor_invalid_args();
112  this->test_unique_map_ptr_x64_phys_constructor_mm_map_fails();
113  this->test_unique_map_ptr_x64_phys_constructor_success();
114  this->test_unique_map_ptr_x64_phys_range_constructor_invalid_args();
115  this->test_unique_map_ptr_x64_phys_range_constructor_mm_map_fails();
116  this->test_unique_map_ptr_x64_phys_range_constructor_success();
117  this->test_unique_map_ptr_x64_virt_cr3_constructor_invalid_args();
118  this->test_unique_map_ptr_x64_virt_cr3_constructor_mm_map_fails();
119  this->test_unique_map_ptr_x64_virt_cr3_constructor_success_1g();
120  this->test_unique_map_ptr_x64_virt_cr3_constructor_success_2m();
121  this->test_unique_map_ptr_x64_virt_cr3_constructor_success_4k();
122  this->test_unique_map_ptr_x64_virt_cr3_constructor_success_4k_aligned_addr();
123  this->test_unique_map_ptr_x64_virt_cr3_constructor_success_4k_aligned_size();
124  this->test_unique_map_ptr_x64_virt_cr3_constructor_not_present();
125  this->test_unique_map_ptr_x64_virt_cr3_constructor_invalid_phys_addr();
126  this->test_unique_map_ptr_x64_copy_constructor();
127  this->test_unique_map_ptr_x64_move_operator_valid();
128  this->test_unique_map_ptr_x64_move_operator_invalid();
129  this->test_unique_map_ptr_x64_reference_operators();
130  this->test_unique_map_ptr_x64_release();
131  this->test_unique_map_ptr_x64_reset();
132  this->test_unique_map_ptr_x64_swap();
133  this->test_unique_map_ptr_x64_flush();
134  this->test_unique_map_ptr_x64_cache_flush();
135  this->test_unique_map_ptr_x64_comparison();
136  this->test_unique_map_ptr_x64_make_failure();
137  this->test_virt_to_phys_with_cr3_invalid();
138  this->test_virt_to_phys_with_cr3_1g();
139  this->test_virt_to_phys_with_cr3_2m();
140  this->test_virt_to_phys_with_cr3_4k();
141 
142  this->test_root_page_table_x64_init_failure();
143  this->test_root_page_table_x64_init_success();
144  this->test_root_page_table_x64_cr3();
145  this->test_root_page_table_x64_map_1g();
146  this->test_root_page_table_x64_map_2m();
147  this->test_root_page_table_x64_map_4k();
148  this->test_root_page_table_x64_map_invalid();
149  this->test_root_page_table_x64_map_unmap_twice_success();
150  this->test_root_page_table_x64_setup_identity_map_1g_invalid();
151  this->test_root_page_table_x64_setup_identity_map_1g_valid();
152  this->test_root_page_table_x64_setup_identity_map_2m_invalid();
153  this->test_root_page_table_x64_setup_identity_map_2m_valid();
154  this->test_root_page_table_x64_setup_identity_map_4k_invalid();
155  this->test_root_page_table_x64_setup_identity_map_4k_valid();
156  this->test_root_page_table_x64_pt_to_mdl();
157 
158  this->test_pat_x64_mem_attr_to_pat_index();
159  this->test_mem_attr_x64_mem_type_to_attr();
160 
161  return true;
162 }
163 
164 int
165 main(int argc, char *argv[])
166 {
168 }
int main(int argc, char *argv[])
Definition: test.cpp:221
bool init() override
Definition: test.cpp:32
bool fini() override
Definition: test.cpp:38
bool list() override
Definition: test.cpp:44
#define RUN_ALL_TESTS(ut)
Definition: unittest.h:246