2018-03-25 12:18:24 +00:00
|
|
|
# CMake module includes.
|
2018-03-25 12:29:02 +00:00
|
|
|
include(SetupFGFSEmbeddedResources)
|
2018-03-26 20:27:25 +00:00
|
|
|
include(SetupFGFSIncludes)
|
2018-03-25 12:18:24 +00:00
|
|
|
include(SetupFGFSLibraries)
|
2018-03-25 12:35:46 +00:00
|
|
|
include(SetupMSVCGrouping)
|
2018-03-25 12:18:24 +00:00
|
|
|
|
2016-01-28 15:56:10 +00:00
|
|
|
# Add each test suite category.
|
|
|
|
foreach(test_category
|
|
|
|
gui_tests
|
|
|
|
simgear_tests
|
|
|
|
system_tests
|
|
|
|
unit_tests
|
2019-09-13 09:51:20 +00:00
|
|
|
fgdata_tests
|
2016-01-28 15:56:10 +00:00
|
|
|
)
|
|
|
|
add_subdirectory(${test_category})
|
|
|
|
endforeach(test_category)
|
|
|
|
|
2018-07-16 13:59:21 +00:00
|
|
|
# Add the testing API.
|
|
|
|
add_subdirectory(FGTestApi)
|
2018-03-13 19:56:31 +00:00
|
|
|
|
2016-01-28 15:56:10 +00:00
|
|
|
# Add all test suite sources and headers.
|
|
|
|
set(TESTSUITE_SOURCES
|
|
|
|
${TESTSUITE_SOURCES}
|
|
|
|
bootstrap.cxx
|
2018-03-28 15:30:59 +00:00
|
|
|
dataStore.cxx
|
TestSuite: Custom output formatting.
A large number of improvements have been made by subclassing the CppUnit classes
and overriding the base functions, including CompilerOutputter, TestListener,
and TextTestRunner. All IO has also been captured by the test runner.
The result is that during the test suite run, only the characters '.', 'F', and
'E' are output for a pass, failure and error state. At the end of each test
suite category, all failures and errors are reported in full detail, including
the different captured IO streams. A final synopsis is printed out, improving
the overview in the case of too many tests failing.
For the fgCompilerOutputter class, the printSuccess(), printFailureReport(),
printFailureDetail(), and printSuiteStats() functions have been replaced to
implement the above printout design. The class also stores the std::vector of
TestIOCapt structures for the final printouts.
The fgTestListener class handles the events from the running of the test suite.
The startTest() and endTest() functions are used for IO capture. The IO is
placed into a TestIOCapt data structure, with one std::string for holding the
combined STDOUT and STDERR IO, and another for the SG_LOG IO. If failures
occur, the TestIOCapt structure is appended to the fgCompilerOutputter vector.
The startTest() and endTest() functions are also used for starting and stopping
a timer to allow the full test suite to be timed. And the addFailure() function
simply registers test failures or errors.
The fgTestRunner class overrides the CppUnit::TextTestRunner::run() function,
simply to prevent the base method from spawning a second test listener, causing
the test output to be duplicated.
Some auxiliary formatting functions have been added to print out titles,
sections, and synopsis summary lines.
2016-02-09 16:34:56 +00:00
|
|
|
fgCompilerOutputter.cxx
|
|
|
|
fgTestListener.cxx
|
2016-01-28 15:56:10 +00:00
|
|
|
fgTestRunner.cxx
|
TestSuite: Custom output formatting.
A large number of improvements have been made by subclassing the CppUnit classes
and overriding the base functions, including CompilerOutputter, TestListener,
and TextTestRunner. All IO has also been captured by the test runner.
The result is that during the test suite run, only the characters '.', 'F', and
'E' are output for a pass, failure and error state. At the end of each test
suite category, all failures and errors are reported in full detail, including
the different captured IO streams. A final synopsis is printed out, improving
the overview in the case of too many tests failing.
For the fgCompilerOutputter class, the printSuccess(), printFailureReport(),
printFailureDetail(), and printSuiteStats() functions have been replaced to
implement the above printout design. The class also stores the std::vector of
TestIOCapt structures for the final printouts.
The fgTestListener class handles the events from the running of the test suite.
The startTest() and endTest() functions are used for IO capture. The IO is
placed into a TestIOCapt data structure, with one std::string for holding the
combined STDOUT and STDERR IO, and another for the SG_LOG IO. If failures
occur, the TestIOCapt structure is appended to the fgCompilerOutputter vector.
The startTest() and endTest() functions are also used for starting and stopping
a timer to allow the full test suite to be timed. And the addFailure() function
simply registers test failures or errors.
The fgTestRunner class overrides the CppUnit::TextTestRunner::run() function,
simply to prevent the base method from spawning a second test listener, causing
the test output to be duplicated.
Some auxiliary formatting functions have been added to print out titles,
sections, and synopsis summary lines.
2016-02-09 16:34:56 +00:00
|
|
|
formatting.cxx
|
2016-02-12 18:42:20 +00:00
|
|
|
logging.cxx
|
2016-01-28 15:56:10 +00:00
|
|
|
testSuite.cxx
|
|
|
|
)
|
|
|
|
set(TESTSUITE_HEADERS
|
|
|
|
${TESTSUITE_HEADERS}
|
2018-03-28 15:30:59 +00:00
|
|
|
dataStore.hxx
|
TestSuite: Custom output formatting.
A large number of improvements have been made by subclassing the CppUnit classes
and overriding the base functions, including CompilerOutputter, TestListener,
and TextTestRunner. All IO has also been captured by the test runner.
The result is that during the test suite run, only the characters '.', 'F', and
'E' are output for a pass, failure and error state. At the end of each test
suite category, all failures and errors are reported in full detail, including
the different captured IO streams. A final synopsis is printed out, improving
the overview in the case of too many tests failing.
For the fgCompilerOutputter class, the printSuccess(), printFailureReport(),
printFailureDetail(), and printSuiteStats() functions have been replaced to
implement the above printout design. The class also stores the std::vector of
TestIOCapt structures for the final printouts.
The fgTestListener class handles the events from the running of the test suite.
The startTest() and endTest() functions are used for IO capture. The IO is
placed into a TestIOCapt data structure, with one std::string for holding the
combined STDOUT and STDERR IO, and another for the SG_LOG IO. If failures
occur, the TestIOCapt structure is appended to the fgCompilerOutputter vector.
The startTest() and endTest() functions are also used for starting and stopping
a timer to allow the full test suite to be timed. And the addFailure() function
simply registers test failures or errors.
The fgTestRunner class overrides the CppUnit::TextTestRunner::run() function,
simply to prevent the base method from spawning a second test listener, causing
the test output to be duplicated.
Some auxiliary formatting functions have been added to print out titles,
sections, and synopsis summary lines.
2016-02-09 16:34:56 +00:00
|
|
|
fgCompilerOutputter.hxx
|
|
|
|
fgTestListener.hxx
|
2016-01-28 15:56:10 +00:00
|
|
|
fgTestRunner.hxx
|
TestSuite: Custom output formatting.
A large number of improvements have been made by subclassing the CppUnit classes
and overriding the base functions, including CompilerOutputter, TestListener,
and TextTestRunner. All IO has also been captured by the test runner.
The result is that during the test suite run, only the characters '.', 'F', and
'E' are output for a pass, failure and error state. At the end of each test
suite category, all failures and errors are reported in full detail, including
the different captured IO streams. A final synopsis is printed out, improving
the overview in the case of too many tests failing.
For the fgCompilerOutputter class, the printSuccess(), printFailureReport(),
printFailureDetail(), and printSuiteStats() functions have been replaced to
implement the above printout design. The class also stores the std::vector of
TestIOCapt structures for the final printouts.
The fgTestListener class handles the events from the running of the test suite.
The startTest() and endTest() functions are used for IO capture. The IO is
placed into a TestIOCapt data structure, with one std::string for holding the
combined STDOUT and STDERR IO, and another for the SG_LOG IO. If failures
occur, the TestIOCapt structure is appended to the fgCompilerOutputter vector.
The startTest() and endTest() functions are also used for starting and stopping
a timer to allow the full test suite to be timed. And the addFailure() function
simply registers test failures or errors.
The fgTestRunner class overrides the CppUnit::TextTestRunner::run() function,
simply to prevent the base method from spawning a second test listener, causing
the test output to be duplicated.
Some auxiliary formatting functions have been added to print out titles,
sections, and synopsis summary lines.
2016-02-09 16:34:56 +00:00
|
|
|
formatting.hxx
|
2016-02-12 18:42:20 +00:00
|
|
|
logging.hxx
|
2016-01-28 15:56:10 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
# The test suite output directory.
|
|
|
|
set(TESTSUITE_OUTPUT_DIR "${CMAKE_CURRENT_BINARY_DIR}")
|
|
|
|
|
2018-03-06 10:08:15 +00:00
|
|
|
# Get the CppUnit sources and headers to be built into the test suite.
|
|
|
|
if (NOT SYSTEM_CPPUNIT)
|
|
|
|
message(STATUS "CppUnit: Building the FlightGear supplied CppUnit library")
|
|
|
|
|
|
|
|
get_property(CPPUNIT_SOURCES GLOBAL PROPERTY CPPUNIT_SOURCES)
|
|
|
|
get_property(CPPUNIT_HEADERS GLOBAL PROPERTY CPPUNIT_HEADERS)
|
|
|
|
|
|
|
|
|
|
|
|
add_library(CppUnitLib STATIC ${CPPUNIT_SOURCES} ${CPPUNIT_HEADERS})
|
2020-04-07 08:38:54 +00:00
|
|
|
|
|
|
|
target_include_directories(CppUnitLib PUBLIC "${PROJECT_SOURCE_DIR}/3rdparty/cppunit/include")
|
|
|
|
|
2018-03-06 10:08:15 +00:00
|
|
|
set(CPPUNIT_LIBRARIES CppUnitLib)
|
|
|
|
else()
|
|
|
|
message(STATUS "CppUnit: Linking to the system supplied CppUnit library")
|
|
|
|
endif()
|
|
|
|
|
2018-03-12 10:43:24 +00:00
|
|
|
#-----------------------------------------------------------------------------
|
|
|
|
# Set up all test suites as CTests.
|
|
|
|
|
2018-06-11 09:39:57 +00:00
|
|
|
# Activation.
|
|
|
|
include(Dart)
|
|
|
|
|
2018-03-12 10:43:24 +00:00
|
|
|
# System test suites.
|
2019-09-25 12:50:34 +00:00
|
|
|
add_test(AeroMeshSystemTests ${TESTSUITE_OUTPUT_DIR}/fgfs_test_suite --ctest -s AeroMeshTests)
|
|
|
|
#add_test(GPSSystemTests ${TESTSUITE_OUTPUT_DIR}/fgfs_test_suite --ctest -s GPSTests)
|
|
|
|
#add_test(NavaidsSystemTests ${TESTSUITE_OUTPUT_DIR}/fgfs_test_suite --ctest -s NavaidsTests)
|
2018-03-12 10:43:24 +00:00
|
|
|
|
|
|
|
# Unit test suites.
|
2019-09-25 12:50:34 +00:00
|
|
|
add_test(AddonManagementUnitTests ${TESTSUITE_OUTPUT_DIR}/fgfs_test_suite --ctest -u AddonManagementTests)
|
|
|
|
add_test(AeroElementUnitTests ${TESTSUITE_OUTPUT_DIR}/fgfs_test_suite --ctest -u AeroElementTests)
|
2019-11-07 09:01:35 +00:00
|
|
|
add_test(AircraftPerformanceUnitTests ${TESTSUITE_OUTPUT_DIR}/fgfs_test_suite --ctest -u AircraftPerformanceTests)
|
2019-09-25 12:50:34 +00:00
|
|
|
add_test(AutosaveMigrationUnitTests ${TESTSUITE_OUTPUT_DIR}/fgfs_test_suite --ctest -u AutosaveMigrationTests)
|
|
|
|
add_test(FlightplanUnitTests ${TESTSUITE_OUTPUT_DIR}/fgfs_test_suite --ctest -u FlightplanTests)
|
2020-04-24 20:52:24 +00:00
|
|
|
add_test(FPNasalUnitTests ${TESTSUITE_OUTPUT_DIR}/fgfs_test_suite --ctest -u FPNasalTests)
|
2019-11-07 09:01:35 +00:00
|
|
|
add_test(GPSUnitTests ${TESTSUITE_OUTPUT_DIR}/fgfs_test_suite --ctest -u GPSTests)
|
|
|
|
add_test(HoldControllerUnitTests ${TESTSUITE_OUTPUT_DIR}/fgfs_test_suite --ctest -u HoldControllerTests)
|
2018-06-14 07:32:02 +00:00
|
|
|
if(ENABLE_HID_INPUT)
|
2019-09-25 12:50:34 +00:00
|
|
|
add_test(HIDInputUnitTests ${TESTSUITE_OUTPUT_DIR}/fgfs_test_suite --ctest -u HIDInputTests)
|
2018-06-14 07:32:02 +00:00
|
|
|
endif()
|
2019-09-25 12:50:34 +00:00
|
|
|
add_test(LaRCSimMatrixUnitTests ${TESTSUITE_OUTPUT_DIR}/fgfs_test_suite --ctest -u LaRCSimMatrixTests)
|
|
|
|
add_test(MktimeUnitTests ${TESTSUITE_OUTPUT_DIR}/fgfs_test_suite --ctest -u MktimeTests)
|
|
|
|
add_test(NasalSysUnitTests ${TESTSUITE_OUTPUT_DIR}/fgfs_test_suite --ctest -u NasalSysTests)
|
|
|
|
add_test(NavaidsUnitTests ${TESTSUITE_OUTPUT_DIR}/fgfs_test_suite --ctest -u NavaidsTests)
|
2019-11-07 09:01:35 +00:00
|
|
|
add_test(NavRadioUnitTests ${TESTSUITE_OUTPUT_DIR}/fgfs_test_suite --ctest -u NavRadioTests)
|
2019-09-25 12:50:34 +00:00
|
|
|
add_test(PosInitUnitTests ${TESTSUITE_OUTPUT_DIR}/fgfs_test_suite --ctest -u PosInitTests)
|
2019-11-07 09:01:35 +00:00
|
|
|
add_test(RNAVProcedureUnitTests ${TESTSUITE_OUTPUT_DIR}/fgfs_test_suite --ctest -u RNAVProcedureTests)
|
|
|
|
add_test(RouteManagerUnitTests ${TESTSUITE_OUTPUT_DIR}/fgfs_test_suite --ctest -u RouteManagerTests)
|
2019-09-25 12:50:34 +00:00
|
|
|
add_test(YASimAtmosphereUnitTests ${TESTSUITE_OUTPUT_DIR}/fgfs_test_suite --ctest -u YASimAtmosphereTests)
|
2018-03-12 10:43:24 +00:00
|
|
|
|
|
|
|
# GUI test suites.
|
|
|
|
|
|
|
|
# Simgear unit test suites.
|
2020-04-27 19:29:56 +00:00
|
|
|
add_test(CanvasSimgearUnitTests ${TESTSUITE_OUTPUT_DIR}/fgfs_test_suite --ctest -m CanvasTests)
|
2019-09-25 12:50:34 +00:00
|
|
|
add_test(MathGeodesySimgearUnitTests ${TESTSUITE_OUTPUT_DIR}/fgfs_test_suite --ctest -m MathGeodesyTests)
|
|
|
|
add_test(SimgearPropsSimgearUnitTests ${TESTSUITE_OUTPUT_DIR}/fgfs_test_suite --ctest -m SimgearPropsTests)
|
2018-03-12 10:43:24 +00:00
|
|
|
|
2019-09-13 09:51:20 +00:00
|
|
|
# FGData test suites.
|
|
|
|
|
2016-01-28 15:56:10 +00:00
|
|
|
#-----------------------------------------------------------------------------
|
2018-03-25 12:45:29 +00:00
|
|
|
# Set up the binary.
|
2016-01-28 15:56:10 +00:00
|
|
|
|
2018-03-25 12:29:02 +00:00
|
|
|
# Set up the embedded resources.
|
|
|
|
setup_fgfs_embedded_resources()
|
2016-01-28 15:56:10 +00:00
|
|
|
|
2018-03-25 12:35:46 +00:00
|
|
|
# Sort the sources and headers for MSVC.
|
|
|
|
setup_msvc_grouping()
|
|
|
|
|
2020-08-19 13:49:50 +00:00
|
|
|
|
2018-03-26 20:27:25 +00:00
|
|
|
|
2018-03-25 12:29:02 +00:00
|
|
|
# All sources and headers to be built into the test suite.
|
2016-01-28 15:56:10 +00:00
|
|
|
get_property(FG_SOURCES GLOBAL PROPERTY FG_SOURCES)
|
|
|
|
get_property(FG_HEADERS GLOBAL PROPERTY FG_HEADERS)
|
2018-03-25 12:29:02 +00:00
|
|
|
get_property(EMBEDDED_RESOURCE_SOURCES GLOBAL PROPERTY EMBEDDED_RESOURCE_SOURCES)
|
|
|
|
get_property(EMBEDDED_RESOURCE_HEADERS GLOBAL PROPERTY EMBEDDED_RESOURCE_HEADERS)
|
2016-01-28 15:56:10 +00:00
|
|
|
|
2019-12-26 07:26:44 +00:00
|
|
|
set_source_files_properties(${EMBEDDED_RESOURCE_SOURCES} PROPERTIES GENERATED TRUE)
|
|
|
|
set_source_files_properties(${EMBEDDED_RESOURCE_HEADERS} PROPERTIES GENERATED TRUE)
|
|
|
|
|
2016-01-28 15:56:10 +00:00
|
|
|
# Set up the separate executable for running the test suite.
|
2019-09-25 12:50:34 +00:00
|
|
|
add_executable(fgfs_test_suite
|
2016-01-28 15:56:10 +00:00
|
|
|
${FG_SOURCES}
|
|
|
|
${FG_HEADERS}
|
2018-03-25 12:29:02 +00:00
|
|
|
${EMBEDDED_RESOURCE_SOURCES}
|
|
|
|
${EMBEDDED_RESOURCE_HEADERS}
|
2016-01-28 15:56:10 +00:00
|
|
|
${TESTSUITE_SOURCES}
|
|
|
|
${TESTSUITE_HEADERS}
|
|
|
|
)
|
2019-12-26 07:26:44 +00:00
|
|
|
|
|
|
|
add_dependencies(fgfs_test_suite buildId embeddedresources)
|
2019-09-25 12:50:34 +00:00
|
|
|
set_target_properties(fgfs_test_suite
|
2016-01-28 15:56:10 +00:00
|
|
|
PROPERTIES
|
|
|
|
RUNTIME_OUTPUT_DIRECTORY "${TESTSUITE_OUTPUT_DIR}"
|
|
|
|
)
|
2019-09-25 08:38:19 +00:00
|
|
|
if(ENABLE_AUTOTESTING)
|
2020-01-09 11:37:57 +00:00
|
|
|
set(TEST_SUITE_COMMAND "fgfs_test_suite")
|
2019-09-26 12:00:23 +00:00
|
|
|
set(TEST_SUITE_COMMENT "Running the full FlightGear test suite")
|
2019-09-25 08:38:19 +00:00
|
|
|
else()
|
|
|
|
set(TEST_SUITE_COMMENT "Building the FlightGear test suite.")
|
|
|
|
endif(ENABLE_AUTOTESTING)
|
2016-01-28 15:56:10 +00:00
|
|
|
|
2018-03-26 20:27:25 +00:00
|
|
|
# Set up the target links.
|
2019-09-25 12:50:34 +00:00
|
|
|
setup_fgfs_libraries(fgfs_test_suite)
|
2020-08-19 13:49:50 +00:00
|
|
|
# Additional search paths for includes.
|
|
|
|
setup_fgfs_includes(fgfs_test_suite)
|
2016-01-28 15:56:10 +00:00
|
|
|
|
2020-04-07 08:38:54 +00:00
|
|
|
target_compile_definitions(fgfs_test_suite PUBLIC BUILDING_TESTSUITE)
|
|
|
|
|
2018-03-25 12:18:24 +00:00
|
|
|
# Additional libraries just for the test suite.
|
2019-09-25 12:50:34 +00:00
|
|
|
target_link_libraries(fgfs_test_suite ${CPPUNIT_LIBRARIES})
|
2019-09-26 12:00:23 +00:00
|
|
|
|
|
|
|
# target to run the tests
|
|
|
|
if (MSVC)
|
2020-06-10 16:59:09 +00:00
|
|
|
file(TO_NATIVE_PATH "${FG_QT_BIN_DIR}" _qt5_bin_dir_native)
|
|
|
|
file(TO_NATIVE_PATH "${MSVC_3RDPARTY_ROOT}/${MSVC_3RDPARTY_DIR}/bin" _msvc_3rdparty_bin_dir)
|
|
|
|
file(TO_NATIVE_PATH "${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_BINDIR}" _install_bin_dir)
|
2019-09-26 12:00:23 +00:00
|
|
|
|
2020-06-10 16:59:09 +00:00
|
|
|
set(CMAKE_MSVCIDE_RUN_PATH "${_install_bin_dir};${_msvc_3rdparty_bin_dir};${_qt5_bin_dir_native}")
|
|
|
|
endif()
|
2019-09-26 12:00:23 +00:00
|
|
|
|
2020-06-10 16:59:09 +00:00
|
|
|
if (FG_QT_ROOT_DIR)
|
|
|
|
# for QtPlatformHeaders
|
|
|
|
target_include_directories(fgfs_test_suite PRIVATE ${FG_QT_ROOT_DIR}/include)
|
2019-09-26 12:00:23 +00:00
|
|
|
endif()
|
|
|
|
|
2020-06-10 16:59:09 +00:00
|
|
|
|
2019-09-26 12:00:23 +00:00
|
|
|
add_custom_target(test_suite
|
2020-01-09 11:37:57 +00:00
|
|
|
${TEST_SUITE_COMMAND}
|
2019-09-26 12:00:23 +00:00
|
|
|
DEPENDS fgfs_test_suite
|
|
|
|
COMMENT ${TEST_SUITE_COMMENT}
|
|
|
|
)
|