CMake: Add unittests to CTest

This commit is contained in:
Paweł Bylica 2019-04-02 12:59:49 +02:00
parent 61542e0444
commit fcc067dd73
No known key found for this signature in database
GPG Key ID: 7A0C037434FE77EF
4 changed files with 6 additions and 7 deletions

View File

@ -20,5 +20,5 @@ install:
- cmake --build . --config Release --target install
script:
- test/Release/evmc-unittests.exe
- cmake --build . --config Release --target RUN_TESTS
- $HOME/bin/evmc-vmtester.exe $HOME/bin/evmc-example-vm.dll

View File

@ -54,7 +54,6 @@ build_script:
after_build:
- ps: >-
if ($env:GENERATOR) {
cd C:\projects\evmc\build\test
Release\evmc-unittests.exe
cmake --build . --config $env:CONFIGURATION --target RUN_TESTS
C:\install\bin\evmc-vmtester.exe C:\install\bin\evmc-example-vm.dll
}

View File

@ -39,10 +39,6 @@ jobs:
- run:
name: "Build"
command: cmake --build ~/build
- run:
name: "Unit tests"
working_directory: ~/build/test
command: ./evmc-unittests
- run:
name: "Test"
command: cmake --build ~/build --target test

View File

@ -2,6 +2,8 @@
# Copyright 2019 The EVMC Authors.
# Licensed under the Apache License, Version 2.0.
include(GoogleTest)
add_library(loader-mocked STATIC ${PROJECT_SOURCE_DIR}/lib/loader/loader.c)
target_link_libraries(loader-mocked PRIVATE evmc)
target_compile_definitions(loader-mocked PRIVATE EVMC_LOADER_MOCK=1)
@ -17,3 +19,5 @@ add_executable(
target_link_libraries(evmc-unittests PRIVATE loader-mocked evmc-example-vm-static evmc-example-host instructions GTest::gtest GTest::main)
set_target_properties(evmc-unittests PROPERTIES RUNTIME_OUTPUT_DIRECTORY ..)
gtest_add_tests(TARGET evmc-unittests TEST_PREFIX unittests/)