diff options
Diffstat (limited to 'Tests')
65 files changed, 690 insertions, 19 deletions
diff --git a/Tests/FindProtobuf/Test/CMakeLists.txt b/Tests/FindProtobuf/Test/CMakeLists.txt index 8b6e38a..10ce976 100644 --- a/Tests/FindProtobuf/Test/CMakeLists.txt +++ b/Tests/FindProtobuf/Test/CMakeLists.txt @@ -30,3 +30,5 @@ add_executable(test_var_protoc main-protoc.cxx) target_include_directories(test_var_protoc PRIVATE ${Protobuf_INCLUDE_DIRS}) target_link_libraries(test_var_protoc PRIVATE ${Protobuf_PROTOC_LIBRARIES}) add_test(NAME test_var_protoc COMMAND test_var_protoc) + +add_test(NAME test_tgt_protoc_version COMMAND protobuf::protoc --version) diff --git a/Tests/MFC/CMakeLists.txt.in b/Tests/MFC/CMakeLists.txt.in index e6bfabd..bf98e91 100644 --- a/Tests/MFC/CMakeLists.txt.in +++ b/Tests/MFC/CMakeLists.txt.in @@ -45,6 +45,11 @@ set(files set(CMAKE_MFC_FLAG "@CMAKE_MFC_FLAG_VALUE@") +FIND_PACKAGE(MFC) +IF (NOT MFC_FOUND) + MESSAGE(FATAL_ERROR "MFC Could not be found during the MFC test") +ENDIF() + if("${CMAKE_MFC_FLAG}" STREQUAL "1") msvc_link_to_static_crt() else() diff --git a/Tests/RunCMake/Android/android_sysinc.c b/Tests/RunCMake/Android/android_sysinc.c new file mode 100644 index 0000000..18d73db --- /dev/null +++ b/Tests/RunCMake/Android/android_sysinc.c @@ -0,0 +1,7 @@ +#include <dlfcn.h> + +#ifndef NOT_SYSTEM_DLFCN_HEADER +#error "sysroot /usr/include appears too early" +#endif + +#include "android.c" diff --git a/Tests/RunCMake/Android/android_sysinc.cxx b/Tests/RunCMake/Android/android_sysinc.cxx new file mode 100644 index 0000000..5c5694b --- /dev/null +++ b/Tests/RunCMake/Android/android_sysinc.cxx @@ -0,0 +1,7 @@ +#include <dlfcn.h> + +#ifndef NOT_SYSTEM_DLFCN_HEADER +#error "sysroot /usr/include appears too early" +#endif + +#include "android.cxx" diff --git a/Tests/RunCMake/Android/common.cmake b/Tests/RunCMake/Android/common.cmake index bef2428..015f202 100644 --- a/Tests/RunCMake/Android/common.cmake +++ b/Tests/RunCMake/Android/common.cmake @@ -92,3 +92,19 @@ if(CMAKE_ANDROID_ARCH_ABI STREQUAL "armeabi-v7a") endif() add_executable(android_c android.c) add_executable(android_cxx android.cxx) + +# Test that an explicit /usr/include is ignored in favor of +# appearing as a standard include directory at the end. +set(sysinc_dirs) +if(CMAKE_ANDROID_NDK) + if(NOT CMAKE_ANDROID_NDK_DEPRECATED_HEADERS) + list(APPEND sysinc_dirs ${CMAKE_SYSROOT_COMPILE}/usr/include) + else() + list(APPEND sysinc_dirs ${CMAKE_SYSROOT}/usr/include) + endif() +endif() +list(APPEND sysinc_dirs ${CMAKE_CURRENT_SOURCE_DIR}/sysinc) +add_executable(android_sysinc_c android_sysinc.c) +target_include_directories(android_sysinc_c SYSTEM PRIVATE ${sysinc_dirs}) +add_executable(android_sysinc_cxx android_sysinc.cxx) +target_include_directories(android_sysinc_cxx SYSTEM PRIVATE ${sysinc_dirs}) diff --git a/Tests/RunCMake/Android/sysinc/dlfcn.h b/Tests/RunCMake/Android/sysinc/dlfcn.h new file mode 100644 index 0000000..273306c --- /dev/null +++ b/Tests/RunCMake/Android/sysinc/dlfcn.h @@ -0,0 +1 @@ +#define NOT_SYSTEM_DLFCN_HEADER diff --git a/Tests/RunCMake/AutoExportDll/foo.c b/Tests/RunCMake/AutoExportDll/foo.c index e70fbb5..4b1318b 100644 --- a/Tests/RunCMake/AutoExportDll/foo.c +++ b/Tests/RunCMake/AutoExportDll/foo.c @@ -13,5 +13,3 @@ int bar() { return 5; } - -const char testconst[] = "testconst"; diff --git a/Tests/RunCMake/AutoExportDll/say.cxx b/Tests/RunCMake/AutoExportDll/say.cxx index eb9c0ff..51060e8 100644 --- a/Tests/RunCMake/AutoExportDll/say.cxx +++ b/Tests/RunCMake/AutoExportDll/say.cxx @@ -13,14 +13,6 @@ int WINAPI foo(); int bar(); int objlib(); void justnop(); - -// test const export -#ifdef _WIN32 -// data symbols must be explicitly imported -__declspec(dllimport) extern const char testconst[]; -#else -extern const char testconst[]; -#endif } // test c++ functions @@ -51,8 +43,6 @@ int main() bar(); objlib(); printf("\n"); - printf("%s", testconst); - printf("\n"); #ifdef HAS_JUSTNOP justnop(); #endif diff --git a/Tests/RunCMake/CMakeLists.txt b/Tests/RunCMake/CMakeLists.txt index 246138b..347b9d2 100644 --- a/Tests/RunCMake/CMakeLists.txt +++ b/Tests/RunCMake/CMakeLists.txt @@ -223,6 +223,7 @@ add_RunCMake_test(return) add_RunCMake_test(separate_arguments) add_RunCMake_test(set_property) add_RunCMake_test(string) +add_RunCMake_test(test_include_dirs) foreach(var CMAKE_C_COMPILER_ID CMAKE_C_COMPILER_VERSION @@ -348,6 +349,7 @@ if("${CMAKE_GENERATOR}" MATCHES "Make|Ninja") list(APPEND CompilerLauncher_ARGS -DCMake_TEST_CUDA=${CMake_TEST_CUDA}) endif() add_RunCMake_test(CompilerLauncher) + add_RunCMake_test(ctest_labels_for_subprojects) endif() add_RunCMake_test_group(CPack "DEB;RPM;7Z;TBZ2;TGZ;TXZ;TZ;ZIP;STGZ") diff --git a/Tests/RunCMake/VSSolution/MorePost-check.cmake b/Tests/RunCMake/VSSolution/MorePost-check.cmake index 0f7e370..d239b28 100644 --- a/Tests/RunCMake/VSSolution/MorePost-check.cmake +++ b/Tests/RunCMake/VSSolution/MorePost-check.cmake @@ -1,5 +1,5 @@ parseGlobalSections(pre post MorePost) testGlobalSection(post TestSec2 Key1=Value1 "Key2=Value with spaces") testGlobalSection(post TestSec4 Key6=Value1 "Key7=Value with spaces" Key8=ValueWithoutSpaces) -testGlobalSection(post ExtensibilityGlobals) +testGlobalSection(post ExtensibilityGlobals "SolutionGuid={00000000-0000-0000-0000-000000000000}") testGlobalSection(post ExtensibilityAddIns) diff --git a/Tests/RunCMake/VSSolution/MorePre-check.cmake b/Tests/RunCMake/VSSolution/MorePre-check.cmake index 45e7419..89b3c7e 100644 --- a/Tests/RunCMake/VSSolution/MorePre-check.cmake +++ b/Tests/RunCMake/VSSolution/MorePre-check.cmake @@ -1,5 +1,5 @@ parseGlobalSections(pre post MorePre) testGlobalSection(pre TestSec1 Key1=Value1 "Key2=Value with spaces") testGlobalSection(pre TestSec3 Key3=Value1 "Key4=Value with spaces" Key5=ValueWithoutSpaces) -testGlobalSection(post ExtensibilityGlobals) +testGlobalSection(post ExtensibilityGlobals "SolutionGuid={00000000-0000-0000-0000-000000000000}") testGlobalSection(post ExtensibilityAddIns) diff --git a/Tests/RunCMake/VSSolution/OnePost-check.cmake b/Tests/RunCMake/VSSolution/OnePost-check.cmake index 6af5156..f7d3712 100644 --- a/Tests/RunCMake/VSSolution/OnePost-check.cmake +++ b/Tests/RunCMake/VSSolution/OnePost-check.cmake @@ -1,4 +1,4 @@ parseGlobalSections(pre post OnePost) testGlobalSection(post TestSec2 Key1=Value1 "Key2=Value with spaces") -testGlobalSection(post ExtensibilityGlobals) +testGlobalSection(post ExtensibilityGlobals "SolutionGuid={00000000-0000-0000-0000-000000000000}") testGlobalSection(post ExtensibilityAddIns) diff --git a/Tests/RunCMake/VSSolution/OnePre-check.cmake b/Tests/RunCMake/VSSolution/OnePre-check.cmake index 70b18b2..c5db139 100644 --- a/Tests/RunCMake/VSSolution/OnePre-check.cmake +++ b/Tests/RunCMake/VSSolution/OnePre-check.cmake @@ -1,4 +1,4 @@ parseGlobalSections(pre post OnePre) testGlobalSection(pre TestSec1 Key1=Value1 "Key2=Value with spaces") -testGlobalSection(post ExtensibilityGlobals) +testGlobalSection(post ExtensibilityGlobals "SolutionGuid={00000000-0000-0000-0000-000000000000}") testGlobalSection(post ExtensibilityAddIns) diff --git a/Tests/RunCMake/VSSolution/Override1-check.cmake b/Tests/RunCMake/VSSolution/Override1-check.cmake index a19e2e1..5905204 100644 --- a/Tests/RunCMake/VSSolution/Override1-check.cmake +++ b/Tests/RunCMake/VSSolution/Override1-check.cmake @@ -1,4 +1,4 @@ parseGlobalSections(pre post Override1) testGlobalSection(post TestSec Key2=Value2 Key3=Value3) -testGlobalSection(post ExtensibilityGlobals Key1=Value1) +testGlobalSection(post ExtensibilityGlobals Key1=Value1 "SolutionGuid={00000000-0000-0000-0000-000000000000}") testGlobalSection(post ExtensibilityAddIns) diff --git a/Tests/RunCMake/VSSolution/Override2-check.cmake b/Tests/RunCMake/VSSolution/Override2-check.cmake index d9656e1..c981ec0 100644 --- a/Tests/RunCMake/VSSolution/Override2-check.cmake +++ b/Tests/RunCMake/VSSolution/Override2-check.cmake @@ -1,4 +1,4 @@ parseGlobalSections(pre post Override2) testGlobalSection(pre TestSec Key2=Value2 Key3=Value3) -testGlobalSection(post ExtensibilityGlobals) +testGlobalSection(post ExtensibilityGlobals "SolutionGuid={00000000-0000-0000-0000-000000000000}") testGlobalSection(post ExtensibilityAddIns Key1=Value1) diff --git a/Tests/RunCMake/VSSolution/Override3-check.cmake b/Tests/RunCMake/VSSolution/Override3-check.cmake new file mode 100644 index 0000000..baee9ed --- /dev/null +++ b/Tests/RunCMake/VSSolution/Override3-check.cmake @@ -0,0 +1,3 @@ +parseGlobalSections(pre post Override3) +testGlobalSection(post ExtensibilityGlobals Key1=Value1 "SolutionGuid={custom-guid}") +testGlobalSection(post ExtensibilityAddIns) diff --git a/Tests/RunCMake/VSSolution/Override3.cmake b/Tests/RunCMake/VSSolution/Override3.cmake new file mode 100644 index 0000000..a59ce19 --- /dev/null +++ b/Tests/RunCMake/VSSolution/Override3.cmake @@ -0,0 +1,4 @@ +set_property(DIRECTORY PROPERTY VS_GLOBAL_SECTION_POST_ExtensibilityGlobals + Key1=Value1 + SolutionGuid={custom-guid} + ) diff --git a/Tests/RunCMake/VSSolution/PrePost-check.cmake b/Tests/RunCMake/VSSolution/PrePost-check.cmake index 322a689..957c964 100644 --- a/Tests/RunCMake/VSSolution/PrePost-check.cmake +++ b/Tests/RunCMake/VSSolution/PrePost-check.cmake @@ -2,5 +2,5 @@ parseGlobalSections(pre post PrePost) testGlobalSection(post Postsec Key1=Value2) testGlobalSection(pre Presec Key1=Value1 "Key2=Value with some spaces") testGlobalSection(post Emptysec) -testGlobalSection(post ExtensibilityGlobals) +testGlobalSection(post ExtensibilityGlobals "SolutionGuid={00000000-0000-0000-0000-000000000000}") testGlobalSection(post ExtensibilityAddIns) diff --git a/Tests/RunCMake/VSSolution/RunCMakeTest.cmake b/Tests/RunCMake/VSSolution/RunCMakeTest.cmake index 3a04db4..c25833d 100644 --- a/Tests/RunCMake/VSSolution/RunCMakeTest.cmake +++ b/Tests/RunCMake/VSSolution/RunCMakeTest.cmake @@ -8,6 +8,7 @@ run_cmake(MorePost) run_cmake(PrePost) run_cmake(Override1) run_cmake(Override2) +run_cmake(Override3) run_cmake(StartupProject) run_cmake(StartupProjectMissing) run_cmake(AddPackageToDefault) diff --git a/Tests/RunCMake/VSSolution/solution_parsing.cmake b/Tests/RunCMake/VSSolution/solution_parsing.cmake index 4e5bb59..4b27550 100644 --- a/Tests/RunCMake/VSSolution/solution_parsing.cmake +++ b/Tests/RunCMake/VSSolution/solution_parsing.cmake @@ -44,6 +44,9 @@ macro(parseGlobalSections arg_out_pre arg_out_post testName) endif() string(STRIP "${CMAKE_MATCH_1}" key) string(STRIP "${CMAKE_MATCH_2}" value) + if(key STREQUAL "SolutionGuid" AND value MATCHES "^{[0-9A-F-]+}$") + set(value "{00000000-0000-0000-0000-000000000000}") + endif() list(APPEND ${out_${sectionType}}_${sectionName} "${key}=${value}") endif() endforeach() diff --git a/Tests/RunCMake/ctest_labels_for_subprojects/CMakeLists.txt.in b/Tests/RunCMake/ctest_labels_for_subprojects/CMakeLists.txt.in new file mode 100644 index 0000000..30dd37e --- /dev/null +++ b/Tests/RunCMake/ctest_labels_for_subprojects/CMakeLists.txt.in @@ -0,0 +1,5 @@ +cmake_minimum_required(VERSION 3.9) +@CASE_CMAKELISTS_PREFIX_CODE@ +project(CTestLabelsForSubprojects@CASE_NAME@ NONE) +include(CTest) +@CASE_CMAKELISTS_SUFFIX_CODE@ diff --git a/Tests/RunCMake/ctest_labels_for_subprojects/CTestConfig.cmake.in b/Tests/RunCMake/ctest_labels_for_subprojects/CTestConfig.cmake.in new file mode 100644 index 0000000..1e1905b --- /dev/null +++ b/Tests/RunCMake/ctest_labels_for_subprojects/CTestConfig.cmake.in @@ -0,0 +1,2 @@ +set(CTEST_PROJECT_NAME "CTestLabelsForSubprojects@CASE_NAME@") +@CTEST_EXTRA_CONFIG@ diff --git a/Tests/RunCMake/ctest_labels_for_subprojects/CTestConfigCTestScript-check.cmake b/Tests/RunCMake/ctest_labels_for_subprojects/CTestConfigCTestScript-check.cmake new file mode 100644 index 0000000..ea05851 --- /dev/null +++ b/Tests/RunCMake/ctest_labels_for_subprojects/CTestConfigCTestScript-check.cmake @@ -0,0 +1,36 @@ +set(EXPERIMENTAL_FEATURE_REGEX "<Subproject name=\"MyExperimentalFeature\">.*<Label>MyExperimentalFeature</Label>.*</Subproject>") +set(PRODUCTION_CODE_REGEX "<Subproject name=\"MyProductionCode\">.*<Label>MyProductionCode</Label>.*</Subproject>") +set(SUBPROJECTS_REGEX "${EXPERIMENTAL_FEATURE_REGEX}.*${PRODUCTION_CODE_REGEX}") + +file(GLOB configure_xml_file "${RunCMake_TEST_BINARY_DIR}/Testing/*/Configure.xml") +if(configure_xml_file) + file(READ "${configure_xml_file}" configure_xml) + if(NOT configure_xml MATCHES "${SUBPROJECTS_REGEX}.*<Configure>") + set(RunCMake_TEST_FAILED "Configure.xml does not contain the expected list of subprojects") + endif() +else() + set(RunCMake_TEST_FAILED "Configure.xml not found") +endif() + +file(GLOB build_xml_file "${RunCMake_TEST_BINARY_DIR}/Testing/*/Build.xml") +if(build_xml_file) + file(READ "${build_xml_file}" build_xml) + set(BUILD_WARNING_REGEX "<Failure type=\"Warning\">.*<Labels>.*<Label>MyExperimentalFeature</Label>.*</Labels>") + if(NOT build_xml MATCHES "${SUBPROJECTS_REGEX}.*<Build>.*${BUILD_ERROR_REGEX}.*</Build>") + set(RunCMake_TEST_FAILED "Build.xml does not contain the expected list of subprojects and labels") + endif() +else() + set(RunCMake_TEST_FAILED "Build.xml not found") +endif() + +file(GLOB test_xml_file "${RunCMake_TEST_BINARY_DIR}/Testing/*/Test.xml") +if(test_xml_file) + file(READ "${test_xml_file}" test_xml) + set(TEST_FAILED_REGEX "<Test Status=\"failed\">.*<Labels>.*<Label>MyExperimentalFeature</Label>.*<Label>NotASubproject</Label>.*</Labels>") + set(TEST_PASSED_REGEX "<Test Status=\"passed\">.*<Labels>.*<Label>MyProductionCode</Label>.*</Labels>") + if(NOT test_xml MATCHES "${SUBPROJECTS_REGEX}.*<Testing>.*${TEST_FAILED_REGEX}.*${TEST_PASSED_REGEX}.*${TEST_NOTRUN_REGEX}.*</Testing>") + set(RunCMake_TEST_FAILED "Test.xml does not contain the expected list of subprojects and labels") + endif() +else() + set(RunCMake_TEST_FAILED "${CTEST_BINARY_DIRECTORY}/Testing/*/Test.xml not found") +endif() diff --git a/Tests/RunCMake/ctest_labels_for_subprojects/CTestConfigCTestScript-stdout.txt b/Tests/RunCMake/ctest_labels_for_subprojects/CTestConfigCTestScript-stdout.txt new file mode 100644 index 0000000..ae00e51 --- /dev/null +++ b/Tests/RunCMake/ctest_labels_for_subprojects/CTestConfigCTestScript-stdout.txt @@ -0,0 +1,7 @@ +17% tests passed, 5 tests failed out of 6 ++ +Subproject Time Summary: +MyExperimentalFeature += +[0-9.]+ sec \(5 tests\) +MyProductionCode += +[0-9.]+ sec \(1 test\) ++ +Total Test time \(real\) = +[0-9.]+ sec diff --git a/Tests/RunCMake/ctest_labels_for_subprojects/CTestScriptVariable-check.cmake b/Tests/RunCMake/ctest_labels_for_subprojects/CTestScriptVariable-check.cmake new file mode 100644 index 0000000..ea05851 --- /dev/null +++ b/Tests/RunCMake/ctest_labels_for_subprojects/CTestScriptVariable-check.cmake @@ -0,0 +1,36 @@ +set(EXPERIMENTAL_FEATURE_REGEX "<Subproject name=\"MyExperimentalFeature\">.*<Label>MyExperimentalFeature</Label>.*</Subproject>") +set(PRODUCTION_CODE_REGEX "<Subproject name=\"MyProductionCode\">.*<Label>MyProductionCode</Label>.*</Subproject>") +set(SUBPROJECTS_REGEX "${EXPERIMENTAL_FEATURE_REGEX}.*${PRODUCTION_CODE_REGEX}") + +file(GLOB configure_xml_file "${RunCMake_TEST_BINARY_DIR}/Testing/*/Configure.xml") +if(configure_xml_file) + file(READ "${configure_xml_file}" configure_xml) + if(NOT configure_xml MATCHES "${SUBPROJECTS_REGEX}.*<Configure>") + set(RunCMake_TEST_FAILED "Configure.xml does not contain the expected list of subprojects") + endif() +else() + set(RunCMake_TEST_FAILED "Configure.xml not found") +endif() + +file(GLOB build_xml_file "${RunCMake_TEST_BINARY_DIR}/Testing/*/Build.xml") +if(build_xml_file) + file(READ "${build_xml_file}" build_xml) + set(BUILD_WARNING_REGEX "<Failure type=\"Warning\">.*<Labels>.*<Label>MyExperimentalFeature</Label>.*</Labels>") + if(NOT build_xml MATCHES "${SUBPROJECTS_REGEX}.*<Build>.*${BUILD_ERROR_REGEX}.*</Build>") + set(RunCMake_TEST_FAILED "Build.xml does not contain the expected list of subprojects and labels") + endif() +else() + set(RunCMake_TEST_FAILED "Build.xml not found") +endif() + +file(GLOB test_xml_file "${RunCMake_TEST_BINARY_DIR}/Testing/*/Test.xml") +if(test_xml_file) + file(READ "${test_xml_file}" test_xml) + set(TEST_FAILED_REGEX "<Test Status=\"failed\">.*<Labels>.*<Label>MyExperimentalFeature</Label>.*<Label>NotASubproject</Label>.*</Labels>") + set(TEST_PASSED_REGEX "<Test Status=\"passed\">.*<Labels>.*<Label>MyProductionCode</Label>.*</Labels>") + if(NOT test_xml MATCHES "${SUBPROJECTS_REGEX}.*<Testing>.*${TEST_FAILED_REGEX}.*${TEST_PASSED_REGEX}.*${TEST_NOTRUN_REGEX}.*</Testing>") + set(RunCMake_TEST_FAILED "Test.xml does not contain the expected list of subprojects and labels") + endif() +else() + set(RunCMake_TEST_FAILED "${CTEST_BINARY_DIRECTORY}/Testing/*/Test.xml not found") +endif() diff --git a/Tests/RunCMake/ctest_labels_for_subprojects/CTestScriptVariable-stdout.txt b/Tests/RunCMake/ctest_labels_for_subprojects/CTestScriptVariable-stdout.txt new file mode 100644 index 0000000..ae00e51 --- /dev/null +++ b/Tests/RunCMake/ctest_labels_for_subprojects/CTestScriptVariable-stdout.txt @@ -0,0 +1,7 @@ +17% tests passed, 5 tests failed out of 6 ++ +Subproject Time Summary: +MyExperimentalFeature += +[0-9.]+ sec \(5 tests\) +MyProductionCode += +[0-9.]+ sec \(1 test\) ++ +Total Test time \(real\) = +[0-9.]+ sec diff --git a/Tests/RunCMake/ctest_labels_for_subprojects/CTestScriptVariableCommandLine-check.cmake b/Tests/RunCMake/ctest_labels_for_subprojects/CTestScriptVariableCommandLine-check.cmake new file mode 100644 index 0000000..7beefba --- /dev/null +++ b/Tests/RunCMake/ctest_labels_for_subprojects/CTestScriptVariableCommandLine-check.cmake @@ -0,0 +1,34 @@ +set(THIRD_PARTY_REGEX "<Subproject name=\"MyThirdPartyDependency\">.*<Label>MyThirdPartyDependency</Label>.*</Subproject>") +set(SUBPROJECTS_REGEX "${THIRD_PARTY_REGEX}") + +file(GLOB configure_xml_file "${RunCMake_TEST_BINARY_DIR}/Testing/*/Configure.xml") +if(configure_xml_file) + file(READ "${configure_xml_file}" configure_xml) + if(NOT configure_xml MATCHES "${SUBPROJECTS_REGEX}.*<Configure>") + set(RunCMake_TEST_FAILED "Configure.xml does not contain the expected list of subprojects") + endif() +else() + set(RunCMake_TEST_FAILED "Configure.xml not found") +endif() + +file(GLOB build_xml_file "${RunCMake_TEST_BINARY_DIR}/Testing/*/Build.xml") +if(build_xml_file) + file(READ "${build_xml_file}" build_xml) + set(BUILD_ERROR_REGEX "<Failure type=\"Error\">.*<Labels>.*<Label>MyThirdPartyDependency</Label>.*<Label>NotASubproject</Label>.*</Labels>") + if(NOT build_xml MATCHES "${SUBPROJECTS_REGEX}.*<Build>.*${BUILD_ERROR_REGEX}.*</Build>") + set(RunCMake_TEST_FAILED "Build.xml does not contain the expected list of subprojects and labels") + endif() +else() + set(RunCMake_TEST_FAILED "Build.xml not found") +endif() + +file(GLOB test_xml_file "${RunCMake_TEST_BINARY_DIR}/Testing/*/Test.xml") +if(test_xml_file) + file(READ "${test_xml_file}" test_xml) + set(TEST_NOTRUN_REGEX "<Test Status=\"notrun\">.*<Labels>.*<Label>MyThirdPartyDependency</Label>.*<Label>NotASubproject</Label>.*</Labels>") + if(NOT test_xml MATCHES "${SUBPROJECTS_REGEX}.*<Testing>.*${TEST_FAILED_REGEX}.*${TEST_PASSED_REGEX}.*${TEST_NOTRUN_REGEX}.*</Testing>") + set(RunCMake_TEST_FAILED "Test.xml does not contain the expected list of subprojects and labels") + endif() +else() + set(RunCMake_TEST_FAILED "${CTEST_BINARY_DIRECTORY}/Testing/*/Test.xml not found") +endif() diff --git a/Tests/RunCMake/ctest_labels_for_subprojects/CTestScriptVariableCommandLine-result.txt b/Tests/RunCMake/ctest_labels_for_subprojects/CTestScriptVariableCommandLine-result.txt new file mode 100644 index 0000000..b57e2de --- /dev/null +++ b/Tests/RunCMake/ctest_labels_for_subprojects/CTestScriptVariableCommandLine-result.txt @@ -0,0 +1 @@ +(-1|255) diff --git a/Tests/RunCMake/ctest_labels_for_subprojects/CTestScriptVariableCommandLine-stderr.txt b/Tests/RunCMake/ctest_labels_for_subprojects/CTestScriptVariableCommandLine-stderr.txt new file mode 100644 index 0000000..38566fb --- /dev/null +++ b/Tests/RunCMake/ctest_labels_for_subprojects/CTestScriptVariableCommandLine-stderr.txt @@ -0,0 +1 @@ +Unable to find executable:.*MyThirdPartyDependency/src/thirdparty diff --git a/Tests/RunCMake/ctest_labels_for_subprojects/CTestScriptVariableCommandLine-stdout.txt b/Tests/RunCMake/ctest_labels_for_subprojects/CTestScriptVariableCommandLine-stdout.txt new file mode 100644 index 0000000..a78a99a --- /dev/null +++ b/Tests/RunCMake/ctest_labels_for_subprojects/CTestScriptVariableCommandLine-stdout.txt @@ -0,0 +1,6 @@ +0% tests passed, 1 tests failed out of 1 ++ +Subproject Time Summary: +MyThirdPartyDependency += +[0-9.]+ sec \(1 test\) ++ +Total Test time \(real\) = +[0-9.]+ sec diff --git a/Tests/RunCMake/ctest_labels_for_subprojects/ModuleVariableCMakeLists-result.txt b/Tests/RunCMake/ctest_labels_for_subprojects/ModuleVariableCMakeLists-result.txt new file mode 100644 index 0000000..45a4fb7 --- /dev/null +++ b/Tests/RunCMake/ctest_labels_for_subprojects/ModuleVariableCMakeLists-result.txt @@ -0,0 +1 @@ +8 diff --git a/Tests/RunCMake/ctest_labels_for_subprojects/ModuleVariableCMakeLists-stderr.txt b/Tests/RunCMake/ctest_labels_for_subprojects/ModuleVariableCMakeLists-stderr.txt new file mode 100644 index 0000000..ba4235d --- /dev/null +++ b/Tests/RunCMake/ctest_labels_for_subprojects/ModuleVariableCMakeLists-stderr.txt @@ -0,0 +1 @@ +Errors while running CTest diff --git a/Tests/RunCMake/ctest_labels_for_subprojects/ModuleVariableCMakeLists-stdout.txt b/Tests/RunCMake/ctest_labels_for_subprojects/ModuleVariableCMakeLists-stdout.txt new file mode 100644 index 0000000..b5d76a9 --- /dev/null +++ b/Tests/RunCMake/ctest_labels_for_subprojects/ModuleVariableCMakeLists-stdout.txt @@ -0,0 +1,6 @@ +50% tests passed, 1 tests failed out of 2 ++ +Subproject Time Summary: +MySubproject += +[0-9.]+ sec \(2 tests\) ++ +Total Test time \(real\) = +[0-9.]+ sec diff --git a/Tests/RunCMake/ctest_labels_for_subprojects/ModuleVariableCTestConfig-result.txt b/Tests/RunCMake/ctest_labels_for_subprojects/ModuleVariableCTestConfig-result.txt new file mode 100644 index 0000000..45a4fb7 --- /dev/null +++ b/Tests/RunCMake/ctest_labels_for_subprojects/ModuleVariableCTestConfig-result.txt @@ -0,0 +1 @@ +8 diff --git a/Tests/RunCMake/ctest_labels_for_subprojects/ModuleVariableCTestConfig-stderr.txt b/Tests/RunCMake/ctest_labels_for_subprojects/ModuleVariableCTestConfig-stderr.txt new file mode 100644 index 0000000..ba4235d --- /dev/null +++ b/Tests/RunCMake/ctest_labels_for_subprojects/ModuleVariableCTestConfig-stderr.txt @@ -0,0 +1 @@ +Errors while running CTest diff --git a/Tests/RunCMake/ctest_labels_for_subprojects/ModuleVariableCTestConfig-stdout.txt b/Tests/RunCMake/ctest_labels_for_subprojects/ModuleVariableCTestConfig-stdout.txt new file mode 100644 index 0000000..01851fd --- /dev/null +++ b/Tests/RunCMake/ctest_labels_for_subprojects/ModuleVariableCTestConfig-stdout.txt @@ -0,0 +1,6 @@ +67% tests passed, 1 tests failed out of 3 ++ +Subproject Time Summary: +MySubproject += +[0-9.]+ sec \(2 tests\) ++ +Total Test time \(real\) = +[0-9.]+ sec diff --git a/Tests/RunCMake/ctest_labels_for_subprojects/ModuleVariableCTestConfigNoSummary-result.txt b/Tests/RunCMake/ctest_labels_for_subprojects/ModuleVariableCTestConfigNoSummary-result.txt new file mode 100644 index 0000000..45a4fb7 --- /dev/null +++ b/Tests/RunCMake/ctest_labels_for_subprojects/ModuleVariableCTestConfigNoSummary-result.txt @@ -0,0 +1 @@ +8 diff --git a/Tests/RunCMake/ctest_labels_for_subprojects/ModuleVariableCTestConfigNoSummary-stderr.txt b/Tests/RunCMake/ctest_labels_for_subprojects/ModuleVariableCTestConfigNoSummary-stderr.txt new file mode 100644 index 0000000..ba4235d --- /dev/null +++ b/Tests/RunCMake/ctest_labels_for_subprojects/ModuleVariableCTestConfigNoSummary-stderr.txt @@ -0,0 +1 @@ +Errors while running CTest diff --git a/Tests/RunCMake/ctest_labels_for_subprojects/ModuleVariableCTestConfigNoSummary-stdout.txt b/Tests/RunCMake/ctest_labels_for_subprojects/ModuleVariableCTestConfigNoSummary-stdout.txt new file mode 100644 index 0000000..0209bfe --- /dev/null +++ b/Tests/RunCMake/ctest_labels_for_subprojects/ModuleVariableCTestConfigNoSummary-stdout.txt @@ -0,0 +1,7 @@ +67% tests passed, 1 tests failed out of 3 ++ +Label Time Summary: +MySubproject += +[0-9.]+ sec \(2 tests\) +NotASubproject += +[0-9.]+ sec \(1 test\) ++ +Total Test time \(real\) = +[0-9.]+ sec diff --git a/Tests/RunCMake/ctest_labels_for_subprojects/ModuleVariableCommandLine-result.txt b/Tests/RunCMake/ctest_labels_for_subprojects/ModuleVariableCommandLine-result.txt new file mode 100644 index 0000000..45a4fb7 --- /dev/null +++ b/Tests/RunCMake/ctest_labels_for_subprojects/ModuleVariableCommandLine-result.txt @@ -0,0 +1 @@ +8 diff --git a/Tests/RunCMake/ctest_labels_for_subprojects/ModuleVariableCommandLine-stderr.txt b/Tests/RunCMake/ctest_labels_for_subprojects/ModuleVariableCommandLine-stderr.txt new file mode 100644 index 0000000..ba4235d --- /dev/null +++ b/Tests/RunCMake/ctest_labels_for_subprojects/ModuleVariableCommandLine-stderr.txt @@ -0,0 +1 @@ +Errors while running CTest diff --git a/Tests/RunCMake/ctest_labels_for_subprojects/ModuleVariableCommandLine-stdout.txt b/Tests/RunCMake/ctest_labels_for_subprojects/ModuleVariableCommandLine-stdout.txt new file mode 100644 index 0000000..b5d76a9 --- /dev/null +++ b/Tests/RunCMake/ctest_labels_for_subprojects/ModuleVariableCommandLine-stdout.txt @@ -0,0 +1,6 @@ +50% tests passed, 1 tests failed out of 2 ++ +Subproject Time Summary: +MySubproject += +[0-9.]+ sec \(2 tests\) ++ +Total Test time \(real\) = +[0-9.]+ sec diff --git a/Tests/RunCMake/ctest_labels_for_subprojects/MyExperimentalFeature/CMakeLists.txt b/Tests/RunCMake/ctest_labels_for_subprojects/MyExperimentalFeature/CMakeLists.txt new file mode 100644 index 0000000..cc07a07 --- /dev/null +++ b/Tests/RunCMake/ctest_labels_for_subprojects/MyExperimentalFeature/CMakeLists.txt @@ -0,0 +1,33 @@ +project(MyExperimentalFeature) +cmake_minimum_required(VERSION 3.8) + +include(CTest) + +set(CMAKE_DIRECTORY_LABELS "MyExperimentalFeature;NotASubproject") + +add_executable(testapp experimental.c) + +add_test(experimentalFail1 testapp 5) +set_tests_properties (experimentalFail1 + PROPERTIES PASS_REGULAR_EXPRESSION "Test!" + ) + +add_test(experimentalFail2 testapp -5) +set_tests_properties (experimentalFail2 + PROPERTIES PASS_REGULAR_EXPRESSION "Test!" + ) + +add_test(experimentalFail3 testapp -5) +set_tests_properties (experimentalFail3 + PROPERTIES PASS_REGULAR_EXPRESSION "Test!" + ) + +add_test(experimentalFail4 testapp -5) +set_tests_properties (experimentalFail4 + PROPERTIES PASS_REGULAR_EXPRESSION "Test!" + ) + +add_test(experimentalFail5 testapp -5) +set_tests_properties (experimentalFail5 + PROPERTIES PASS_REGULAR_EXPRESSION "Test!" + ) diff --git a/Tests/RunCMake/ctest_labels_for_subprojects/MyExperimentalFeature/experimental.c b/Tests/RunCMake/ctest_labels_for_subprojects/MyExperimentalFeature/experimental.c new file mode 100644 index 0000000..7cb11ae --- /dev/null +++ b/Tests/RunCMake/ctest_labels_for_subprojects/MyExperimentalFeature/experimental.c @@ -0,0 +1,16 @@ +#include <stdio.h> + +int main(void) +{ + int i = 0; + if (i > 0) { + printf("This doesn't happen.\n"); + printf("Neither does this.\n"); + } + i = i + 1; + if (i > 0) { + printf("This does happen.\n"); + } + + return 0; +} diff --git a/Tests/RunCMake/ctest_labels_for_subprojects/MyProductionCode/CMakeLists.txt b/Tests/RunCMake/ctest_labels_for_subprojects/MyProductionCode/CMakeLists.txt new file mode 100644 index 0000000..c2ee673 --- /dev/null +++ b/Tests/RunCMake/ctest_labels_for_subprojects/MyProductionCode/CMakeLists.txt @@ -0,0 +1,12 @@ +project(MyProductionCode) +cmake_minimum_required(VERSION 3.8) + +include(CTest) + +add_executable(production production.c) +add_test(NAME production COMMAND production) + +set_property(TARGET production PROPERTY LABELS MyProductionCode) +set_property(TEST production PROPERTY LABELS MyProductionCode) + +set_property(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} PROPERTY LABELS "NotASubproject") diff --git a/Tests/RunCMake/ctest_labels_for_subprojects/MyProductionCode/production.c b/Tests/RunCMake/ctest_labels_for_subprojects/MyProductionCode/production.c new file mode 100644 index 0000000..54dc2be --- /dev/null +++ b/Tests/RunCMake/ctest_labels_for_subprojects/MyProductionCode/production.c @@ -0,0 +1,16 @@ +#include <stdio.h> + +int main(void) +{ + int j = 0; + if (j > 0) { + printf("This doesn't happen.\n"); + printf("Neither does this.\n"); + } + j = j + 1; + if (j > 0) { + printf("This does happen.\n"); + } + + return 0; +} diff --git a/Tests/RunCMake/ctest_labels_for_subprojects/MyThirdPartyDependency/CMakeLists.txt b/Tests/RunCMake/ctest_labels_for_subprojects/MyThirdPartyDependency/CMakeLists.txt new file mode 100644 index 0000000..d5b9c2f --- /dev/null +++ b/Tests/RunCMake/ctest_labels_for_subprojects/MyThirdPartyDependency/CMakeLists.txt @@ -0,0 +1,7 @@ +project(MyThirdPartyDependency) +cmake_minimum_required(VERSION 3.8) + +include(CTest) + +set_directory_properties(PROPERTIES LABELS "NotASubproject;MyThirdPartyDependency") +add_subdirectory(src) diff --git a/Tests/RunCMake/ctest_labels_for_subprojects/MyThirdPartyDependency/src/CMakeLists.txt b/Tests/RunCMake/ctest_labels_for_subprojects/MyThirdPartyDependency/src/CMakeLists.txt new file mode 100644 index 0000000..dc6cb2a --- /dev/null +++ b/Tests/RunCMake/ctest_labels_for_subprojects/MyThirdPartyDependency/src/CMakeLists.txt @@ -0,0 +1,10 @@ +project(MyThirdPartyDependency) +cmake_minimum_required(VERSION 3.8) + +include(CTest) + +add_executable(thirdparty thirdparty.c) +add_test(NAME thirdparty COMMAND thirdparty) + +set_property(TARGET thirdparty PROPERTY LABELS NotASubproject) +set_property(TEST thirdparty PROPERTY LABELS NotASubproject) diff --git a/Tests/RunCMake/ctest_labels_for_subprojects/MyThirdPartyDependency/src/thirdparty.c b/Tests/RunCMake/ctest_labels_for_subprojects/MyThirdPartyDependency/src/thirdparty.c new file mode 100644 index 0000000..babe82d --- /dev/null +++ b/Tests/RunCMake/ctest_labels_for_subprojects/MyThirdPartyDependency/src/thirdparty.c @@ -0,0 +1,14 @@ +#include <stdio.h> + +int main(void) +{ + printf(This function has an error!\n"); + n = 5; + return 0; +} + +int notcalled() +{ + printf(This function doesn't get called.\n"); + return 0; +} diff --git a/Tests/RunCMake/ctest_labels_for_subprojects/RunCMakeTest.cmake b/Tests/RunCMake/ctest_labels_for_subprojects/RunCMakeTest.cmake new file mode 100644 index 0000000..dbe7bf8 --- /dev/null +++ b/Tests/RunCMake/ctest_labels_for_subprojects/RunCMakeTest.cmake @@ -0,0 +1,185 @@ +include(RunCTest) + + +# 1. Specify subprojects in the CTest script +function(run_CTestScriptVariable) + set(CTEST_EXTRA_CONFIG "set(CTEST_USE_LAUNCHERS 1)") + set(CASE_TEST_PREFIX_CODE [[ +file(COPY "${CTEST_RUNCMAKE_SOURCE_DIRECTORY}/MyProductionCode" + DESTINATION ${CTEST_SOURCE_DIRECTORY}) +file(COPY "${CTEST_RUNCMAKE_SOURCE_DIRECTORY}/MyExperimentalFeature" + DESTINATION ${CTEST_SOURCE_DIRECTORY}) + +set(CTEST_LABELS_FOR_SUBPROJECTS "MyProductionCode;MyExperimentalFeature") + ]]) + set(CASE_CMAKELISTS_SUFFIX_CODE [[ +add_subdirectory(MyExperimentalFeature) +add_subdirectory(MyProductionCode) + ]]) + + run_ctest(CTestScriptVariable) + + unset(CTEST_EXTRA_CONFIG) + unset(CASE_TEST_PREFIX_CODE) + unset(CASE_CMAKELISTS_SUFFIX_CODE) +endfunction() +run_CTestScriptVariable() + +# 2. Specify subprojects via a CTest script variable on the command line e.g. +# ctest -S test.cmake -DCTEST_LABELS_FOR_SUBPROJECTS:STRING="MySubproject" +# Note: This test includes a failing build +function(run_CTestScriptVariableCommandLine) + set(CTEST_EXTRA_CONFIG "set(CTEST_USE_LAUNCHERS 1)") + set(CASE_TEST_PREFIX_CODE [[ +file(COPY "${CTEST_RUNCMAKE_SOURCE_DIRECTORY}/MyThirdPartyDependency" + DESTINATION ${CTEST_SOURCE_DIRECTORY}) + ]]) + set(CASE_CMAKELISTS_SUFFIX_CODE [[ +add_subdirectory(MyThirdPartyDependency) + ]]) + + run_ctest(CTestScriptVariableCommandLine "-DCTEST_LABELS_FOR_SUBPROJECTS:STRING=MyThirdPartyDependency") + + unset(CTEST_EXTRA_CONFIG) + unset(CASE_TEST_PREFIX_CODE) + unset(CASE_CMAKELISTS_SUFFIX_CODE) +endfunction() +run_CTestScriptVariableCommandLine() + +# 3. Set subprojects via a CTest module variable on the command line +# (will populate DartConfiguration.tcl) +function(run_ModuleVariableCommandLine) + set(RunCMake_TEST_SOURCE_DIR "${RunCMake_BINARY_DIR}/ModuleVariableCommandLine") + set(RunCMake_TEST_BINARY_DIR "${RunCMake_BINARY_DIR}/ModuleVariableCommandLine-build") + set(RunCMake_TEST_NO_CLEAN 1) + file(REMOVE_RECURSE "${RunCMake_TEST_SOURCE_DIR}") + file(REMOVE_RECURSE "${RunCMake_TEST_BINARY_DIR}") + file(MAKE_DIRECTORY "${RunCMake_TEST_BINARY_DIR}") + + set(CASE_CMAKELISTS_SUFFIX_CODE [[ +set(someFile "${CMAKE_CURRENT_SOURCE_DIR}/test.cmake") +add_test(NAME SuccessfulTest COMMAND "${CMAKE_COMMAND}" --version) +set_property(TEST SuccessfulTest PROPERTY LABELS MySubproject) +add_test(NAME FailingTest + COMMAND ${CMAKE_COMMAND} -E compare_files "${someFile}" "${someFile}xxx") +set_property(TEST FailingTest PROPERTY LABELS MySubproject) + ]]) + configure_file(${RunCMake_SOURCE_DIR}/CMakeLists.txt.in + ${RunCMake_TEST_SOURCE_DIR}/CMakeLists.txt @ONLY) + + set(RunCMake_TEST_OPTIONS "-DCTEST_LABELS_FOR_SUBPROJECTS:STRING=MySubproject") + run_cmake(ModuleVariableCommandLine-cmake) + unset(RunCMake_TEST_OPTIONS) + run_cmake_command(ModuleVariableCommandLine ${CMAKE_CTEST_COMMAND} -C Debug -V) + + unset(RunCMake_TEST_SOURCE_DIR) + unset(RunCMake_TEST_BINARY_DIR) + unset(RunCMake_TEST_NO_CLEAN) + unset(CASE_CMAKELISTS_SUFFIX_CODE) +endfunction() +run_ModuleVariableCommandLine() + +# 4. Set subprojects via a CTest module variable in CMakeLists.txt +# (will populate DartConfiguration.tcl) +function(run_ModuleVariableCMakeLists) + set(RunCMake_TEST_SOURCE_DIR "${RunCMake_BINARY_DIR}/ModuleVariableCMakeLists") + set(RunCMake_TEST_BINARY_DIR "${RunCMake_BINARY_DIR}/ModuleVariableCMakeLists-build") + set(RunCMake_TEST_NO_CLEAN 1) + file(REMOVE_RECURSE "${RunCMake_TEST_SOURCE_DIR}") + file(REMOVE_RECURSE "${RunCMake_TEST_BINARY_DIR}") + file(MAKE_DIRECTORY "${RunCMake_TEST_BINARY_DIR}") + + set(CASE_CMAKELISTS_PREFIX_CODE [[ +set(CTEST_LABELS_FOR_SUBPROJECTS MySubproject) +]]) + + set(CASE_CMAKELISTS_SUFFIX_CODE [[ +set(someFile "${CMAKE_CURRENT_SOURCE_DIR}/test.cmake") +add_test(NAME SuccessfulTest COMMAND "${CMAKE_COMMAND}" --version) +set_property(TEST SuccessfulTest PROPERTY LABELS MySubproject) +add_test(NAME FailingTest + COMMAND ${CMAKE_COMMAND} -E compare_files "${someFile}" "${someFile}xxx") +set_property(TEST FailingTest PROPERTY LABELS MySubproject) + ]]) + configure_file(${RunCMake_SOURCE_DIR}/CMakeLists.txt.in + ${RunCMake_TEST_SOURCE_DIR}/CMakeLists.txt @ONLY) + + run_cmake(ModuleVariableCMakeLists-cmake) + run_cmake_command(ModuleVariableCMakeLists ${CMAKE_CTEST_COMMAND} -C Debug -V) + + unset(RunCMake_TEST_SOURCE_DIR) + unset(RunCMake_TEST_BINARY_DIR) + unset(RunCMake_TEST_NO_CLEAN) + unset(CASE_CMAKELISTS_SUFFIX_CODE) + unset(CASE_CMAKELISTS_SUFFIX_CODE) +endfunction() +run_ModuleVariableCMakeLists() + +# The remaining tests set subprojects in CTestConfig.cmake. Settings in this +# config file are shared by both the CTest module and the ctest command line +# `Dashboard Client` mode (e.g. ctest -S). + +function(run_ModuleVariableCTestConfig CASE_NAME) + set(RunCMake_TEST_SOURCE_DIR "${RunCMake_BINARY_DIR}/${CASE_NAME}") + set(RunCMake_TEST_BINARY_DIR "${RunCMake_BINARY_DIR}/${CASE_NAME}-build") + set(RunCMake_TEST_NO_CLEAN 1) + file(REMOVE_RECURSE "${RunCMake_TEST_SOURCE_DIR}") + file(REMOVE_RECURSE "${RunCMake_TEST_BINARY_DIR}") + file(MAKE_DIRECTORY "${RunCMake_TEST_BINARY_DIR}") + + set(CTEST_EXTRA_CONFIG "set(CTEST_LABELS_FOR_SUBPROJECTS \"MySubproject\")") + configure_file(${RunCMake_SOURCE_DIR}/CTestConfig.cmake.in + ${RunCMake_TEST_SOURCE_DIR}/CTestConfig.cmake @ONLY) + + set(CASE_CMAKELISTS_SUFFIX_CODE [[ +set(someFile "${CMAKE_CURRENT_SOURCE_DIR}/test.cmake") +add_test(NAME SuccessfulTest COMMAND "${CMAKE_COMMAND}" --version) +set_property(TEST SuccessfulTest PROPERTY LABELS MySubproject) +add_test(NAME FailingTest + COMMAND ${CMAKE_COMMAND} -E compare_files "${someFile}" "${someFile}xxx") +set_property(TEST FailingTest PROPERTY LABELS MySubproject) +add_test(NAME AnotherSuccessfulTest COMMAND "${CMAKE_COMMAND}" --version) +set_property(TEST AnotherSuccessfulTest PROPERTY LABELS NotASubproject) + ]]) + configure_file(${RunCMake_SOURCE_DIR}/CMakeLists.txt.in + ${RunCMake_TEST_SOURCE_DIR}/CMakeLists.txt @ONLY) + + run_cmake(${CASE_NAME}-cmake) + run_cmake_command(${CASE_NAME} ${CMAKE_CTEST_COMMAND} -C Debug -V ${ARGN}) + + unset(RunCMake_TEST_SOURCE_DIR) + unset(RunCMake_TEST_BINARY_DIR) + unset(RunCMake_TEST_NO_CLEAN) + unset(CTEST_EXTRA_CONFIG) + unset(CASE_CMAKELISTS_SUFFIX_CODE) +endfunction() + +# 5. Check that the Subproject timing Summary is printed +run_ModuleVariableCTestConfig(ModuleVariableCTestConfig) + +# 6. Use --no-subproject-summary to disable the Subproject timing summary. +run_ModuleVariableCTestConfig(ModuleVariableCTestConfigNoSummary --no-subproject-summary) + +# 7. Verify that subprojects are sent to CDash when running a CTest script +function(run_CTestConfigCTestScript) + set(CTEST_EXTRA_CONFIG [[ +set(CTEST_USE_LAUNCHERS 1) +set(CTEST_LABELS_FOR_SUBPROJECTS "MyProductionCode;MyExperimentalFeature") + ]]) + set(CASE_TEST_PREFIX_CODE [[ +file(COPY "${CTEST_RUNCMAKE_SOURCE_DIRECTORY}/MyProductionCode" + DESTINATION ${CTEST_SOURCE_DIRECTORY}) +file(COPY "${CTEST_RUNCMAKE_SOURCE_DIRECTORY}/MyExperimentalFeature" + DESTINATION ${CTEST_SOURCE_DIRECTORY}) + ]]) + set(CASE_CMAKELISTS_SUFFIX_CODE [[ +add_subdirectory(MyExperimentalFeature) +add_subdirectory(MyProductionCode) + ]]) + run_ctest(CTestConfigCTestScript) + + unset(CTEST_EXTRA_CONFIG) + unset(CASE_TEST_PREFIX_CODE) + unset(CASE_CMAKELISTS_SUFFIX_CODE) +endfunction() +run_CTestConfigCTestScript() diff --git a/Tests/RunCMake/ctest_labels_for_subprojects/test.cmake.in b/Tests/RunCMake/ctest_labels_for_subprojects/test.cmake.in new file mode 100644 index 0000000..8cec08d --- /dev/null +++ b/Tests/RunCMake/ctest_labels_for_subprojects/test.cmake.in @@ -0,0 +1,21 @@ +cmake_minimum_required(VERSION 3.7) + +# Settings: + +set(CTEST_SITE "test-site") +set(CTEST_BUILD_NAME "test-build-name") +set(CTEST_SOURCE_DIRECTORY "@RunCMake_BINARY_DIR@/@CASE_NAME@") +set(CTEST_BINARY_DIRECTORY "@RunCMake_BINARY_DIR@/@CASE_NAME@-build") +set(CTEST_CMAKE_GENERATOR "@RunCMake_GENERATOR@") +set(CTEST_CMAKE_GENERATOR_PLATFORM "@RunCMake_GENERATOR_PLATFORM@") +set(CTEST_CMAKE_GENERATOR_TOOLSET "@RunCMake_GENERATOR_TOOLSET@") +set(CTEST_BUILD_CONFIGURATION "$ENV{CMAKE_CONFIG_TYPE}") +set(CTEST_RUNCMAKE_SOURCE_DIRECTORY "@RunCMake_SOURCE_DIR@") + +@CASE_TEST_PREFIX_CODE@ + +set(ctest_test_args "@CASE_CTEST_TEST_ARGS@") +ctest_start(Experimental) +ctest_configure() +ctest_build() +ctest_test(${ctest_test_args}) diff --git a/Tests/RunCMake/find_package/PackageRoot-stderr.txt b/Tests/RunCMake/find_package/PackageRoot-stderr.txt index 07b27bd..409fa89 100644 --- a/Tests/RunCMake/find_package/PackageRoot-stderr.txt +++ b/Tests/RunCMake/find_package/PackageRoot-stderr.txt @@ -1,7 +1,9 @@ Foo_ROOT : ENV{Foo_ROOT} : FOO_TEST_FILE_FOO :FOO_TEST_FILE_FOO-NOTFOUND +FOO_TEST_FILE_ZOT :FOO_TEST_FILE_ZOT-NOTFOUND FOO_TEST_PATH_FOO :FOO_TEST_PATH_FOO-NOTFOUND +FOO_TEST_PATH_ZOT :FOO_TEST_PATH_ZOT-NOTFOUND FOO_TEST_PROG_FOO :FOO_TEST_PROG_FOO-NOTFOUND Foo_ROOT : @@ -13,15 +15,19 @@ FOO_TEST_PATH_FOO :FOO_TEST_PATH_FOO-NOTFOUND FOO_TEST_PROG_FOO :FOO_TEST_PROG_FOO-NOTFOUND BAR_TEST_FILE_FOO :BAR_TEST_FILE_FOO-NOTFOUND BAR_TEST_FILE_BAR :BAR_TEST_FILE_BAR-NOTFOUND +BAR_TEST_FILE_ZOT :BAR_TEST_FILE_ZOT-NOTFOUND BAR_TEST_PATH_FOO :BAR_TEST_PATH_FOO-NOTFOUND BAR_TEST_PATH_BAR :BAR_TEST_PATH_BAR-NOTFOUND +BAR_TEST_PATH_ZOT :BAR_TEST_PATH_ZOT-NOTFOUND BAR_TEST_PROG_FOO :BAR_TEST_PROG_FOO-NOTFOUND BAR_TEST_PROG_BAR :BAR_TEST_PROG_BAR-NOTFOUND Foo_ROOT :.*/PackageRoot/foo/cmake_root ENV{Foo_ROOT} : FOO_TEST_FILE_FOO :.*/PackageRoot/foo/cmake_root/include/foo.h +FOO_TEST_FILE_ZOT :.*/PackageRoot/foo/cmake_root/include/zot/zot.h FOO_TEST_PATH_FOO :.*/PackageRoot/foo/cmake_root/include +FOO_TEST_PATH_ZOT :.*/PackageRoot/foo/cmake_root/include/zot FOO_TEST_PROG_FOO :.*/PackageRoot/foo/cmake_root/bin/foo.exe Foo_ROOT :.*/PackageRoot/foo/cmake_root @@ -33,15 +39,19 @@ FOO_TEST_PATH_FOO :.*/PackageRoot/foo/cmake_root/include FOO_TEST_PROG_FOO :.*/PackageRoot/foo/cmake_root/bin/foo.exe BAR_TEST_FILE_FOO :.*/PackageRoot/foo/cmake_root/include/foo.h BAR_TEST_FILE_BAR :.*/PackageRoot/foo/cmake_root/include/bar.h +BAR_TEST_FILE_ZOT :.*/PackageRoot/foo/cmake_root/include/zot/zot.h BAR_TEST_PATH_FOO :.*/PackageRoot/foo/cmake_root/include BAR_TEST_PATH_BAR :.*/PackageRoot/foo/cmake_root/include +BAR_TEST_PATH_ZOT :.*/PackageRoot/foo/cmake_root/include/zot BAR_TEST_PROG_FOO :.*/PackageRoot/foo/cmake_root/bin/foo.exe BAR_TEST_PROG_BAR :.*/PackageRoot/foo/cmake_root/bin/bar.exe Foo_ROOT : ENV{Foo_ROOT} :.*/PackageRoot/foo/env_root FOO_TEST_FILE_FOO :.*/PackageRoot/foo/env_root/include/foo.h +FOO_TEST_FILE_ZOT :.*/PackageRoot/foo/cmake_root/include/zot/zot.h FOO_TEST_PATH_FOO :.*/PackageRoot/foo/env_root/include +FOO_TEST_PATH_ZOT :.*/PackageRoot/foo/cmake_root/include/zot FOO_TEST_PROG_FOO :.*/PackageRoot/foo/env_root/bin/foo.exe Foo_ROOT : @@ -53,15 +63,19 @@ FOO_TEST_PATH_FOO :.*/PackageRoot/foo/env_root/include FOO_TEST_PROG_FOO :.*/PackageRoot/foo/env_root/bin/foo.exe BAR_TEST_FILE_FOO :.*/PackageRoot/foo/env_root/include/foo.h BAR_TEST_FILE_BAR :.*/PackageRoot/foo/env_root/include/bar.h +BAR_TEST_FILE_ZOT :.*/PackageRoot/foo/cmake_root/include/zot/zot.h BAR_TEST_PATH_FOO :.*/PackageRoot/foo/env_root/include BAR_TEST_PATH_BAR :.*/PackageRoot/foo/env_root/include +BAR_TEST_PATH_ZOT :.*/PackageRoot/foo/cmake_root/include/zot BAR_TEST_PROG_FOO :.*/PackageRoot/foo/env_root/bin/foo.exe BAR_TEST_PROG_BAR :.*/PackageRoot/foo/env_root/bin/bar.exe Foo_ROOT :.*/PackageRoot/foo/cmake_root ENV{Foo_ROOT} :.*/PackageRoot/foo/env_root FOO_TEST_FILE_FOO :.*/PackageRoot/foo/cmake_root/include/foo.h +FOO_TEST_FILE_ZOT :.*/PackageRoot/foo/cmake_root/include/zot/zot.h FOO_TEST_PATH_FOO :.*/PackageRoot/foo/cmake_root/include +FOO_TEST_PATH_ZOT :.*/PackageRoot/foo/cmake_root/include/zot FOO_TEST_PROG_FOO :.*/PackageRoot/foo/cmake_root/bin/foo.exe Foo_ROOT :.*/PackageRoot/foo/cmake_root @@ -73,15 +87,19 @@ FOO_TEST_PATH_FOO :.*/PackageRoot/foo/cmake_root/include FOO_TEST_PROG_FOO :.*/PackageRoot/foo/cmake_root/bin/foo.exe BAR_TEST_FILE_FOO :.*/PackageRoot/foo/cmake_root/include/foo.h BAR_TEST_FILE_BAR :.*/PackageRoot/foo/cmake_root/include/bar.h +BAR_TEST_FILE_ZOT :.*/PackageRoot/foo/cmake_root/include/zot/zot.h BAR_TEST_PATH_FOO :.*/PackageRoot/foo/cmake_root/include BAR_TEST_PATH_BAR :.*/PackageRoot/foo/cmake_root/include +BAR_TEST_PATH_ZOT :.*/PackageRoot/foo/cmake_root/include/zot BAR_TEST_PROG_FOO :.*/PackageRoot/foo/cmake_root/bin/foo.exe BAR_TEST_PROG_BAR :.*/PackageRoot/foo/cmake_root/bin/bar.exe Foo_ROOT : ENV{Foo_ROOT} : FOO_TEST_FILE_FOO :FOO_TEST_FILE_FOO-NOTFOUND +FOO_TEST_FILE_ZOT :.*/PackageRoot/foo/cmake_root/include/zot/zot.h FOO_TEST_PATH_FOO :FOO_TEST_PATH_FOO-NOTFOUND +FOO_TEST_PATH_ZOT :.*/PackageRoot/foo/cmake_root/include/zot FOO_TEST_PROG_FOO :FOO_TEST_PROG_FOO-NOTFOUND Foo_ROOT : @@ -93,15 +111,19 @@ FOO_TEST_PATH_FOO :FOO_TEST_PATH_FOO-NOTFOUND FOO_TEST_PROG_FOO :FOO_TEST_PROG_FOO-NOTFOUND BAR_TEST_FILE_FOO :BAR_TEST_FILE_FOO-NOTFOUND BAR_TEST_FILE_BAR :.*/PackageRoot/bar/cmake_root/include/bar.h +BAR_TEST_FILE_ZOT :.*/PackageRoot/foo/cmake_root/include/zot/zot.h BAR_TEST_PATH_FOO :BAR_TEST_PATH_FOO-NOTFOUND BAR_TEST_PATH_BAR :.*/PackageRoot/bar/cmake_root/include +BAR_TEST_PATH_ZOT :.*/PackageRoot/foo/cmake_root/include/zot BAR_TEST_PROG_FOO :BAR_TEST_PROG_FOO-NOTFOUND BAR_TEST_PROG_BAR :.*/PackageRoot/bar/cmake_root/bin/bar.exe Foo_ROOT : ENV{Foo_ROOT} : FOO_TEST_FILE_FOO :FOO_TEST_FILE_FOO-NOTFOUND +FOO_TEST_FILE_ZOT :.*/PackageRoot/foo/cmake_root/include/zot/zot.h FOO_TEST_PATH_FOO :FOO_TEST_PATH_FOO-NOTFOUND +FOO_TEST_PATH_ZOT :.*/PackageRoot/foo/cmake_root/include/zot FOO_TEST_PROG_FOO :FOO_TEST_PROG_FOO-NOTFOUND Foo_ROOT : @@ -113,15 +135,19 @@ FOO_TEST_PATH_FOO :FOO_TEST_PATH_FOO-NOTFOUND FOO_TEST_PROG_FOO :FOO_TEST_PROG_FOO-NOTFOUND BAR_TEST_FILE_FOO :BAR_TEST_FILE_FOO-NOTFOUND BAR_TEST_FILE_BAR :.*/PackageRoot/bar/env_root/include/bar.h +BAR_TEST_FILE_ZOT :.*/PackageRoot/foo/cmake_root/include/zot/zot.h BAR_TEST_PATH_FOO :BAR_TEST_PATH_FOO-NOTFOUND BAR_TEST_PATH_BAR :.*/PackageRoot/bar/env_root/include +BAR_TEST_PATH_ZOT :.*/PackageRoot/foo/cmake_root/include/zot BAR_TEST_PROG_FOO :BAR_TEST_PROG_FOO-NOTFOUND BAR_TEST_PROG_BAR :.*/PackageRoot/bar/env_root/bin/bar.exe Foo_ROOT : ENV{Foo_ROOT} : FOO_TEST_FILE_FOO :FOO_TEST_FILE_FOO-NOTFOUND +FOO_TEST_FILE_ZOT :.*/PackageRoot/foo/cmake_root/include/zot/zot.h FOO_TEST_PATH_FOO :FOO_TEST_PATH_FOO-NOTFOUND +FOO_TEST_PATH_ZOT :.*/PackageRoot/foo/cmake_root/include/zot FOO_TEST_PROG_FOO :FOO_TEST_PROG_FOO-NOTFOUND Foo_ROOT : @@ -133,15 +159,19 @@ FOO_TEST_PATH_FOO :FOO_TEST_PATH_FOO-NOTFOUND FOO_TEST_PROG_FOO :FOO_TEST_PROG_FOO-NOTFOUND BAR_TEST_FILE_FOO :BAR_TEST_FILE_FOO-NOTFOUND BAR_TEST_FILE_BAR :.*/PackageRoot/bar/cmake_root/include/bar.h +BAR_TEST_FILE_ZOT :.*/PackageRoot/foo/cmake_root/include/zot/zot.h BAR_TEST_PATH_FOO :BAR_TEST_PATH_FOO-NOTFOUND BAR_TEST_PATH_BAR :.*/PackageRoot/bar/cmake_root/include +BAR_TEST_PATH_ZOT :.*/PackageRoot/foo/cmake_root/include/zot BAR_TEST_PROG_FOO :BAR_TEST_PROG_FOO-NOTFOUND BAR_TEST_PROG_BAR :.*/PackageRoot/bar/cmake_root/bin/bar.exe Foo_ROOT :.*/PackageRoot/foo/cmake_root ENV{Foo_ROOT} : FOO_TEST_FILE_FOO :.*/PackageRoot/foo/cmake_root/include/foo.h +FOO_TEST_FILE_ZOT :.*/PackageRoot/foo/cmake_root/include/zot/zot.h FOO_TEST_PATH_FOO :.*/PackageRoot/foo/cmake_root/include +FOO_TEST_PATH_ZOT :.*/PackageRoot/foo/cmake_root/include/zot FOO_TEST_PROG_FOO :.*/PackageRoot/foo/cmake_root/bin/foo.exe Foo_ROOT :.*/PackageRoot/foo/cmake_root @@ -153,15 +183,19 @@ FOO_TEST_PATH_FOO :.*/PackageRoot/foo/cmake_root/include FOO_TEST_PROG_FOO :.*/PackageRoot/foo/cmake_root/bin/foo.exe BAR_TEST_FILE_FOO :.*/PackageRoot/foo/cmake_root/include/foo.h BAR_TEST_FILE_BAR :.*/PackageRoot/bar/cmake_root/include/bar.h +BAR_TEST_FILE_ZOT :.*/PackageRoot/foo/cmake_root/include/zot/zot.h BAR_TEST_PATH_FOO :.*/PackageRoot/foo/cmake_root/include BAR_TEST_PATH_BAR :.*/PackageRoot/bar/cmake_root/include +BAR_TEST_PATH_ZOT :.*/PackageRoot/foo/cmake_root/include/zot BAR_TEST_PROG_FOO :.*/PackageRoot/foo/cmake_root/bin/foo.exe BAR_TEST_PROG_BAR :.*/PackageRoot/bar/cmake_root/bin/bar.exe Foo_ROOT : ENV{Foo_ROOT} :.*/PackageRoot/foo/env_root FOO_TEST_FILE_FOO :.*/PackageRoot/foo/env_root/include/foo.h +FOO_TEST_FILE_ZOT :.*/PackageRoot/foo/cmake_root/include/zot/zot.h FOO_TEST_PATH_FOO :.*/PackageRoot/foo/env_root/include +FOO_TEST_PATH_ZOT :.*/PackageRoot/foo/cmake_root/include/zot FOO_TEST_PROG_FOO :.*/PackageRoot/foo/env_root/bin/foo.exe Foo_ROOT : @@ -173,15 +207,19 @@ FOO_TEST_PATH_FOO :.*/PackageRoot/foo/env_root/include FOO_TEST_PROG_FOO :.*/PackageRoot/foo/env_root/bin/foo.exe BAR_TEST_FILE_FOO :.*/PackageRoot/foo/env_root/include/foo.h BAR_TEST_FILE_BAR :.*/PackageRoot/bar/cmake_root/include/bar.h +BAR_TEST_FILE_ZOT :.*/PackageRoot/foo/cmake_root/include/zot/zot.h BAR_TEST_PATH_FOO :.*/PackageRoot/foo/env_root/include BAR_TEST_PATH_BAR :.*/PackageRoot/bar/cmake_root/include +BAR_TEST_PATH_ZOT :.*/PackageRoot/foo/cmake_root/include/zot BAR_TEST_PROG_FOO :.*/PackageRoot/foo/env_root/bin/foo.exe BAR_TEST_PROG_BAR :.*/PackageRoot/bar/cmake_root/bin/bar.exe Foo_ROOT :.*/PackageRoot/foo/cmake_root ENV{Foo_ROOT} :.*/PackageRoot/foo/env_root FOO_TEST_FILE_FOO :.*/PackageRoot/foo/cmake_root/include/foo.h +FOO_TEST_FILE_ZOT :.*/PackageRoot/foo/cmake_root/include/zot/zot.h FOO_TEST_PATH_FOO :.*/PackageRoot/foo/cmake_root/include +FOO_TEST_PATH_ZOT :.*/PackageRoot/foo/cmake_root/include/zot FOO_TEST_PROG_FOO :.*/PackageRoot/foo/cmake_root/bin/foo.exe Foo_ROOT :.*/PackageRoot/foo/cmake_root @@ -193,15 +231,19 @@ FOO_TEST_PATH_FOO :.*/PackageRoot/foo/cmake_root/include FOO_TEST_PROG_FOO :.*/PackageRoot/foo/cmake_root/bin/foo.exe BAR_TEST_FILE_FOO :.*/PackageRoot/foo/cmake_root/include/foo.h BAR_TEST_FILE_BAR :.*/PackageRoot/bar/cmake_root/include/bar.h +BAR_TEST_FILE_ZOT :.*/PackageRoot/foo/cmake_root/include/zot/zot.h BAR_TEST_PATH_FOO :.*/PackageRoot/foo/cmake_root/include BAR_TEST_PATH_BAR :.*/PackageRoot/bar/cmake_root/include +BAR_TEST_PATH_ZOT :.*/PackageRoot/foo/cmake_root/include/zot BAR_TEST_PROG_FOO :.*/PackageRoot/foo/cmake_root/bin/foo.exe BAR_TEST_PROG_BAR :.*/PackageRoot/bar/cmake_root/bin/bar.exe Foo_ROOT :.*/PackageRoot/foo/cmake_root ENV{Foo_ROOT} : FOO_TEST_FILE_FOO :.*/PackageRoot/foo/cmake_root/include/foo.h +FOO_TEST_FILE_ZOT :.*/PackageRoot/foo/cmake_root/include/zot/zot.h FOO_TEST_PATH_FOO :.*/PackageRoot/foo/cmake_root/include +FOO_TEST_PATH_ZOT :.*/PackageRoot/foo/cmake_root/include/zot FOO_TEST_PROG_FOO :.*/PackageRoot/foo/cmake_root/bin/foo.exe Foo_ROOT :.*/PackageRoot/foo/cmake_root @@ -213,15 +255,19 @@ FOO_TEST_PATH_FOO :.*/PackageRoot/foo/cmake_root/include FOO_TEST_PROG_FOO :.*/PackageRoot/foo/cmake_root/bin/foo.exe BAR_TEST_FILE_FOO :.*/PackageRoot/foo/cmake_root/include/foo.h BAR_TEST_FILE_BAR :.*/PackageRoot/bar/env_root/include/bar.h +BAR_TEST_FILE_ZOT :.*/PackageRoot/foo/cmake_root/include/zot/zot.h BAR_TEST_PATH_FOO :.*/PackageRoot/foo/cmake_root/include BAR_TEST_PATH_BAR :.*/PackageRoot/bar/env_root/include +BAR_TEST_PATH_ZOT :.*/PackageRoot/foo/cmake_root/include/zot BAR_TEST_PROG_FOO :.*/PackageRoot/foo/cmake_root/bin/foo.exe BAR_TEST_PROG_BAR :.*/PackageRoot/bar/env_root/bin/bar.exe Foo_ROOT : ENV{Foo_ROOT} :.*/PackageRoot/foo/env_root FOO_TEST_FILE_FOO :.*/PackageRoot/foo/env_root/include/foo.h +FOO_TEST_FILE_ZOT :.*/PackageRoot/foo/cmake_root/include/zot/zot.h FOO_TEST_PATH_FOO :.*/PackageRoot/foo/env_root/include +FOO_TEST_PATH_ZOT :.*/PackageRoot/foo/cmake_root/include/zot FOO_TEST_PROG_FOO :.*/PackageRoot/foo/env_root/bin/foo.exe Foo_ROOT : @@ -233,15 +279,19 @@ FOO_TEST_PATH_FOO :.*/PackageRoot/foo/env_root/include FOO_TEST_PROG_FOO :.*/PackageRoot/foo/env_root/bin/foo.exe BAR_TEST_FILE_FOO :.*/PackageRoot/foo/env_root/include/foo.h BAR_TEST_FILE_BAR :.*/PackageRoot/bar/env_root/include/bar.h +BAR_TEST_FILE_ZOT :.*/PackageRoot/foo/cmake_root/include/zot/zot.h BAR_TEST_PATH_FOO :.*/PackageRoot/foo/env_root/include BAR_TEST_PATH_BAR :.*/PackageRoot/bar/env_root/include +BAR_TEST_PATH_ZOT :.*/PackageRoot/foo/cmake_root/include/zot BAR_TEST_PROG_FOO :.*/PackageRoot/foo/env_root/bin/foo.exe BAR_TEST_PROG_BAR :.*/PackageRoot/bar/env_root/bin/bar.exe Foo_ROOT :.*/PackageRoot/foo/cmake_root ENV{Foo_ROOT} :.*/PackageRoot/foo/env_root FOO_TEST_FILE_FOO :.*/PackageRoot/foo/cmake_root/include/foo.h +FOO_TEST_FILE_ZOT :.*/PackageRoot/foo/cmake_root/include/zot/zot.h FOO_TEST_PATH_FOO :.*/PackageRoot/foo/cmake_root/include +FOO_TEST_PATH_ZOT :.*/PackageRoot/foo/cmake_root/include/zot FOO_TEST_PROG_FOO :.*/PackageRoot/foo/cmake_root/bin/foo.exe Foo_ROOT :.*/PackageRoot/foo/cmake_root @@ -253,15 +303,19 @@ FOO_TEST_PATH_FOO :.*/PackageRoot/foo/cmake_root/include FOO_TEST_PROG_FOO :.*/PackageRoot/foo/cmake_root/bin/foo.exe BAR_TEST_FILE_FOO :.*/PackageRoot/foo/cmake_root/include/foo.h BAR_TEST_FILE_BAR :.*/PackageRoot/bar/env_root/include/bar.h +BAR_TEST_FILE_ZOT :.*/PackageRoot/foo/cmake_root/include/zot/zot.h BAR_TEST_PATH_FOO :.*/PackageRoot/foo/cmake_root/include BAR_TEST_PATH_BAR :.*/PackageRoot/bar/env_root/include +BAR_TEST_PATH_ZOT :.*/PackageRoot/foo/cmake_root/include/zot BAR_TEST_PROG_FOO :.*/PackageRoot/foo/cmake_root/bin/foo.exe BAR_TEST_PROG_BAR :.*/PackageRoot/bar/env_root/bin/bar.exe Foo_ROOT :.*/PackageRoot/foo/cmake_root ENV{Foo_ROOT} : FOO_TEST_FILE_FOO :.*/PackageRoot/foo/cmake_root/include/foo.h +FOO_TEST_FILE_ZOT :.*/PackageRoot/foo/cmake_root/include/zot/zot.h FOO_TEST_PATH_FOO :.*/PackageRoot/foo/cmake_root/include +FOO_TEST_PATH_ZOT :.*/PackageRoot/foo/cmake_root/include/zot FOO_TEST_PROG_FOO :.*/PackageRoot/foo/cmake_root/bin/foo.exe Foo_ROOT :.*/PackageRoot/foo/cmake_root @@ -273,15 +327,19 @@ FOO_TEST_PATH_FOO :.*/PackageRoot/foo/cmake_root/include FOO_TEST_PROG_FOO :.*/PackageRoot/foo/cmake_root/bin/foo.exe BAR_TEST_FILE_FOO :.*/PackageRoot/foo/cmake_root/include/foo.h BAR_TEST_FILE_BAR :.*/PackageRoot/bar/cmake_root/include/bar.h +BAR_TEST_FILE_ZOT :.*/PackageRoot/foo/cmake_root/include/zot/zot.h BAR_TEST_PATH_FOO :.*/PackageRoot/foo/cmake_root/include BAR_TEST_PATH_BAR :.*/PackageRoot/bar/cmake_root/include +BAR_TEST_PATH_ZOT :.*/PackageRoot/foo/cmake_root/include/zot BAR_TEST_PROG_FOO :.*/PackageRoot/foo/cmake_root/bin/foo.exe BAR_TEST_PROG_BAR :.*/PackageRoot/bar/cmake_root/bin/bar.exe Foo_ROOT : ENV{Foo_ROOT} :.*/PackageRoot/foo/env_root FOO_TEST_FILE_FOO :.*/PackageRoot/foo/env_root/include/foo.h +FOO_TEST_FILE_ZOT :.*/PackageRoot/foo/cmake_root/include/zot/zot.h FOO_TEST_PATH_FOO :.*/PackageRoot/foo/env_root/include +FOO_TEST_PATH_ZOT :.*/PackageRoot/foo/cmake_root/include/zot FOO_TEST_PROG_FOO :.*/PackageRoot/foo/env_root/bin/foo.exe Foo_ROOT : @@ -293,15 +351,19 @@ FOO_TEST_PATH_FOO :.*/PackageRoot/foo/env_root/include FOO_TEST_PROG_FOO :.*/PackageRoot/foo/env_root/bin/foo.exe BAR_TEST_FILE_FOO :.*/PackageRoot/foo/env_root/include/foo.h BAR_TEST_FILE_BAR :.*/PackageRoot/bar/cmake_root/include/bar.h +BAR_TEST_FILE_ZOT :.*/PackageRoot/foo/cmake_root/include/zot/zot.h BAR_TEST_PATH_FOO :.*/PackageRoot/foo/env_root/include BAR_TEST_PATH_BAR :.*/PackageRoot/bar/cmake_root/include +BAR_TEST_PATH_ZOT :.*/PackageRoot/foo/cmake_root/include/zot BAR_TEST_PROG_FOO :.*/PackageRoot/foo/env_root/bin/foo.exe BAR_TEST_PROG_BAR :.*/PackageRoot/bar/cmake_root/bin/bar.exe Foo_ROOT :.*/PackageRoot/foo/cmake_root ENV{Foo_ROOT} :.*/PackageRoot/foo/env_root FOO_TEST_FILE_FOO :.*/PackageRoot/foo/cmake_root/include/foo.h +FOO_TEST_FILE_ZOT :.*/PackageRoot/foo/cmake_root/include/zot/zot.h FOO_TEST_PATH_FOO :.*/PackageRoot/foo/cmake_root/include +FOO_TEST_PATH_ZOT :.*/PackageRoot/foo/cmake_root/include/zot FOO_TEST_PROG_FOO :.*/PackageRoot/foo/cmake_root/bin/foo.exe Foo_ROOT :.*/PackageRoot/foo/cmake_root @@ -313,7 +375,9 @@ FOO_TEST_PATH_FOO :.*/PackageRoot/foo/cmake_root/include FOO_TEST_PROG_FOO :.*/PackageRoot/foo/cmake_root/bin/foo.exe BAR_TEST_FILE_FOO :.*/PackageRoot/foo/cmake_root/include/foo.h BAR_TEST_FILE_BAR :.*/PackageRoot/bar/cmake_root/include/bar.h +BAR_TEST_FILE_ZOT :.*/PackageRoot/foo/cmake_root/include/zot/zot.h BAR_TEST_PATH_FOO :.*/PackageRoot/foo/cmake_root/include BAR_TEST_PATH_BAR :.*/PackageRoot/bar/cmake_root/include +BAR_TEST_PATH_ZOT :.*/PackageRoot/foo/cmake_root/include/zot BAR_TEST_PROG_FOO :.*/PackageRoot/foo/cmake_root/bin/foo.exe BAR_TEST_PROG_BAR :.*/PackageRoot/bar/cmake_root/bin/bar.exe diff --git a/Tests/RunCMake/find_package/PackageRoot.cmake b/Tests/RunCMake/find_package/PackageRoot.cmake index d9f41f8..421c243 100644 --- a/Tests/RunCMake/find_package/PackageRoot.cmake +++ b/Tests/RunCMake/find_package/PackageRoot.cmake @@ -37,7 +37,9 @@ macro(RunPackageRootTest) message("Foo_ROOT :${Foo_ROOT}") message("ENV{Foo_ROOT} :$ENV{Foo_ROOT}") message("FOO_TEST_FILE_FOO :${FOO_TEST_FILE_FOO}") + message("FOO_TEST_FILE_ZOT :${FOO_TEST_FILE_ZOT}") message("FOO_TEST_PATH_FOO :${FOO_TEST_PATH_FOO}") + message("FOO_TEST_PATH_ZOT :${FOO_TEST_PATH_ZOT}") message("FOO_TEST_PROG_FOO :${FOO_TEST_PROG_FOO}") CleanUpPackageRootTest() message("") @@ -57,8 +59,10 @@ macro(RunPackageRootTest) message("FOO_TEST_PROG_FOO :${FOO_TEST_PROG_FOO}") message("BAR_TEST_FILE_FOO :${BAR_TEST_FILE_FOO}") message("BAR_TEST_FILE_BAR :${BAR_TEST_FILE_BAR}") + message("BAR_TEST_FILE_ZOT :${BAR_TEST_FILE_ZOT}") message("BAR_TEST_PATH_FOO :${BAR_TEST_PATH_FOO}") message("BAR_TEST_PATH_BAR :${BAR_TEST_PATH_BAR}") + message("BAR_TEST_PATH_ZOT :${BAR_TEST_PATH_ZOT}") message("BAR_TEST_PROG_FOO :${BAR_TEST_PROG_FOO}") message("BAR_TEST_PROG_BAR :${BAR_TEST_PROG_BAR}") CleanUpPackageRootTest() diff --git a/Tests/RunCMake/find_package/PackageRoot/FindBar.cmake b/Tests/RunCMake/find_package/PackageRoot/FindBar.cmake index eefa49c..72774a7 100644 --- a/Tests/RunCMake/find_package/PackageRoot/FindBar.cmake +++ b/Tests/RunCMake/find_package/PackageRoot/FindBar.cmake @@ -1,6 +1,8 @@ find_file(BAR_TEST_FILE_FOO foo.h) find_file(BAR_TEST_FILE_BAR bar.h) +find_file(BAR_TEST_FILE_ZOT zot.h PATH_SUFFIXES zot) find_path(BAR_TEST_PATH_FOO foo.h) find_path(BAR_TEST_PATH_BAR bar.h) +find_path(BAR_TEST_PATH_ZOT zot.h PATH_SUFFIXES zot) find_program(BAR_TEST_PROG_FOO foo.exe) find_program(BAR_TEST_PROG_BAR bar.exe) diff --git a/Tests/RunCMake/find_package/PackageRoot/FindFoo.cmake b/Tests/RunCMake/find_package/PackageRoot/FindFoo.cmake index cb62390..e160a1d 100644 --- a/Tests/RunCMake/find_package/PackageRoot/FindFoo.cmake +++ b/Tests/RunCMake/find_package/PackageRoot/FindFoo.cmake @@ -1,5 +1,7 @@ find_file(FOO_TEST_FILE_FOO foo.h) +find_file(FOO_TEST_FILE_ZOT zot.h PATH_SUFFIXES zot) find_path(FOO_TEST_PATH_FOO foo.h) +find_path(FOO_TEST_PATH_ZOT zot.h PATH_SUFFIXES zot) find_program(FOO_TEST_PROG_FOO foo.exe) if ("Bar" IN_LIST Foo_FIND_COMPONENTS) diff --git a/Tests/RunCMake/find_package/PackageRoot/bar/cmake_root/include/zot/zot.h b/Tests/RunCMake/find_package/PackageRoot/bar/cmake_root/include/zot/zot.h new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/Tests/RunCMake/find_package/PackageRoot/bar/cmake_root/include/zot/zot.h diff --git a/Tests/RunCMake/find_package/PackageRoot/bar/env_root/include/zot/zot.h b/Tests/RunCMake/find_package/PackageRoot/bar/env_root/include/zot/zot.h new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/Tests/RunCMake/find_package/PackageRoot/bar/env_root/include/zot/zot.h diff --git a/Tests/RunCMake/find_package/PackageRoot/foo/cmake_root/include/zot/zot.h b/Tests/RunCMake/find_package/PackageRoot/foo/cmake_root/include/zot/zot.h new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/Tests/RunCMake/find_package/PackageRoot/foo/cmake_root/include/zot/zot.h diff --git a/Tests/RunCMake/find_package/PackageRoot/foo/env_root/include/zot/zot.h b/Tests/RunCMake/find_package/PackageRoot/foo/env_root/include/zot/zot.h new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/Tests/RunCMake/find_package/PackageRoot/foo/env_root/include/zot/zot.h diff --git a/Tests/RunCMake/test_include_dirs/CMakeLists.txt b/Tests/RunCMake/test_include_dirs/CMakeLists.txt new file mode 100644 index 0000000..dc92486 --- /dev/null +++ b/Tests/RunCMake/test_include_dirs/CMakeLists.txt @@ -0,0 +1,3 @@ +cmake_minimum_required(VERSION 3.6) +project(${RunCMake_TEST} NONE) +include(${RunCMake_TEST}.cmake) diff --git a/Tests/RunCMake/test_include_dirs/RunCMakeTest.cmake b/Tests/RunCMake/test_include_dirs/RunCMakeTest.cmake new file mode 100644 index 0000000..d1633e4 --- /dev/null +++ b/Tests/RunCMake/test_include_dirs/RunCMakeTest.cmake @@ -0,0 +1,17 @@ +include(RunCMake) + +function(run_TID) + # Use a single build tree for a few tests without cleaning. + set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/TID-build) + set(RunCMake_TEST_NO_CLEAN 1) + if(RunCMake_GENERATOR MATCHES "Make|Ninja") + set(RunCMake_TEST_OPTIONS -DCMAKE_BUILD_TYPE=Debug) + endif() + file(REMOVE_RECURSE "${RunCMake_TEST_BINARY_DIR}") + file(MAKE_DIRECTORY "${RunCMake_TEST_BINARY_DIR}") + run_cmake(TID) + run_cmake_command(TID-build ${CMAKE_COMMAND} --build . --config Debug) + run_cmake_command(TID-test ${CMAKE_CTEST_COMMAND} -C Debug) +endfunction() + +run_TID() diff --git a/Tests/RunCMake/test_include_dirs/TID-test-stdout.txt b/Tests/RunCMake/test_include_dirs/TID-test-stdout.txt new file mode 100644 index 0000000..19bf051 --- /dev/null +++ b/Tests/RunCMake/test_include_dirs/TID-test-stdout.txt @@ -0,0 +1,17 @@ +Test project .* + Start 1: house\.dog +1/6 Test #1: house\.dog \.+ +Passed +[0-9.]+ sec + Start 2: house\.cat +2/6 Test #2: house\.cat \.+ +Passed +[0-9.]+ sec + Start 3: farm\.cow +3/6 Test #3: farm\.cow \.+ +Passed +[0-9.]+ sec + Start 4: farm\.pig +4/6 Test #4: farm\.pig \.+ +Passed +[0-9.]+ sec + Start 5: zoo\.fox +5/6 Test #5: zoo\.fox \.+ +Passed +[0-9.]+ sec + Start 6: zoo\.emu +6/6 Test #6: zoo\.emu \.+ +Passed +[0-9.]+ sec + +100% tests passed, 0 tests failed out of 6 + +Total Test time \(real\) = +[0-9.]+ sec diff --git a/Tests/RunCMake/test_include_dirs/TID.cmake b/Tests/RunCMake/test_include_dirs/TID.cmake new file mode 100644 index 0000000..1e74f90 --- /dev/null +++ b/Tests/RunCMake/test_include_dirs/TID.cmake @@ -0,0 +1,29 @@ +project(test_include_dirs) +include(CTest) + +enable_testing() + +add_executable(dummy dummy.cpp) + +function(generate_tests NAME) + set(ctest_file "${CMAKE_CURRENT_BINARY_DIR}/${NAME}_tests.cmake") + add_custom_command( + OUTPUT "${ctest_file}" + COMMAND "${CMAKE_COMMAND}" + -D "TEST_EXECUTABLE=$<TARGET_FILE:dummy>" + -D "TEST_SUITE=${NAME}" + -D "TEST_NAMES=${ARGN}" + -D "CTEST_FILE=${ctest_file}" + -P "${CMAKE_CURRENT_SOURCE_DIR}/add-tests.cmake" + VERBATIM + ) + add_custom_target(${NAME}_tests ALL DEPENDS "${ctest_file}") +endfunction() + +generate_tests(house dog cat) +generate_tests(farm cow pig) +generate_tests(zoo fox emu) + +set_property(DIRECTORY PROPERTY TEST_INCLUDE_FILE "house_tests.cmake") +set_property(DIRECTORY APPEND PROPERTY TEST_INCLUDE_FILES "farm_tests.cmake") +set_property(DIRECTORY APPEND PROPERTY TEST_INCLUDE_FILES "zoo_tests.cmake") diff --git a/Tests/RunCMake/test_include_dirs/add-tests.cmake b/Tests/RunCMake/test_include_dirs/add-tests.cmake new file mode 100644 index 0000000..e74665a --- /dev/null +++ b/Tests/RunCMake/test_include_dirs/add-tests.cmake @@ -0,0 +1,8 @@ +set(script) + +foreach(TEST_NAME ${TEST_NAMES}) + set(script "${script}add_test(\"${TEST_SUITE}.${TEST_NAME}\"") + set(script "${script} \"${TEST_EXECUTABLE}\")\n") +endforeach() + +file(WRITE "${CTEST_FILE}" "${script}") diff --git a/Tests/RunCMake/test_include_dirs/dummy.cpp b/Tests/RunCMake/test_include_dirs/dummy.cpp new file mode 100644 index 0000000..f8b643a --- /dev/null +++ b/Tests/RunCMake/test_include_dirs/dummy.cpp @@ -0,0 +1,4 @@ +int main() +{ + return 0; +} |