Skip to content

Commit

Permalink
Merge pull request #350 from rianquinn/unittest_cxx_io
Browse files Browse the repository at this point in the history
Libcxx Unit Test Cleanup
  • Loading branch information
rianquinn authored Nov 24, 2016
2 parents 6c5846f + 4a3ea1f commit 4df9c16
Show file tree
Hide file tree
Showing 12 changed files with 752 additions and 531 deletions.
9 changes: 8 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
- The VMM now uses it's own CR4 instead of the CR4 provided by the Host OS.
- The VMM now uses it's own RFLAGS instead of the RFLAGS provided by the Host OS.
- The VMM now uses it's own EFER MSR instead of the EFER MSR provided by the Host OS.
- New vCPU APIs that provide that ability to pass around a "void *" for extension
- New vCPU APIs that provide that ability to pass around a "user_data *" for extension
support
- Support for "-O3" optimizations
- Support for SSE/AVX code in the VMM
Expand All @@ -34,6 +34,12 @@
- AppVeyor support
- Clang Tidy 3.8 support
- Clang / LLVM 3.8 and 3.9 support
- libc / libcxx / libcxxabi / bfcrt / bfunwind all loaded as shared libraries
- VMCS unit tests
- Intrinsics / VMCS namespace logic that provides useful functions / definitions
found in the Intel manual
- Libcxx unit tests
- VMCall support

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

## [1.0.0] - 2016-27-04
### Added
Expand Down
2 changes: 1 addition & 1 deletion bfcxx/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ Bareflank leverages [libc++](http://libcxx.llvm.org) to provide support for the
- [std::map](http://www.cplusplus.com/reference/map/map/)

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

## [Multi-threading](http://www.cplusplus.com/reference/multithreading/)
\<complete once unit tests are done\>
Expand Down
3 changes: 2 additions & 1 deletion bfvmm/include/exit_handler/exit_handler_intel_x64.h
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,6 @@ class exit_handler_intel_x64
private:

#ifdef INCLUDE_LIBCXX_UNITTESTS

void unittest_1001_containers_array() const;
void unittest_1002_containers_vector() const;
void unittest_1003_containers_deque() const;
Expand All @@ -140,6 +139,8 @@ class exit_handler_intel_x64
void unittest_1009_containers_set() const;
void unittest_100A_containers_map() const;

void unittest_1100_io_cout() const;
void unittest_1101_io_manipulators() const;
#endif

private:
Expand Down
41 changes: 41 additions & 0 deletions bfvmm/include/exit_handler/exit_handler_intel_x64_unittests.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
//
// Bareflank Hypervisor
//
// Copyright (C) 2015 Assured Information Security, Inc.
// Author: Rian Quinn <[email protected]>
// Author: Brendan Kerrigan <[email protected]>
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
// License as published by the Free Software Foundation; either
// version 2.1 of the License, or (at your option) any later version.
//
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA

#ifndef EXIT_HANDLER_INTEL_X64_UNITTESTS_H
#define EXIT_HANDLER_INTEL_X64_UNITTESTS_H

#include <gsl/gsl>

#include <debug.h>
#include <exit_handler/exit_handler_intel_x64.h>

inline void
expect_true_with_args(bool cond, const char *func, int line)
{ if (!cond) throw std::runtime_error("unittest failed ["_s + std::to_string(line) + "]: "_s + func); }

inline void
expect_false_with_args(bool cond, const char *func, int line)
{ if (cond) throw std::runtime_error("unittest failed ["_s + std::to_string(line) + "]: "_s + func); }

#define expect_true(a) expect_true_with_args(a, __FUNC__, __LINE__);
#define expect_false(a) expect_false_with_args(a, __FUNC__, __LINE__);

#endif
3 changes: 3 additions & 0 deletions bfvmm/src/exit_handler/src/Makefile.bf
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ else
endif

ifeq ($(INCLUDE_LIBCXX_UNITTESTS), yes)
CROSS_DEFINES+=INCLUDE_LIBCXX_UNITTESTS
NATIVE_DEFINES+=INCLUDE_LIBCXX_UNITTESTS
endif

Expand Down Expand Up @@ -72,6 +73,8 @@ SOURCES+=exit_handler_intel_x64.cpp
SOURCES+=exit_handler_intel_x64_entry.cpp
SOURCES+=exit_handler_intel_x64_support.asm
SOURCES+=exit_handler_intel_x64_unittests.cpp
SOURCES+=exit_handler_intel_x64_unittests_containers.cpp
SOURCES+=exit_handler_intel_x64_unittests_io.cpp

INCLUDE_PATHS+=./
INCLUDE_PATHS+=%HYPER_ABS%/include/
Expand Down
Loading

0 comments on commit 4df9c16

Please sign in to comment.