diff options
author | Matthew Woehlke <matthew.woehlke@kitware.com> | 2016-09-02 15:04:55 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2016-09-12 14:27:45 (GMT) |
commit | 8f95b93b41622d428522ae10cfe1bc2fde13c78c (patch) | |
tree | 4bd0301bfb416e8bb3ad81d5b6e12c34c8ba873e /Tests/RunCMake/GenerateExportHeader/RunCMakeTest.cmake | |
parent | 8317ea01aa3cf9319ef907e127fa6dbf9666cc53 (diff) | |
download | CMake-8f95b93b41622d428522ae10cfe1bc2fde13c78c.zip CMake-8f95b93b41622d428522ae10cfe1bc2fde13c78c.tar.gz CMake-8f95b93b41622d428522ae10cfe1bc2fde13c78c.tar.bz2 |
Tests: Add failure test for GenerateExportHeader
Modify notation of statements in the GenerateExportHeader test expected
to result in link errors. Modify script used to build the test to also
generate a suite of modified sources, each having exactly one of the
failing lines enabled, and to generate EXCLUDE_FROM_ALL executables for
the same. Modify RunCMake script used to drive the test to read the list
of such executables and try to build each of them, verifying that they
do in fact fail to build.
This will verify that the _NO_EXPORT macros are working as expected, and
will also catch errors like the one that commit 0cbaaf2d
(GenerateExportHeader: Fix add_compiler_export_flags regression,
2016-09-01) fixed.
When setting up the failure tests for GenerateExportHeader, check if the
compiler actually hides non-exported stuff. If not, the failure tests
won't fail, and will cause the overall test to fail. Since this
typically is only the case for very old compilers, simply skipping them
as opposed to trying to do something more fine grained seems reasonably
safe.
Diffstat (limited to 'Tests/RunCMake/GenerateExportHeader/RunCMakeTest.cmake')
-rw-r--r-- | Tests/RunCMake/GenerateExportHeader/RunCMakeTest.cmake | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/Tests/RunCMake/GenerateExportHeader/RunCMakeTest.cmake b/Tests/RunCMake/GenerateExportHeader/RunCMakeTest.cmake index e534c1f..9423ef5 100644 --- a/Tests/RunCMake/GenerateExportHeader/RunCMakeTest.cmake +++ b/Tests/RunCMake/GenerateExportHeader/RunCMakeTest.cmake @@ -12,6 +12,16 @@ function(run_GEH) run_cmake(GEH) run_cmake_command(GEH-build ${CMAKE_COMMAND} --build . --config Debug) run_cmake_command(GEH-run ${RunCMake_TEST_BINARY_DIR}/GenerateExportHeader) + + file(STRINGS "${RunCMake_TEST_BINARY_DIR}/failure_test_targets" + failure_test_targets) + + foreach(failure_test_target ${failure_test_targets}) + run_cmake_command(GEH-link-error ${CMAKE_COMMAND} + --build . + --config Debug + --target ${failure_test_target}) + endforeach() endfunction() run_GEH() |