Adding tests at test root

Couldn't get tests in subdirectores to work so adding them at test root instead.
This commit is contained in:
Michael Tryby
2019-03-22 11:51:08 -04:00
parent ec72db5d82
commit 2bf3be4c64
6 changed files with 15 additions and 14 deletions

View File

@@ -47,7 +47,7 @@ script:
- cmake --build .
# run unit tests
- cd tests
- ctest test
- ctest --output-on-failure
# run regression tests
- cd $EPANET_HOME
- pip install -r tools/requirements.txt

View File

@@ -28,12 +28,11 @@
cmake_minimum_required (VERSION 2.8.8)
project(EPANET)
include(CTest)
# Append local dir to module search path
list(APPEND CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake)
option(BUILD_TESTS "Build tests (requires Boost)" OFF)
option(BUILD_PY_LIB "Build library for Python wrapper" OFF)
option(BUILD_COVERAGE "Build library for coverage" OFF)
@@ -43,8 +42,8 @@ IF (NOT BUILD_PY_LIB)
ENDIF (NOT BUILD_PY_LIB)
add_subdirectory(src/outfile)
IF (BUILD_TESTING)
#Prep ourselves for compiling boost
IF (BUILD_TESTS)
#Prep ourselves for compiling with boost
IF(WIN32)
set(Boost_USE_STATIC_LIBS ON)
ELSE(TRUE)
@@ -59,7 +58,7 @@ IF (BUILD_TESTING)
add_subdirectory(tests)
add_subdirectory(tests/outfile)
add_subdirectory(tests/util)
ENDIF (BUILD_TESTING)
ENDIF (BUILD_TESTS)
# Sets for output directory for executables and libraries.

View File

@@ -70,7 +70,7 @@ before_test:
test_script:
# run unit tests
- cd %BUILD_HOME%\tests
- ctest -C Release RUN_TESTS
- ctest -C Release --output-on-failure
# run regression tests
- cd %EPANET_HOME%
- tools\run-nrtest.cmd %REF_BUILD_ID% %SUT_BUILD_ID%

View File

@@ -53,3 +53,12 @@ ENDIF(MSVC)
add_test(NAME test_reent
COMMAND ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/test_reent
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/data)
# ctest doesn't like tests added in subdirectories so adding them here
add_test(NAME test_errormanager
COMMAND ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/test_errormanager)
add_test(NAME test_output
COMMAND ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/test_output
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/data)

View File

@@ -10,7 +10,3 @@ set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib)
add_executable(test_output test_output.cpp)
target_include_directories(test_output PUBLIC ../../src/outfile/include)
target_link_libraries(test_output ${Boost_LIBRARIES} epanet-output)
add_test(NAME test_output
COMMAND ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/test_output
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/data)

View File

@@ -15,6 +15,3 @@ set (test_source
add_executable(test_errormanager ${test_source})
target_include_directories(test_errormanager PUBLIC ../../src/)
target_link_libraries(test_errormanager ${Boost_LIBRARIES})
add_test(NAME test_errormanager
COMMAND ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/test_errormanager)