forked from andrewreisner/stella
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Troy Houchin
authored and
Troy Houchin
committed
Jun 7, 2018
1 parent
34d3543
commit 0a5b485
Showing
9 changed files
with
118 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
language: cpp | ||
os: linux | ||
before_install: | ||
- test -n $CC && unset CC | ||
- test -n $CXX && unset CXX | ||
install: | ||
- if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then sudo apt-get update ; fi | ||
- if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then sudo apt-get install cmake3 mpich2 liblapack-dev libboost-filesystem-dev libboost-system-dev python-numpy clang-3.9 ; fi | ||
- if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then sudo pip install pyamg ; fi | ||
before_script: | ||
- mkdir build | ||
- cd build | ||
- cmake -DENABLE_UNIT_TESTS=yes -DCMAKE_CXX_COMPILER=clang++-3.9 .. | ||
script: make && make test |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
if (ENABLE_UNIT_TESTS) | ||
enable_testing() | ||
find_package(GTest QUIET) | ||
if (GTEST_FOUND) | ||
include_directories(${GTEST_INCLUDE_DIRS}) | ||
else() | ||
# Download and unpack googletest at configure time | ||
configure_file(cmake/testing.in googletest-download/CMakeLists.txt) | ||
execute_process(COMMAND ${CMAKE_COMMAND} -G "${CMAKE_GENERATOR}" . | ||
RESULT_VARIABLE result | ||
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}/googletest-download ) | ||
if(result) | ||
message(FATAL_ERROR "CMake step for googletest failed: ${result}") | ||
endif() | ||
execute_process(COMMAND ${CMAKE_COMMAND} --build . | ||
RESULT_VARIABLE result | ||
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}/googletest-download ) | ||
if(result) | ||
message(FATAL_ERROR "Build step for googletest failed: ${result}") | ||
endif() | ||
|
||
# Prevent overriding the parent project's compiler/linker | ||
# settings on Windows | ||
set(gtest_force_shared_crt ON CACHE BOOL "" FORCE) | ||
|
||
# Add googletest directly to our build. This defines | ||
# the gtest and gtest_main targets. | ||
add_subdirectory(${CMAKE_BINARY_DIR}/googletest-src | ||
${CMAKE_BINARY_DIR}/googletest-build | ||
EXCLUDE_FROM_ALL) | ||
|
||
# The gtest/gtest_main targets carry header search path | ||
# dependencies automatically when using CMake 2.8.11 or | ||
# later. Otherwise we have to add them here ourselves. | ||
if (CMAKE_VERSION VERSION_LESS 2.8.11) | ||
include_directories("${gtest_SOURCE_DIR}/include") | ||
endif() | ||
|
||
set(GTEST_BOTH_LIBRARIES gtest gtest_main) | ||
endif() | ||
endif() | ||
|
||
|
||
function(add_par_unit target sources) | ||
set(src ${ARGV}) | ||
list(REMOVE_AT src 0) | ||
add_executable(${target} ${src}) | ||
target_link_libraries(${target} ${GTEST_BOTH_LIBRARIES} ${stella-deps} stella) | ||
set_target_properties(${target} | ||
PROPERTIES | ||
RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/test) | ||
endfunction(add_par_unit) | ||
|
||
|
||
function(set_par_sizes target sizes) | ||
set(comm_sizes ${ARGV}) | ||
list(REMOVE_AT comm_sizes 0) | ||
foreach(commsize ${comm_sizes}) | ||
set(test_parameters -np ${commsize} "${CMAKE_BINARY_DIR}/test/${target}") | ||
add_test(NAME ${target}-${commsize} COMMAND "mpiexec" ${test_parameters} WORKING_DIRECTORY ${CMAKE_BINARY_DIR}) | ||
endforeach() | ||
endfunction() | ||
|
||
|
||
function(add_unit target sources) | ||
set(src ${ARGV}) | ||
list(REMOVE_AT src 0) | ||
add_executable(${target} ${src}) | ||
target_link_libraries(${target} ${GTEST_BOTH_LIBRARIES} ${stella-deps} stella) | ||
set_target_properties(${target} | ||
PROPERTIES | ||
RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/test) | ||
if(ENABLE_JENKINS_OUTPUT) | ||
add_test(${target} ${CMAKE_BINARY_DIR}/test/${target} | ||
--gtest_output=xml:${CMAKE_BINARY_DIR}/test/${target}.xml | ||
--gtest_color=yes) | ||
else() | ||
add_test(NAME ${target} COMMAND ${CMAKE_BINARY_DIR}/test/${target} WORKING_DIRECTORY ${CMAKE_BINARY_DIR}) | ||
endif() | ||
endfunction(add_unit) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
cmake_minimum_required(VERSION 2.8.2) | ||
|
||
project(googletest-download NONE) | ||
|
||
include(ExternalProject) | ||
ExternalProject_Add(googletest | ||
GIT_REPOSITORY https://github.com/google/googletest.git | ||
GIT_TAG master | ||
SOURCE_DIR "${CMAKE_BINARY_DIR}/googletest-src" | ||
BINARY_DIR "${CMAKE_BINARY_DIR}/googletest-build" | ||
CONFIGURE_COMMAND "" | ||
BUILD_COMMAND "" | ||
INSTALL_COMMAND "" | ||
TEST_COMMAND "" | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
add_par_unit(test-models-2d ${CMAKE_CURRENT_SOURCE_DIR}/test_models.cc ${CMAKE_CURRENT_SOURCE_DIR}/../mpi_main.cc) | ||
target_link_libraries(test-models-2d stella) | ||
set_par_sizes(test-models-2d 1 3 4 8) | ||
|
||
add_par_unit(test-models_3-3d ${CMAKE_CURRENT_SOURCE_DIR}/test_models_3.cc ${CMAKE_CURRENT_SOURCE_DIR}/../mpi_main.cc) | ||
target_link_libraries(test-models_3-3d stella) | ||
set_par_sizes(test-models_3-3d 4) |