Skip to content

Commit 163c729

Browse files
committed
Add google test to github workflow
1 parent a061caf commit 163c729

File tree

3 files changed

+11
-6
lines changed

3 files changed

+11
-6
lines changed

.github/workflows/ccpp.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ jobs:
3838
# Note the current convention is to use the -S and -B options here to specify source
3939
# and build directories, but this is only available with CMake 3.13 and higher.
4040
# The CMake binaries on the Github Actions machines are (as of this writing) 3.12
41-
run: cmake $GITHUB_WORKSPACE -DCMAKE_BUILD_TYPE=$BUILD_TYPE
41+
run: cmake $GITHUB_WORKSPACE -DCMAKE_BUILD_TYPE=$BUILD_TYPE -DBUILD_UNITTESTS=yes
4242

4343
- name: Build
4444
working-directory: ${{runner.workspace}}/build
@@ -51,6 +51,6 @@ jobs:
5151
shell: bash
5252
# Execute tests defined by the CMake configuration.
5353
# See https://cmake.org/cmake/help/latest/manual/ctest.1.html for more detail
54-
run: ctest -C $BUILD_TYPE
54+
run: ctest -C $BUILD_TYPE --verbose
5555

5656

CMakeLists.txt

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -79,11 +79,9 @@ if( BUILD_UNITTESTS )
7979
include(ExternalProject)
8080
ExternalProject_Add(gtest
8181
PREFIX external/gtest
82-
SOURCE_DIR ${PROJECT_SOURCE_DIR}/vendor/gtest
83-
BUILD_BYPRODUCTS ${CMAKE_BINARY_DIR}/external/gtest/src/gtest-build/lib/libgtest.a
82+
URL file://${PROJECT_SOURCE_DIR}/vendor/gtest
8483
INSTALL_COMMAND :
8584
)
86-
8785
enable_testing()
8886
add_subdirectory(test)
8987
endif()

test/CMakeLists.txt

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,11 @@ add_executable(scitokens-gtest main.cpp)
33
add_dependencies(scitokens-gtest gtest)
44
include_directories("${PROJECT_SOURCE_DIR}/vendor/gtest/googletest/include")
55

6-
target_link_libraries(scitokens-gtest SciTokens "${CMAKE_BINARY_DIR}/external/gtest/src/gtest-build/lib/libgtest.a")
6+
target_link_libraries(scitokens-gtest SciTokens "${CMAKE_BINARY_DIR}/external/gtest/src/gtest-build/lib/libgtest.a" -lpthread)
7+
8+
add_test(
9+
NAME
10+
unit
11+
COMMAND
12+
${CMAKE_BINARY_DIR}/${CMAKE_INSTALL_BINDIR}/test/scitokens-gtest
13+
)

0 commit comments

Comments
 (0)