Skip to content

Commit

Permalink
Merge pull request #50 from OpenFAST/feature/bd-instrumentation
Browse files Browse the repository at this point in the history
Unit test framework
  • Loading branch information
rafmudaf authored Sep 30, 2017
2 parents 8ba23c4 + a7fed88 commit e788b9b
Show file tree
Hide file tree
Showing 30 changed files with 1,818 additions and 358 deletions.
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,6 @@
path = reg_tests/r-test
url = https://github.com/openfast/r-test.git
branch = dev
[submodule "unit_tests/pfunit"]
path = unit_tests/pfunit
url = https://git.code.sf.net/p/pfunit/code
45 changes: 34 additions & 11 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -56,12 +56,19 @@ endif (FPE_TRAP_ENABLED)
find_package(BLAS REQUIRED)
find_package(LAPACK REQUIRED)

########################################################################
# Test option configuration
# Do this before configuring modules so that precompiler flags are included
option(BUILD_TESTING "Build the testing tree." OFF)
if(BUILD_TESTING)
set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -DUNIT_TEST")
endif()

########################################################################
# Build rules for FAST Registry
#
add_subdirectory(modules-local/fast-registry)


########################################################################
# FAST Core modules
#
Expand Down Expand Up @@ -110,16 +117,6 @@ foreach(IDIR IN ITEMS ${FAST_MODULES_EXTERNAL})
add_subdirectory("${CMAKE_SOURCE_DIR}/modules-ext/${IDIR}")
endforeach(IDIR IN ITEMS ${FAST_MODULES_EXTERNAL})

option(BUILD_DOCUMENTATION "Build documentation." OFF)
if(BUILD_DOCUMENTATION)
add_subdirectory(docs)
endif()

option(BUILD_TESTING "Build the testing tree." OFF)
if(BUILD_TESTING)
include(reg_tests/CMakeLists.txt)
endif()

add_subdirectory(glue-codes)

# Install fortran .mod files also to installation directory
Expand Down Expand Up @@ -150,3 +147,29 @@ configure_package_config_file(
PATH_VARS INCLUDE_INSTALL_DIR LIB_INSTALL_DIR FTNMOD_INSTALL_DIR)
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/OpenFASTConfig.cmake
DESTINATION lib/cmake/OpenFAST)

########################################################################
# Configure the default install path to openfast/install
string(FIND ${CMAKE_Fortran_MODULE_DIRECTORY} "build/ftnmods" found)
if(${found} GREATER 0)
string(REPLACE "build/ftnmods" "install" install_path ${CMAKE_Fortran_MODULE_DIRECTORY})
if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
set(CMAKE_INSTALL_PREFIX ${install_path} CACHE PATH "..." FORCE)
endif()
endif()

# Option configuration
if(BUILD_TESTING)
include(CTest)

# regression tests
add_subdirectory(reg_tests)

# unit tests
add_subdirectory(unit_tests)
endif()

option(BUILD_DOCUMENTATION "Build documentation." OFF)
if(BUILD_DOCUMENTATION)
add_subdirectory(docs)
endif()
Loading

0 comments on commit e788b9b

Please sign in to comment.