Skip to content

Commit

Permalink
Merge pull request #1950 from andrew-platt/f/unitTest_turnOff
Browse files Browse the repository at this point in the history
Option to turn off unit_tests from cmake
  • Loading branch information
deslaughter authored Dec 21, 2023
2 parents 5308d05 + 8b07e41 commit d31f1d2
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 5 deletions.
11 changes: 8 additions & 3 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,10 @@ endif()
option(BUILD_TESTING "Build the testing tree." OFF)
if(BUILD_TESTING)
option(CODECOVERAGE "Enable infrastructure for measuring code coverage." OFF)
set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -DUNIT_TEST")
option(BUILD_UNIT_TESTING "Enable unit testing" ON)
if(BUILD_UNIT_TESTING)
set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -DUNIT_TEST")
endif()
endif()

# Setup Fortran Compiler options based on architecture/compiler
Expand Down Expand Up @@ -276,8 +279,10 @@ if(BUILD_TESTING)
add_subdirectory(reg_tests)

# unit tests
if(NOT (${CMAKE_Fortran_COMPILER_ID} STREQUAL "Flang"))
add_subdirectory(unit_tests)
if(BUILD_UNIT_TESTING)
if(NOT (${CMAKE_Fortran_COMPILER_ID} STREQUAL "Flang"))
add_subdirectory(unit_tests)
endif()
endif()
endif()

Expand Down
5 changes: 3 additions & 2 deletions docs/source/testing/unit_test.rst
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@ Unit testing in OpenFAST modules is accomplished through `pFUnit <https://github
This framework provides a Fortran abstraction to the popular
`xUnit <https://en.wikipedia.org/wiki/XUnit>`__ structure. pFUnit is compiled
along with OpenFAST through CMake when the CMake variable ``BUILD_TESTING`` is
turned on.
turned on (default off) and the CMake variable ``BUILD_UNIT_TESTING`` is on
(turned on by default when ``BUILD_TEST`` is on).

The BeamDyn and NWTC Library modules contain some sample unit tests and should
serve as a reference for future development and testing.
Expand All @@ -21,7 +22,7 @@ Dependencies
------------
The following packages are required for unit testing:

- Python 3.7+
- Python 3.7+, <3.12
- CMake
- pFUnit - Included in OpenFAST repo through a git-submodule

Expand Down

0 comments on commit d31f1d2

Please sign in to comment.