Skip to content

Commit

Permalink
Fix test suite (#24)
Browse files Browse the repository at this point in the history
fix: working directory path for unit tests in now correctly set
fix: binaries and dynamic libraries are now located inside PROJECT_BINARY_DIR
fix: removed useless includes inside CI.yml
  • Loading branch information
martin-olivier authored May 13, 2022
1 parent c2e80de commit e06af0f
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 14 deletions.
14 changes: 3 additions & 11 deletions .github/workflows/CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,6 @@ jobs:
fail-fast: false
matrix:
os: [windows-latest, macos-latest, ubuntu-latest]
include:
- os: windows-latest
bin: unit_tests.exe
dir: ./Debug/
- os: ubuntu-latest
bin: unit_tests
dir: ./
- os: macos-latest
bin: unit_tests
dir: ./

name: ${{ matrix.os }}
runs-on: ${{ matrix.os }}
Expand All @@ -36,7 +26,8 @@ jobs:
run: cmake --build build

- name: Run Unit Tests
run: ${{ matrix.dir }}${{ matrix.bin }}
working-directory: build
run: ctest

- name: Send Coverage to codecov.io
if: ${{ matrix.os == 'ubuntu-latest' }}
Expand All @@ -62,6 +53,7 @@ jobs:
run: cmake --build build

- name: Run Unit Tests with Valgrind
working-directory: build
run: valgrind --leak-check=full --show-leak-kinds=all --error-exitcode=1 ./unit_tests

linter:
Expand Down
6 changes: 3 additions & 3 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ if(UNIX)
endif()

if(CMAKE_CURRENT_SOURCE_DIR STREQUAL CMAKE_SOURCE_DIR)
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${PROJECT_SOURCE_DIR})
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${PROJECT_SOURCE_DIR})
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR})
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR})

option(BUILD_TESTS "when set to ON, build unit tests" OFF)

Expand Down Expand Up @@ -49,6 +49,6 @@ if(CMAKE_CURRENT_SOURCE_DIR STREQUAL CMAKE_SOURCE_DIR)
endif()

include(GoogleTest)
gtest_discover_tests(unit_tests)
gtest_discover_tests(unit_tests WORKING_DIRECTORY ${PROJECT_BINARY_DIR})
endif()
endif()

0 comments on commit e06af0f

Please sign in to comment.