Skip to content

Commit

Permalink
Re-enable Codecov (#582)
Browse files Browse the repository at this point in the history
This patch re-enables codecov so that it can calculate our
current code coverage. This will likely result in failed tests
until code coverage is fixed.

Signed-off-by: “rianquinn” <“rianquinn@gmail.com”>
  • Loading branch information
rianquinn committed Jan 27, 2018
1 parent 3817856 commit ee7b537
Show file tree
Hide file tree
Showing 40 changed files with 1,910 additions and 2,567 deletions.
53 changes: 29 additions & 24 deletions .travis.yml
Expand Up @@ -27,13 +27,19 @@ dist: trusty
#
cache:
directories:
- build/cache
- ../cache

#
# Build Dependencies
#
before_script:

#
# Cache / Depends
#
- mkdir -p ../cache
- mkdir -p ../depends

#
# Build Enviornment
#
Expand Down Expand Up @@ -166,29 +172,28 @@ matrix:
- make -j3
- make tidy

# #
# # Codecov
# #
# - os: linux
# addons:
# apt:
# sources:
# - ubuntu-toolchain-r-test
# - llvm-toolchain-trusty-4.0
# packages:
# - gcc-6
# - g++-6
# - clang-4.0
# - nasm
# env:
# - TEST="Codecov"
# script:
# - cmake -DCONFIG=travis_codecov ..
# - make -j3
# - make test
# - rm -Rf depends
# - cd ..
# - bash <(curl -s https://codecov.io/bash)
#
# Codecov
#
- os: linux
addons:
apt:
sources:
- ubuntu-toolchain-r-test
- llvm-toolchain-trusty-4.0
packages:
- gcc-6
- g++-6
- clang-4.0
- nasm
env:
- TEST="Codecov"
script:
- cmake -DCONFIG=travis_codecov ..
- make -j3
- make test
- cd ..
- bash <(curl -s https://codecov.io/bash)

#
# Google Address Sanitizer
Expand Down
2 changes: 2 additions & 0 deletions bfintrinsics/tests/arch/intel_x64/vmcs/test_debug.cpp
Expand Up @@ -54,6 +54,8 @@ proc_ctl_disallow1(uint64_t mask)

TEST_CASE("debug_dump")
{
CHECK_NOTHROW(_cpuid_eax(0));

proc_ctl_disallow1(msrs::ia32_vmx_true_procbased_ctls::activate_secondary_controls::mask);
CHECK_THROWS(dump());

Expand Down
6 changes: 1 addition & 5 deletions bfm/tests/test_command_line_parser.cpp
Expand Up @@ -16,11 +16,7 @@
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA

#include <catch/catch.hpp>

#include <bfstring.h>
#include <bfvcpuid.h>
#include <command_line_parser.h>
#include <test_support.h>

TEST_CASE("test command line parser with no args")
{
Expand Down
3 changes: 0 additions & 3 deletions bfm/tests/test_ioctl_driver.cpp
Expand Up @@ -16,9 +16,6 @@
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA

#include <catch/catch.hpp>
#include <hippomocks.h>

#include <test_support.h>

#ifdef _HIPPOMOCKS__ENABLE_CFUNC_MOCKING_SUPPORT
Expand Down
3 changes: 0 additions & 3 deletions bfm/tests/test_main.cpp
Expand Up @@ -16,9 +16,6 @@
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA

#include <catch/catch.hpp>
#include <hippomocks.h>

#include <test_support.h>

void bfm_flush();
Expand Down
20 changes: 20 additions & 0 deletions bfm/tests/test_support.h
Expand Up @@ -16,7 +16,11 @@
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA

#include <catch/catch.hpp>
#include <hippomocks.h>

#include <bftypes.h>
#include <bfvcpuid.h>
#include <bfaffinity.h>
#include <bfelf_loader.h>
#include <bfdriverinterface.h>
Expand Down Expand Up @@ -74,3 +78,19 @@ _vmcall(vmcall_registers_t *regs)
{
bfignored(regs);
}

TEST_CASE("support")
{
ioctl ctl{};
int64_t status;
auto drr = ioctl::drr_type{};
auto data = ioctl::binary_data{};

CHECK_NOTHROW(ctl.call_ioctl_add_module(data));
CHECK_NOTHROW(ctl.call_ioctl_load_vmm());
CHECK_NOTHROW(ctl.call_ioctl_unload_vmm());
CHECK_NOTHROW(ctl.call_ioctl_start_vmm());
CHECK_NOTHROW(ctl.call_ioctl_stop_vmm());
CHECK_NOTHROW(ctl.call_ioctl_dump_vmm(&drr, 0));
CHECK_NOTHROW(ctl.call_ioctl_vmm_status(&status));
}
2 changes: 2 additions & 0 deletions bfvmm/include/hve/arch/x64/gdt.h
Expand Up @@ -459,7 +459,9 @@ class EXPORT_HVE gdt_x64
this->set_limit(index, limit);
}

#ifndef ENABLE_BUILD_TEST
private:
#endif

/// @cond

Expand Down
7 changes: 6 additions & 1 deletion bfvmm/src/debug/CMakeLists.txt
Expand Up @@ -21,13 +21,18 @@
# ------------------------------------------------------------------------------

list(APPEND SOURCES
unistd.cpp
debug_ring/debug_ring.cpp
serial/serial_port_ns16550a.cpp
serial/serial_port_pl011.cpp
serial/serial_port_base.cpp
)

if(NOT ENABLE_MOCKING)
list(APPEND SOURCES
unistd.cpp
)
endif()

add_shared_library(
bfvmm_debug
SOURCES ${SOURCES}
Expand Down
2 changes: 1 addition & 1 deletion bfvmm/src/hve/CMakeLists.txt
Expand Up @@ -25,7 +25,7 @@ list(APPEND SOURCES
arch/intel_x64/vmxon/vmxon.cpp
)

if(NOT WIN32)
if(NOT WIN32 AND NOT ENABLE_MOCKING)
list(APPEND SOURCES
arch/intel_x64/exit_handler/exit_handler_support.asm
arch/intel_x64/vmcs/vmcs_launch.asm
Expand Down
7 changes: 6 additions & 1 deletion bfvmm/src/vcpu/CMakeLists.txt
Expand Up @@ -24,8 +24,13 @@ list(APPEND SOURCES
if(${BUILD_TARGET_ARCH} STREQUAL "x86_64")
list(APPEND SOURCES
arch/intel_x64/vcpu.cpp
arch/intel_x64/vcpu_factory.cpp
)

if(NOT ENABLE_MOCKING)
list(APPEND SOURCES
arch/intel_x64/vcpu_factory.cpp
)
endif()
elseif(${BUILD_TARGET_ARCH} STREQUAL "aarch64")
message(WARNING "Unimplemented")
else()
Expand Down
5 changes: 2 additions & 3 deletions bfvmm/tests/CMakeLists.txt
Expand Up @@ -23,13 +23,12 @@ include(${SOURCE_CMAKE_DIR}/project.cmake)
init_project()

add_subdirectory(../src/debug ${CMAKE_CURRENT_BINARY_DIR}/src/debug)
add_subdirectory(../src/entry ${CMAKE_CURRENT_BINARY_DIR}/src/entry)
add_subdirectory(../src/hve ${CMAKE_CURRENT_BINARY_DIR}/src/hve)
add_subdirectory(../src/memory_manager ${CMAKE_CURRENT_BINARY_DIR}/src/memory_manager)
add_subdirectory(../src/vcpu ${CMAKE_CURRENT_BINARY_DIR}/src/vcpu)

add_subdirectory(debug)
# add_subdirectory(entry)
add_subdirectory(hve)
add_subdirectory(memory_manager)
# add_subdirectory(vcpu)
add_subdirectory(vcpu)
add_subdirectory(support)
8 changes: 8 additions & 0 deletions bfvmm/tests/debug/serial/test_serial_port_ns16550a.cpp
Expand Up @@ -44,6 +44,14 @@ extern "C" void
_outd(uint16_t port, uint32_t val) noexcept
{ g_ports[port] = val; }

TEST_CASE("serial: support")
{
CHECK_NOTHROW(_inb(0));
CHECK_NOTHROW(_outb(0, 0));
CHECK_NOTHROW(_ind(0));
CHECK_NOTHROW(_outd(0, 0));
}

TEST_CASE("serial: constructor_null_intrinsics")
{
CHECK_NOTHROW(std::make_unique<serial_port_ns16550a>());
Expand Down
8 changes: 8 additions & 0 deletions bfvmm/tests/debug/serial/test_serial_port_pl011.cpp
Expand Up @@ -44,6 +44,14 @@ extern "C" void
_outd(uint16_t port, uint32_t val) noexcept
{ g_ports[port] = val; }

TEST_CASE("serial: support")
{
CHECK_NOTHROW(_inb(0));
CHECK_NOTHROW(_outb(0, 0));
CHECK_NOTHROW(_ind(0));
CHECK_NOTHROW(_outd(0, 0));
}

TEST_CASE("serial: constructor_null_intrinsics")
{
CHECK_NOTHROW(std::make_unique<serial_port_pl011>());
Expand Down
40 changes: 40 additions & 0 deletions bfvmm/tests/hve/CMakeLists.txt
Expand Up @@ -24,6 +24,16 @@ list(APPEND ARGN
DEFINES STATIC_INTRINSICS
)

do_test(test_gdt
SOURCES arch/x64/test_gdt.cpp
${ARGN}
)

do_test(test_idt
SOURCES arch/x64/test_idt.cpp
${ARGN}
)

do_test(test_exit_handler
SOURCES arch/intel_x64/exit_handler/test_exit_handler.cpp
${ARGN}
Expand All @@ -34,6 +44,36 @@ do_test(test_exit_handler_entry
${ARGN}
)

do_test(test_vmcs_check_controls
SOURCES arch/intel_x64/vmcs/test_vmcs_check_controls.cpp
${ARGN}
)

do_test(test_vmcs_check_guest
SOURCES arch/intel_x64/vmcs/test_vmcs_check_guest.cpp
${ARGN}
)

do_test(test_vmcs_check_host
SOURCES arch/intel_x64/vmcs/test_vmcs_check_host.cpp
${ARGN}
)

do_test(test_vmcs_state_hvm
SOURCES arch/intel_x64/vmcs/test_vmcs_state_hvm.cpp
${ARGN}
)

do_test(test_vmcs_state_vmm
SOURCES arch/intel_x64/vmcs/test_vmcs_state_vmm.cpp
${ARGN}
)

do_test(test_vmcs_state
SOURCES arch/intel_x64/vmcs/test_vmcs_state.cpp
${ARGN}
)

do_test(test_vmcs
SOURCES arch/intel_x64/vmcs/test_vmcs.cpp
${ARGN}
Expand Down

0 comments on commit ee7b537

Please sign in to comment.