Skip to content

Commit 4df9c16

Browse files
authored
Merge pull request #350 from rianquinn/unittest_cxx_io
Libcxx Unit Test Cleanup
2 parents 6c5846f + 4a3ea1f commit 4df9c16

12 files changed

+752
-531
lines changed

CHANGELOG.md

+8-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
- The VMM now uses it's own CR4 instead of the CR4 provided by the Host OS.
2121
- The VMM now uses it's own RFLAGS instead of the RFLAGS provided by the Host OS.
2222
- The VMM now uses it's own EFER MSR instead of the EFER MSR provided by the Host OS.
23-
- New vCPU APIs that provide that ability to pass around a "void *" for extension
23+
- New vCPU APIs that provide that ability to pass around a "user_data *" for extension
2424
support
2525
- Support for "-O3" optimizations
2626
- Support for SSE/AVX code in the VMM
@@ -34,6 +34,12 @@
3434
- AppVeyor support
3535
- Clang Tidy 3.8 support
3636
- Clang / LLVM 3.8 and 3.9 support
37+
- libc / libcxx / libcxxabi / bfcrt / bfunwind all loaded as shared libraries
38+
- VMCS unit tests
39+
- Intrinsics / VMCS namespace logic that provides useful functions / definitions
40+
found in the Intel manual
41+
- Libcxx unit tests
42+
- VMCall support
3743

3844
### Changed
3945
- The VMCS state classes are now shared by pointer (i.e. shared_ptr)
@@ -64,6 +70,7 @@
6470
use the subclasses instead, or inherit manually
6571
- The vCPU dispatch, halt and promote functions have been removed as they
6672
were specific to Intel.
73+
- GCC 5.x support for cross compilation (native still supported)
6774

6875
## [1.0.0] - 2016-27-04
6976
### Added

bfcxx/README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ Bareflank leverages [libc++](http://libcxx.llvm.org) to provide support for the
1515
- [std::map](http://www.cplusplus.com/reference/map/map/)
1616

1717
## [Input/Output](http://www.cplusplus.com/reference/iolibrary/)
18-
\<complete once unit tests are done\>
18+
- [std::cout](http://www.cplusplus.com/reference/iostream/cout/)
1919

2020
## [Multi-threading](http://www.cplusplus.com/reference/multithreading/)
2121
\<complete once unit tests are done\>

bfvmm/include/exit_handler/exit_handler_intel_x64.h

+2-1
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,6 @@ class exit_handler_intel_x64
128128
private:
129129

130130
#ifdef INCLUDE_LIBCXX_UNITTESTS
131-
132131
void unittest_1001_containers_array() const;
133132
void unittest_1002_containers_vector() const;
134133
void unittest_1003_containers_deque() const;
@@ -140,6 +139,8 @@ class exit_handler_intel_x64
140139
void unittest_1009_containers_set() const;
141140
void unittest_100A_containers_map() const;
142141

142+
void unittest_1100_io_cout() const;
143+
void unittest_1101_io_manipulators() const;
143144
#endif
144145

145146
private:
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
//
2+
// Bareflank Hypervisor
3+
//
4+
// Copyright (C) 2015 Assured Information Security, Inc.
5+
// Author: Rian Quinn <[email protected]>
6+
// Author: Brendan Kerrigan <[email protected]>
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 EXIT_HANDLER_INTEL_X64_UNITTESTS_H
23+
#define EXIT_HANDLER_INTEL_X64_UNITTESTS_H
24+
25+
#include <gsl/gsl>
26+
27+
#include <debug.h>
28+
#include <exit_handler/exit_handler_intel_x64.h>
29+
30+
inline void
31+
expect_true_with_args(bool cond, const char *func, int line)
32+
{ if (!cond) throw std::runtime_error("unittest failed ["_s + std::to_string(line) + "]: "_s + func); }
33+
34+
inline void
35+
expect_false_with_args(bool cond, const char *func, int line)
36+
{ if (cond) throw std::runtime_error("unittest failed ["_s + std::to_string(line) + "]: "_s + func); }
37+
38+
#define expect_true(a) expect_true_with_args(a, __FUNC__, __LINE__);
39+
#define expect_false(a) expect_false_with_args(a, __FUNC__, __LINE__);
40+
41+
#endif

bfvmm/src/exit_handler/src/Makefile.bf

+3
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ else
3333
endif
3434

3535
ifeq ($(INCLUDE_LIBCXX_UNITTESTS), yes)
36+
CROSS_DEFINES+=INCLUDE_LIBCXX_UNITTESTS
3637
NATIVE_DEFINES+=INCLUDE_LIBCXX_UNITTESTS
3738
endif
3839

@@ -72,6 +73,8 @@ SOURCES+=exit_handler_intel_x64.cpp
7273
SOURCES+=exit_handler_intel_x64_entry.cpp
7374
SOURCES+=exit_handler_intel_x64_support.asm
7475
SOURCES+=exit_handler_intel_x64_unittests.cpp
76+
SOURCES+=exit_handler_intel_x64_unittests_containers.cpp
77+
SOURCES+=exit_handler_intel_x64_unittests_io.cpp
7578

7679
INCLUDE_PATHS+=./
7780
INCLUDE_PATHS+=%HYPER_ABS%/include/

0 commit comments

Comments
 (0)