From fcc067dd736f72aea1f1fc1ac6ed672342199fde Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pawe=C5=82=20Bylica?= Date: Tue, 2 Apr 2019 12:59:49 +0200 Subject: [PATCH] CMake: Add unittests to CTest --- .travis.yml | 2 +- appveyor.yml | 3 +-- circle.yml | 4 ---- test/unittests/CMakeLists.txt | 4 ++++ 4 files changed, 6 insertions(+), 7 deletions(-) diff --git a/.travis.yml b/.travis.yml index 49e1aea..886c4c3 100644 --- a/.travis.yml +++ b/.travis.yml @@ -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 diff --git a/appveyor.yml b/appveyor.yml index 672b76d..60b624f 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -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 } diff --git a/circle.yml b/circle.yml index aec0fea..7db169d 100644 --- a/circle.yml +++ b/circle.yml @@ -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 diff --git a/test/unittests/CMakeLists.txt b/test/unittests/CMakeLists.txt index ddcc866..919633c 100644 --- a/test/unittests/CMakeLists.txt +++ b/test/unittests/CMakeLists.txt @@ -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/)