diff options
Diffstat (limited to 'Tests/RunCMake/ExternalProject')
44 files changed, 513 insertions, 45 deletions
diff --git a/Tests/RunCMake/ExternalProject/Add_StepDependencies.cmake b/Tests/RunCMake/ExternalProject/Add_StepDependencies.cmake index 38683f12e..bfed4fa7c 100644 --- a/Tests/RunCMake/ExternalProject/Add_StepDependencies.cmake +++ b/Tests/RunCMake/ExternalProject/Add_StepDependencies.cmake @@ -1,4 +1,9 @@ cmake_minimum_required(VERSION ${CMAKE_VERSION}) +if(CMAKE_XCODE_BUILD_SYSTEM VERSION_GREATER_EQUAL 12) + cmake_policy(SET CMP0114 NEW) +else() + cmake_policy(SET CMP0114 OLD) # Test deprecated behavior. +endif() include(ExternalProject) diff --git a/Tests/RunCMake/ExternalProject/Add_StepDependencies_no_target.cmake b/Tests/RunCMake/ExternalProject/Add_StepDependencies_no_target.cmake index 264c3f04c..039dec6a1 100644 --- a/Tests/RunCMake/ExternalProject/Add_StepDependencies_no_target.cmake +++ b/Tests/RunCMake/ExternalProject/Add_StepDependencies_no_target.cmake @@ -1,4 +1,9 @@ cmake_minimum_required(VERSION ${CMAKE_VERSION}) +if(CMAKE_XCODE_BUILD_SYSTEM VERSION_GREATER_EQUAL 12) + cmake_policy(SET CMP0114 NEW) +else() + cmake_policy(SET CMP0114 OLD) # Test deprecated behavior. +endif() include(ExternalProject) diff --git a/Tests/RunCMake/ExternalProject/BadIndependentStep1-result.txt b/Tests/RunCMake/ExternalProject/BadIndependentStep1-result.txt new file mode 100644 index 000000000..d00491fd7 --- /dev/null +++ b/Tests/RunCMake/ExternalProject/BadIndependentStep1-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/ExternalProject/BadIndependentStep1-stderr.txt b/Tests/RunCMake/ExternalProject/BadIndependentStep1-stderr.txt new file mode 100644 index 000000000..3188910a0 --- /dev/null +++ b/Tests/RunCMake/ExternalProject/BadIndependentStep1-stderr.txt @@ -0,0 +1,7 @@ +^CMake Error at [^ +]*/Modules/ExternalProject.cmake:[0-9]+ \(message\): + ExternalProject 'proj' step 'custom' is marked INDEPENDENT but depends on + step 'configure' that is not marked INDEPENDENT. +Call Stack \(most recent call first\): + BadIndependentStep1.cmake:[0-9]+ \(ExternalProject_Add_Step\) + CMakeLists.txt:[0-9]+ \(include\)$ diff --git a/Tests/RunCMake/ExternalProject/BadIndependentStep1.cmake b/Tests/RunCMake/ExternalProject/BadIndependentStep1.cmake new file mode 100644 index 000000000..c81eb07c3 --- /dev/null +++ b/Tests/RunCMake/ExternalProject/BadIndependentStep1.cmake @@ -0,0 +1,14 @@ +include(ExternalProject) +cmake_policy(SET CMP0114 NEW) + +ExternalProject_Add(proj + SOURCE_DIR "." + DOWNLOAD_COMMAND "" + CONFIGURE_COMMAND "" + BUILD_COMMAND "" + INSTALL_COMMAND "" + ) +ExternalProject_Add_Step(proj custom + DEPENDEES configure + INDEPENDENT 1 + ) diff --git a/Tests/RunCMake/ExternalProject/BadIndependentStep2-result.txt b/Tests/RunCMake/ExternalProject/BadIndependentStep2-result.txt new file mode 100644 index 000000000..d00491fd7 --- /dev/null +++ b/Tests/RunCMake/ExternalProject/BadIndependentStep2-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/ExternalProject/BadIndependentStep2-stderr.txt b/Tests/RunCMake/ExternalProject/BadIndependentStep2-stderr.txt new file mode 100644 index 000000000..0b87e5e5f --- /dev/null +++ b/Tests/RunCMake/ExternalProject/BadIndependentStep2-stderr.txt @@ -0,0 +1,7 @@ +^CMake Error at [^ +]*/Modules/ExternalProject.cmake:[0-9]+ \(message\): + ExternalProject 'proj' step 'update' is marked INDEPENDENT but depends on + step 'custom' that is not marked INDEPENDENT. +Call Stack \(most recent call first\): + BadIndependentStep2.cmake:[0-9]+ \(ExternalProject_Add_Step\) + CMakeLists.txt:[0-9]+ \(include\)$ diff --git a/Tests/RunCMake/ExternalProject/BadIndependentStep2.cmake b/Tests/RunCMake/ExternalProject/BadIndependentStep2.cmake new file mode 100644 index 000000000..4a530eace --- /dev/null +++ b/Tests/RunCMake/ExternalProject/BadIndependentStep2.cmake @@ -0,0 +1,13 @@ +include(ExternalProject) +cmake_policy(SET CMP0114 NEW) + +ExternalProject_Add(proj + SOURCE_DIR "." + DOWNLOAD_COMMAND "" + CONFIGURE_COMMAND "" + BUILD_COMMAND "" + INSTALL_COMMAND "" + ) +ExternalProject_Add_Step(proj custom + DEPENDERS update + ) diff --git a/Tests/RunCMake/ExternalProject/CMakeLists.txt b/Tests/RunCMake/ExternalProject/CMakeLists.txt index c585733b6..933a57a4d 100644 --- a/Tests/RunCMake/ExternalProject/CMakeLists.txt +++ b/Tests/RunCMake/ExternalProject/CMakeLists.txt @@ -1,3 +1,6 @@ -cmake_minimum_required(VERSION ${CMAKE_VERSION}) +cmake_minimum_required(VERSION 3.18) project(${RunCMake_TEST} NONE) +if(CMAKE_XCODE_BUILD_SYSTEM VERSION_GREATER_EQUAL 12 AND NOT RunCMake_TEST STREQUAL "Xcode-CMP0114") + cmake_policy(SET CMP0114 NEW) +endif() include(${RunCMake_TEST}.cmake) diff --git a/Tests/RunCMake/ExternalProject/DownloadInactivityResume.cmake b/Tests/RunCMake/ExternalProject/DownloadInactivityResume.cmake new file mode 100644 index 000000000..d34482dd7 --- /dev/null +++ b/Tests/RunCMake/ExternalProject/DownloadInactivityResume.cmake @@ -0,0 +1,5 @@ +include(ExternalProject) +ExternalProject_Add(MyProj URL ${SERVER_URL} INACTIVITY_TIMEOUT 2 DOWNLOAD_NO_EXTRACT TRUE + CONFIGURE_COMMAND "" + BUILD_COMMAND "" + INSTALL_COMMAND "") diff --git a/Tests/RunCMake/ExternalProject/DownloadInactivityTimeout-build-result.txt b/Tests/RunCMake/ExternalProject/DownloadInactivityTimeout-build-result.txt new file mode 100644 index 000000000..d197c913c --- /dev/null +++ b/Tests/RunCMake/ExternalProject/DownloadInactivityTimeout-build-result.txt @@ -0,0 +1 @@ +[^0] diff --git a/Tests/RunCMake/ExternalProject/DownloadInactivityTimeout-build-stdout.txt b/Tests/RunCMake/ExternalProject/DownloadInactivityTimeout-build-stdout.txt new file mode 100644 index 000000000..323814792 --- /dev/null +++ b/Tests/RunCMake/ExternalProject/DownloadInactivityTimeout-build-stdout.txt @@ -0,0 +1 @@ +(Timeout was reached)? diff --git a/Tests/RunCMake/ExternalProject/DownloadInactivityTimeout.cmake b/Tests/RunCMake/ExternalProject/DownloadInactivityTimeout.cmake new file mode 100644 index 000000000..d34482dd7 --- /dev/null +++ b/Tests/RunCMake/ExternalProject/DownloadInactivityTimeout.cmake @@ -0,0 +1,5 @@ +include(ExternalProject) +ExternalProject_Add(MyProj URL ${SERVER_URL} INACTIVITY_TIMEOUT 2 DOWNLOAD_NO_EXTRACT TRUE + CONFIGURE_COMMAND "" + BUILD_COMMAND "" + INSTALL_COMMAND "") diff --git a/Tests/RunCMake/ExternalProject/DownloadServer.py b/Tests/RunCMake/ExternalProject/DownloadServer.py new file mode 100644 index 000000000..63b7fa725 --- /dev/null +++ b/Tests/RunCMake/ExternalProject/DownloadServer.py @@ -0,0 +1,53 @@ +from http.server import HTTPServer, BaseHTTPRequestHandler +import argparse +import time +import subprocess +import sys +import os +import threading +args = None +outerthread = None + +barrier = threading.Barrier(2) + +class SimpleHTTPRequestHandler(BaseHTTPRequestHandler): + def do_GET(self): + barrier.wait() + self.send_response(200) + self.end_headers() + data = b'D' + + if args.speed_limit: + slow_deadline = time.time()+args.limit_duration + + while time.time() < slow_deadline: + self.wfile.write(data) + if args.speed_limit: + time.sleep(1.1) + + data = data * 100 + self.wfile.write(data) + self.close_connection = True + +def runServer(fileName): + httpd = HTTPServer(('localhost', 0), SimpleHTTPRequestHandler) + with open(fileName,"w") as f: + f.write('http://localhost:{}/test'.format(httpd.socket.getsockname()[1])) + httpd.handle_request() + os.remove(fileName) + +if __name__ == "__main__": + parser = argparse.ArgumentParser() + parser.add_argument('--speed_limit', help='transfer rate limitation', action='store_true',default=False) + parser.add_argument('--limit_duration', help='duration of the transfer rate limitation',default=1, type=float) + parser.add_argument('--file', help='file to write the url to connect to') + parser.add_argument('--subprocess', action='store_true') + args = parser.parse_args() + if not args.subprocess: + subprocess.Popen([sys.executable]+sys.argv+['--subprocess'],stdin=subprocess.DEVNULL, stderr=subprocess.DEVNULL,stdout=subprocess.DEVNULL) + else: + serverThread = threading.Thread(target=runServer,args=(args.file,)) + serverThread.daemon = True + serverThread.start() + barrier.wait(60) + serverThread.join(20) diff --git a/Tests/RunCMake/ExternalProject/DownloadTimeout-build-result.txt b/Tests/RunCMake/ExternalProject/DownloadTimeout-build-result.txt new file mode 100644 index 000000000..c20fd86c7 --- /dev/null +++ b/Tests/RunCMake/ExternalProject/DownloadTimeout-build-result.txt @@ -0,0 +1 @@ +^[^0] diff --git a/Tests/RunCMake/ExternalProject/DownloadTimeout-build-stderr.txt b/Tests/RunCMake/ExternalProject/DownloadTimeout-build-stderr.txt new file mode 100644 index 000000000..8d98f9deb --- /dev/null +++ b/Tests/RunCMake/ExternalProject/DownloadTimeout-build-stderr.txt @@ -0,0 +1 @@ +.* diff --git a/Tests/RunCMake/ExternalProject/DownloadTimeout.cmake b/Tests/RunCMake/ExternalProject/DownloadTimeout.cmake new file mode 100644 index 000000000..c90b4bada --- /dev/null +++ b/Tests/RunCMake/ExternalProject/DownloadTimeout.cmake @@ -0,0 +1,5 @@ +include(ExternalProject) +set(source_dir "${CMAKE_CURRENT_BINARY_DIR}/DownloadTimeout") +file(REMOVE_RECURSE "${source_dir}") +file(MAKE_DIRECTORY "${source_dir}") +ExternalProject_Add(MyProj URL "http://cmake.org/invalid_file.tar.gz") diff --git a/Tests/RunCMake/ExternalProject/MultiCommand.cmake b/Tests/RunCMake/ExternalProject/MultiCommand.cmake index a8dbfea5d..dbf67eb71 100644 --- a/Tests/RunCMake/ExternalProject/MultiCommand.cmake +++ b/Tests/RunCMake/ExternalProject/MultiCommand.cmake @@ -1,5 +1,3 @@ -cmake_minimum_required(VERSION 3.9) - include(ExternalProject) # Verify COMMAND keyword is recognised after various *_COMMAND options @@ -20,10 +18,6 @@ ExternalProject_Add(multiCommand COMMAND "${CMAKE_COMMAND}" -E echo "install 2" ) -# Workaround for issue 17229 (missing dependency between update and patch steps) -ExternalProject_Add_StepTargets(multiCommand NO_DEPENDS update) -ExternalProject_Add_StepDependencies(multiCommand patch multiCommand-update) - # Force all steps to be re-run by removing timestamps from any previous run ExternalProject_Get_Property(multiCommand STAMP_DIR) file(REMOVE_RECURSE "${STAMP_DIR}") diff --git a/Tests/RunCMake/ExternalProject/NO_DEPENDS.cmake b/Tests/RunCMake/ExternalProject/NO_DEPENDS-CMP0114-Common.cmake index 57626d679..176e28beb 100644 --- a/Tests/RunCMake/ExternalProject/NO_DEPENDS.cmake +++ b/Tests/RunCMake/ExternalProject/NO_DEPENDS-CMP0114-Common.cmake @@ -1,4 +1,3 @@ -cmake_minimum_required(VERSION 2.8.12) include(ExternalProject RESULT_VARIABLE GOO) diff --git a/Tests/RunCMake/ExternalProject/NO_DEPENDS-CMP0114-NEW-Direct-result.txt b/Tests/RunCMake/ExternalProject/NO_DEPENDS-CMP0114-NEW-Direct-result.txt new file mode 100644 index 000000000..d00491fd7 --- /dev/null +++ b/Tests/RunCMake/ExternalProject/NO_DEPENDS-CMP0114-NEW-Direct-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/ExternalProject/NO_DEPENDS-CMP0114-NEW-Direct-stderr.txt b/Tests/RunCMake/ExternalProject/NO_DEPENDS-CMP0114-NEW-Direct-stderr.txt new file mode 100644 index 000000000..c6bf767fa --- /dev/null +++ b/Tests/RunCMake/ExternalProject/NO_DEPENDS-CMP0114-NEW-Direct-stderr.txt @@ -0,0 +1,7 @@ +^CMake Error at [^ +]*/Modules/ExternalProject.cmake:[0-9]+ \(message\): + The 'NO_DEPENDS' option is no longer allowed. It has been superseded by + the per-step 'INDEPENDENT' option. See policy CMP0114. +Call Stack \(most recent call first\): + NO_DEPENDS-CMP0114-NEW-Direct.cmake:[0-9]+ \(ExternalProject_Add_StepTargets\) + CMakeLists.txt:[0-9]+ \(include\)$ diff --git a/Tests/RunCMake/ExternalProject/NO_DEPENDS-CMP0114-NEW-Direct.cmake b/Tests/RunCMake/ExternalProject/NO_DEPENDS-CMP0114-NEW-Direct.cmake new file mode 100644 index 000000000..7ec1a0050 --- /dev/null +++ b/Tests/RunCMake/ExternalProject/NO_DEPENDS-CMP0114-NEW-Direct.cmake @@ -0,0 +1,4 @@ +cmake_policy(SET CMP0114 NEW) +include(ExternalProject) +ExternalProject_Add(BAR SOURCE_DIR . TEST_COMMAND echo test) +ExternalProject_Add_StepTargets(BAR NO_DEPENDS test) diff --git a/Tests/RunCMake/ExternalProject/NO_DEPENDS-CMP0114-NEW-result.txt b/Tests/RunCMake/ExternalProject/NO_DEPENDS-CMP0114-NEW-result.txt new file mode 100644 index 000000000..d00491fd7 --- /dev/null +++ b/Tests/RunCMake/ExternalProject/NO_DEPENDS-CMP0114-NEW-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/ExternalProject/NO_DEPENDS-CMP0114-NEW-stderr.txt b/Tests/RunCMake/ExternalProject/NO_DEPENDS-CMP0114-NEW-stderr.txt new file mode 100644 index 000000000..5a5ba891d --- /dev/null +++ b/Tests/RunCMake/ExternalProject/NO_DEPENDS-CMP0114-NEW-stderr.txt @@ -0,0 +1,16 @@ +^CMake Error at [^ +]*/Modules/ExternalProject.cmake:[0-9]+ \(message\): + ExternalProject 'FOO' option 'INDEPENDENT_STEP_TARGETS' is set to + + download;patch;update;configure;build + + but the option is no longer allowed. It has been superseded by the + per-step 'INDEPENDENT' option. See policy CMP0114. +Call Stack \(most recent call first\): + [^ +]*/Modules/ExternalProject.cmake:[0-9]+ \(ExternalProject_Add_Step\) + [^ +]*/Modules/ExternalProject.cmake:[0-9]+ \(_ep_add_mkdir_command\) + NO_DEPENDS-CMP0114-Common.cmake:[0-9]+ \(ExternalProject_Add\) + NO_DEPENDS-CMP0114-NEW.cmake:[0-9]+ \(include\) + CMakeLists.txt:[0-9]+ \(include\)$ diff --git a/Tests/RunCMake/ExternalProject/NO_DEPENDS-CMP0114-NEW.cmake b/Tests/RunCMake/ExternalProject/NO_DEPENDS-CMP0114-NEW.cmake new file mode 100644 index 000000000..9622a600c --- /dev/null +++ b/Tests/RunCMake/ExternalProject/NO_DEPENDS-CMP0114-NEW.cmake @@ -0,0 +1,2 @@ +cmake_policy(SET CMP0114 NEW) +include(NO_DEPENDS-CMP0114-Common.cmake) diff --git a/Tests/RunCMake/ExternalProject/NO_DEPENDS-CMP0114-OLD-stderr.txt b/Tests/RunCMake/ExternalProject/NO_DEPENDS-CMP0114-OLD-stderr.txt new file mode 100644 index 000000000..2b0feb6e4 --- /dev/null +++ b/Tests/RunCMake/ExternalProject/NO_DEPENDS-CMP0114-OLD-stderr.txt @@ -0,0 +1,61 @@ +^CMake Warning \(dev\) at [^ +]*/Modules/ExternalProject.cmake:[0-9]+ \(message\): + Using NO_DEPENDS for "configure" step might break parallel builds +Call Stack \(most recent call first\): + [^ +]*/Modules/ExternalProject.cmake:[0-9]+ \(_ep_step_add_target\) + [^ +]*/Modules/ExternalProject.cmake:[0-9]+:EVAL:2 \(ExternalProject_Add_Step\) + [^ +]*/Modules/ExternalProject.cmake:[0-9]+ \(cmake_language\) + [^ +]*/Modules/ExternalProject.cmake:[0-9]+ \(_ep_add_configure_command\) + NO_DEPENDS-CMP0114-Common.cmake:[0-9]+ \(ExternalProject_Add\) + NO_DEPENDS-CMP0114-OLD.cmake:[0-9]+ \(include\) + CMakeLists.txt:[0-9]+ \(include\) +This warning is for project developers. Use -Wno-dev to suppress it. ++ +CMake Warning \(dev\) at [^ +]*/Modules/ExternalProject.cmake:[0-9]+ \(message\): + Using NO_DEPENDS for "build" step might break parallel builds +Call Stack \(most recent call first\): + [^ +]*/Modules/ExternalProject.cmake:[0-9]+ \(_ep_step_add_target\) + [^ +]*/Modules/ExternalProject.cmake:[0-9]+:EVAL:2 \(ExternalProject_Add_Step\) + [^ +]*/Modules/ExternalProject.cmake:[0-9]+ \(cmake_language\) + [^ +]*/Modules/ExternalProject.cmake:[0-9]+ \(_ep_add_build_command\) + NO_DEPENDS-CMP0114-Common.cmake:[0-9]+ \(ExternalProject_Add\) + NO_DEPENDS-CMP0114-OLD.cmake:[0-9]+ \(include\) + CMakeLists.txt:[0-9]+ \(include\) +This warning is for project developers. Use -Wno-dev to suppress it. ++ +CMake Warning \(dev\) at [^ +]*/Modules/ExternalProject.cmake:[0-9]+ \(message\): + Using NO_DEPENDS for "install" step might break parallel builds +Call Stack \(most recent call first\): + [^ +]*/Modules/ExternalProject.cmake:[0-9]+ \(_ep_step_add_target\) + [^ +]*/Modules/ExternalProject.cmake:[0-9]+:EVAL:2 \(ExternalProject_Add_Step\) + [^ +]*/Modules/ExternalProject.cmake:[0-9]+ \(cmake_language\) + [^ +]*/Modules/ExternalProject.cmake:[0-9]+ \(_ep_add_install_command\) + NO_DEPENDS-CMP0114-Common.cmake:[0-9]+ \(ExternalProject_Add\) + NO_DEPENDS-CMP0114-OLD.cmake:[0-9]+ \(include\) + CMakeLists.txt:[0-9]+ \(include\) +This warning is for project developers. Use -Wno-dev to suppress it. ++ +CMake Warning \(dev\) at [^ +]*/Modules/ExternalProject.cmake:[0-9]+ \(message\): + Using NO_DEPENDS for "test" step might break parallel builds +Call Stack \(most recent call first\): + [^ +]*/Modules/ExternalProject.cmake:[0-9]+ \(_ep_step_add_target\) + NO_DEPENDS-CMP0114-Common.cmake:[0-9]+ \(ExternalProject_Add_StepTargets\) + NO_DEPENDS-CMP0114-OLD.cmake:[0-9]+ \(include\) + CMakeLists.txt:[0-9]+ \(include\) +This warning is for project developers. Use -Wno-dev to suppress it.$ diff --git a/Tests/RunCMake/ExternalProject/NO_DEPENDS-CMP0114-OLD.cmake b/Tests/RunCMake/ExternalProject/NO_DEPENDS-CMP0114-OLD.cmake new file mode 100644 index 000000000..c20d443c5 --- /dev/null +++ b/Tests/RunCMake/ExternalProject/NO_DEPENDS-CMP0114-OLD.cmake @@ -0,0 +1,2 @@ +cmake_policy(SET CMP0114 OLD) +include(NO_DEPENDS-CMP0114-Common.cmake) diff --git a/Tests/RunCMake/ExternalProject/NO_DEPENDS-CMP0114-WARN-stderr.txt b/Tests/RunCMake/ExternalProject/NO_DEPENDS-CMP0114-WARN-stderr.txt new file mode 100644 index 000000000..bbf7178f2 --- /dev/null +++ b/Tests/RunCMake/ExternalProject/NO_DEPENDS-CMP0114-WARN-stderr.txt @@ -0,0 +1,119 @@ +^CMake Warning \(dev\) at [^ +]*/Modules/ExternalProject.cmake:[0-9]+ \(message\): + Policy CMP0114 is not set: ExternalProject step targets fully adopt their + steps. Run "cmake --help-policy CMP0114" for policy details. Use the + cmake_policy command to set the policy and suppress this warning. + + ExternalProject 'FOO' option INDEPENDENT_STEP_TARGETS is set to + + download;patch;update;configure;build + + but the option is deprecated in favor of policy CMP0114. +Call Stack \(most recent call first\): + [^ +]*/Modules/ExternalProject.cmake:[0-9]+ \(ExternalProject_Add_Step\) + [^ +]*/Modules/ExternalProject.cmake:[0-9]+ \(_ep_add_mkdir_command\) + NO_DEPENDS-CMP0114-Common.cmake:[0-9]+ \(ExternalProject_Add\) + NO_DEPENDS-CMP0114-WARN.cmake:[0-9]+ \(include\) + CMakeLists.txt:[0-9]+ \(include\) +This warning is for project developers. Use -Wno-dev to suppress it. ++ +CMake Warning \(dev\) at [^ +]*/Modules/ExternalProject.cmake:[0-9]+ \(message\): + Using NO_DEPENDS for "configure" step might break parallel builds +Call Stack \(most recent call first\): + [^ +]*/Modules/ExternalProject.cmake:[0-9]+ \(_ep_step_add_target\) + [^ +]*/Modules/ExternalProject.cmake:[0-9]+:EVAL:2 \(ExternalProject_Add_Step\) + [^ +]*/Modules/ExternalProject.cmake:[0-9]+ \(cmake_language\) + [^ +]*/Modules/ExternalProject.cmake:[0-9]+ \(_ep_add_configure_command\) + NO_DEPENDS-CMP0114-Common.cmake:[0-9]+ \(ExternalProject_Add\) + NO_DEPENDS-CMP0114-WARN.cmake:[0-9]+ \(include\) + CMakeLists.txt:[0-9]+ \(include\) +This warning is for project developers. Use -Wno-dev to suppress it. ++ +CMake Warning \(dev\) at [^ +]*/Modules/ExternalProject.cmake:[0-9]+ \(message\): + Using NO_DEPENDS for "build" step might break parallel builds +Call Stack \(most recent call first\): + [^ +]*/Modules/ExternalProject.cmake:[0-9]+ \(_ep_step_add_target\) + [^ +]*/Modules/ExternalProject.cmake:[0-9]+:EVAL:2 \(ExternalProject_Add_Step\) + [^ +]*/Modules/ExternalProject.cmake:[0-9]+ \(cmake_language\) + [^ +]*/Modules/ExternalProject.cmake:[0-9]+ \(_ep_add_build_command\) + NO_DEPENDS-CMP0114-Common.cmake:[0-9]+ \(ExternalProject_Add\) + NO_DEPENDS-CMP0114-WARN.cmake:[0-9]+ \(include\) + CMakeLists.txt:[0-9]+ \(include\) +This warning is for project developers. Use -Wno-dev to suppress it. ++ +CMake Warning \(dev\) at [^ +]*/Modules/ExternalProject.cmake:[0-9]+ \(message\): + Policy CMP0114 is not set: ExternalProject step targets fully adopt their + steps. Run "cmake --help-policy CMP0114" for policy details. Use the + cmake_policy command to set the policy and suppress this warning. + + ExternalProject 'BAR' option INDEPENDENT_STEP_TARGETS is set to + + install + + but the option is deprecated in favor of policy CMP0114. +Call Stack \(most recent call first\): + [^ +]*/Modules/ExternalProject.cmake:[0-9]+ \(ExternalProject_Add_Step\) + [^ +]*/Modules/ExternalProject.cmake:[0-9]+ \(_ep_add_mkdir_command\) + NO_DEPENDS-CMP0114-Common.cmake:[0-9]+ \(ExternalProject_Add\) + NO_DEPENDS-CMP0114-WARN.cmake:[0-9]+ \(include\) + CMakeLists.txt:[0-9]+ \(include\) +This warning is for project developers. Use -Wno-dev to suppress it. ++ +CMake Warning \(dev\) at [^ +]*/Modules/ExternalProject.cmake:[0-9]+ \(message\): + Using NO_DEPENDS for "install" step might break parallel builds +Call Stack \(most recent call first\): + [^ +]*/Modules/ExternalProject.cmake:[0-9]+ \(_ep_step_add_target\) + [^ +]*/Modules/ExternalProject.cmake:[0-9]+:EVAL:2 \(ExternalProject_Add_Step\) + [^ +]*/Modules/ExternalProject.cmake:[0-9]+ \(cmake_language\) + [^ +]*/Modules/ExternalProject.cmake:[0-9]+ \(_ep_add_install_command\) + NO_DEPENDS-CMP0114-Common.cmake:[0-9]+ \(ExternalProject_Add\) + NO_DEPENDS-CMP0114-WARN.cmake:[0-9]+ \(include\) + CMakeLists.txt:[0-9]+ \(include\) +This warning is for project developers. Use -Wno-dev to suppress it. ++ +CMake Warning \(dev\) at [^ +]*/Modules/ExternalProject.cmake:[0-9]+ \(message\): + Policy CMP0114 is not set: ExternalProject step targets fully adopt their + steps. Run "cmake --help-policy CMP0114" for policy details. Use the + cmake_policy command to set the policy and suppress this warning. + + ExternalProject target 'BAR' would depend on the targets for step\(s\) + 'test;bar' under policy CMP0114, but this is being left out for + compatibility since the policy is not set. Also, the NO_DEPENDS option is + deprecated in favor of policy CMP0114. +Call Stack \(most recent call first\): + NO_DEPENDS-CMP0114-Common.cmake:[0-9]+ \(ExternalProject_Add_StepTargets\) + NO_DEPENDS-CMP0114-WARN.cmake:[0-9]+ \(include\) + CMakeLists.txt:[0-9]+ \(include\) +This warning is for project developers. Use -Wno-dev to suppress it. ++ +CMake Warning \(dev\) at [^ +]*/Modules/ExternalProject.cmake:[0-9]+ \(message\): + Using NO_DEPENDS for "test" step might break parallel builds +Call Stack \(most recent call first\): + [^ +]*/Modules/ExternalProject.cmake:[0-9]+ \(_ep_step_add_target\) + NO_DEPENDS-CMP0114-Common.cmake:[0-9]+ \(ExternalProject_Add_StepTargets\) + NO_DEPENDS-CMP0114-WARN.cmake:[0-9]+ \(include\) + CMakeLists.txt:[0-9]+ \(include\) +This warning is for project developers. Use -Wno-dev to suppress it.$ diff --git a/Tests/RunCMake/ExternalProject/NO_DEPENDS-CMP0114-WARN.cmake b/Tests/RunCMake/ExternalProject/NO_DEPENDS-CMP0114-WARN.cmake new file mode 100644 index 000000000..3d9642df0 --- /dev/null +++ b/Tests/RunCMake/ExternalProject/NO_DEPENDS-CMP0114-WARN.cmake @@ -0,0 +1,2 @@ +# Policy CMP0114 not set. +include(NO_DEPENDS-CMP0114-Common.cmake) diff --git a/Tests/RunCMake/ExternalProject/NO_DEPENDS-stderr.txt b/Tests/RunCMake/ExternalProject/NO_DEPENDS-stderr.txt deleted file mode 100644 index 928d88a9c..000000000 --- a/Tests/RunCMake/ExternalProject/NO_DEPENDS-stderr.txt +++ /dev/null @@ -1,36 +0,0 @@ -CMake Warning \(dev\) at .*/Modules/ExternalProject.cmake:[0-9]+. \(message\): - Using NO_DEPENDS for "configure" step might break parallel builds -Call Stack \(most recent call first\): - .*/Modules/ExternalProject.cmake:[0-9]+ \(ExternalProject_Add_StepTargets\) - .*/Modules/ExternalProject.cmake:[0-9]+:EVAL:2 \(ExternalProject_Add_Step\) - .*/Modules/ExternalProject.cmake:[0-9]+ \(_ep_add_configure_command\) - NO_DEPENDS.cmake:[0-9]+ \(ExternalProject_Add\) - CMakeLists.txt:[0-9]+ \(include\) -This warning is for project developers. Use -Wno-dev to suppress it. - -CMake Warning \(dev\) at .*/Modules/ExternalProject.cmake:[0-9]+. \(message\): - Using NO_DEPENDS for "build" step might break parallel builds -Call Stack \(most recent call first\): - .*/Modules/ExternalProject.cmake:[0-9]+ \(ExternalProject_Add_StepTargets\) - .*/Modules/ExternalProject.cmake:[0-9]+:EVAL:2 \(ExternalProject_Add_Step\) - .*/Modules/ExternalProject.cmake:[0-9]+ \(_ep_add_build_command\) - NO_DEPENDS.cmake:[0-9]+ \(ExternalProject_Add\) - CMakeLists.txt:[0-9]+ \(include\) -This warning is for project developers. Use -Wno-dev to suppress it. - -CMake Warning \(dev\) at .*/Modules/ExternalProject.cmake:[0-9]+. \(message\): - Using NO_DEPENDS for "install" step might break parallel builds -Call Stack \(most recent call first\): - .*/Modules/ExternalProject.cmake:[0-9]+ \(ExternalProject_Add_StepTargets\) - .*/Modules/ExternalProject.cmake:[0-9]+:EVAL:2 \(ExternalProject_Add_Step\) - .*/Modules/ExternalProject.cmake:[0-9]+ \(_ep_add_install_command\) - NO_DEPENDS.cmake:[0-9]+ \(ExternalProject_Add\) - CMakeLists.txt:[0-9]+ \(include\) -This warning is for project developers. Use -Wno-dev to suppress it. - -CMake Warning \(dev\) at .*/Modules/ExternalProject.cmake:[0-9]+. \(message\): - Using NO_DEPENDS for "test" step might break parallel builds -Call Stack \(most recent call first\): - NO_DEPENDS.cmake:[0-9]+ \(ExternalProject_Add_StepTargets\) - CMakeLists.txt:[0-9]+ \(include\) -This warning is for project developers. Use -Wno-dev to suppress it. diff --git a/Tests/RunCMake/ExternalProject/RunCMakeTest.cmake b/Tests/RunCMake/ExternalProject/RunCMakeTest.cmake index 0d1da26b5..598671f82 100644 --- a/Tests/RunCMake/ExternalProject/RunCMakeTest.cmake +++ b/Tests/RunCMake/ExternalProject/RunCMakeTest.cmake @@ -1,5 +1,13 @@ +cmake_minimum_required(VERSION 3.12) include(RunCMake) +# We do not contact any remote URLs, but may use a local one. +# Remove any proxy configuration that may change behavior. +unset(ENV{http_proxy}) +unset(ENV{https_proxy}) + +run_cmake(BadIndependentStep1) +run_cmake(BadIndependentStep2) run_cmake(IncludeScope-Add) run_cmake(IncludeScope-Add_Step) run_cmake(NoOptions) @@ -8,12 +16,52 @@ run_cmake(SourceMissing) run_cmake(CMAKE_CACHE_ARGS) run_cmake(CMAKE_CACHE_DEFAULT_ARGS) run_cmake(CMAKE_CACHE_mix) -run_cmake(NO_DEPENDS) +if(NOT XCODE_VERSION OR XCODE_VERSION VERSION_LESS 12) + run_cmake(NO_DEPENDS-CMP0114-WARN) + run_cmake(NO_DEPENDS-CMP0114-OLD) +endif() +run_cmake(NO_DEPENDS-CMP0114-NEW) +run_cmake(NO_DEPENDS-CMP0114-NEW-Direct) run_cmake(Add_StepDependencies) run_cmake(Add_StepDependencies_iface) run_cmake(Add_StepDependencies_iface_step) run_cmake(Add_StepDependencies_no_target) run_cmake(UsesTerminal) +if(XCODE_VERSION AND XCODE_VERSION VERSION_GREATER_EQUAL 12) + run_cmake(Xcode-CMP0114) +endif() + +macro(check_steps_missing proj) + set(steps "${ARGN}") + foreach(step ${steps}) + if(EXISTS ${RunCMake_TEST_BINARY_DIR}/${proj}-${step}-mark) + string(APPEND RunCMake_TEST_FAILED "${proj} '${step}' step ran but should not have\n") + endif() + endforeach() +endmacro() + +macro(check_steps_present proj) + set(steps "${ARGN}") + foreach(step ${steps}) + if(NOT EXISTS ${RunCMake_TEST_BINARY_DIR}/${proj}-${step}-mark) + string(APPEND RunCMake_TEST_FAILED "${proj} '${step}' step did not run but should have\n") + endif() + endforeach() +endmacro() + +function(run_steps_CMP0114 val) + set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/Steps-CMP0114-${val}-build) + run_cmake(Steps-CMP0114-${val}) + set(RunCMake_TEST_NO_CLEAN 1) + run_cmake_command(Steps-CMP0114-${val}-build-download ${CMAKE_COMMAND} --build . --target proj1-download) + run_cmake_command(Steps-CMP0114-${val}-build-update ${CMAKE_COMMAND} --build . --target proj1-update) + run_cmake_command(Steps-CMP0114-${val}-build-install ${CMAKE_COMMAND} --build . --target proj1-install) + run_cmake_command(Steps-CMP0114-${val}-build-test ${CMAKE_COMMAND} --build . --target proj1-test) +endfunction() +if(NOT XCODE_VERSION OR XCODE_VERSION VERSION_LESS 12) + run_steps_CMP0114(OLD) +endif() +run_steps_CMP0114(NEW) # Run both cmake and build steps. We always do a clean before the # build to ensure that the download step re-runs each time. @@ -27,6 +75,50 @@ function(__ep_test_with_build testName) run_cmake_command(${testName}-build ${CMAKE_COMMAND} --build .) endfunction() +find_package(Python3) +function(__ep_test_with_build_with_server testName) + if(NOT Python3_EXECUTABLE) + return() + endif() + set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/${testName}-build) + set(RunCMake_TEST_NO_CLEAN 1) + set(RunCMake_TEST_TIMEOUT 20) + set(RunCMake_TEST_OUTPUT_MERGE TRUE) + file(REMOVE_RECURSE "${RunCMake_TEST_BINARY_DIR}") + file(MAKE_DIRECTORY "${RunCMake_TEST_BINARY_DIR}") + set(URL_FILE ${RunCMake_BINARY_DIR}/${testName}.url) + if(EXISTS "${URL_FILE}") + file(REMOVE "${URL_FILE}") + endif() + execute_process( + COMMAND ${Python3_EXECUTABLE} ${CMAKE_CURRENT_LIST_DIR}/DownloadServer.py --file "${URL_FILE}" ${ARGN} + OUTPUT_FILE ${RunCMake_BINARY_DIR}/${testName}-python.txt + ERROR_FILE ${RunCMake_BINARY_DIR}/${testName}-python.txt + RESULT_VARIABLE result + TIMEOUT 30 + ) + if(NOT result EQUAL 0) + message(FATAL_ERROR "Failed to start download server:\n ${result}") + endif() + + foreach(i RANGE 1 8) + if(EXISTS ${URL_FILE}) + break() + endif() + execute_process(COMMAND ${CMAKE_COMMAND} -E sleep ${i}) + endforeach() + + if(NOT EXISTS ${URL_FILE}) + message(FATAL_ERROR "Failed to load download server URL from:\n ${URL_FILE}") + endif() + + file(READ ${URL_FILE} SERVER_URL) + message(STATUS "URL : ${URL_FILE} - ${SERVER_URL}") + run_cmake_with_options(${testName} ${CMAKE_COMMAND} -DSERVER_URL=${SERVER_URL} ) + run_cmake_command(${testName}-clean ${CMAKE_COMMAND} --build . --target clean) + run_cmake_command(${testName}-build ${CMAKE_COMMAND} --build .) +endfunction() + __ep_test_with_build(MultiCommand) set(RunCMake_TEST_OUTPUT_MERGE 1) @@ -38,6 +130,9 @@ set(RunCMake_TEST_OUTPUT_MERGE 0) if(NOT RunCMake_GENERATOR MATCHES "Visual Studio") __ep_test_with_build(LogOutputOnFailure) __ep_test_with_build(LogOutputOnFailureMerged) + __ep_test_with_build(DownloadTimeout) + __ep_test_with_build_with_server(DownloadInactivityTimeout --speed_limit --limit_duration 40) + __ep_test_with_build_with_server(DownloadInactivityResume --speed_limit --limit_duration 1) endif() # We can't test the substitution when using the old MSYS due to diff --git a/Tests/RunCMake/ExternalProject/Steps-CMP0114-Common.cmake b/Tests/RunCMake/ExternalProject/Steps-CMP0114-Common.cmake new file mode 100644 index 000000000..210edb151 --- /dev/null +++ b/Tests/RunCMake/ExternalProject/Steps-CMP0114-Common.cmake @@ -0,0 +1,34 @@ +include(ExternalProject) + +ExternalProject_Add(proj0 + SOURCE_DIR "." + DOWNLOAD_COMMAND ${CMAKE_COMMAND} -E touch ${CMAKE_CURRENT_BINARY_DIR}/proj0-download-mark + CONFIGURE_COMMAND ${CMAKE_COMMAND} -E touch ${CMAKE_CURRENT_BINARY_DIR}/proj0-configure-mark + BUILD_COMMAND ${CMAKE_COMMAND} -E touch ${CMAKE_CURRENT_BINARY_DIR}/proj0-build-mark + INSTALL_COMMAND "" + ) + +cmake_policy(GET CMP0114 cmp0114) +if(cmp0114 STREQUAL "NEW") + set(step_targets "update;test") + set(independent_step_targets "") +else() + set(step_targets "install;test") + set(independent_step_targets "download;update") +endif() + +ExternalProject_Add(proj1 + DEPENDS proj0 + SOURCE_DIR "." + DOWNLOAD_COMMAND ${CMAKE_COMMAND} -E touch ${CMAKE_CURRENT_BINARY_DIR}/proj1-download-mark + UPDATE_COMMAND ${CMAKE_COMMAND} -E touch ${CMAKE_CURRENT_BINARY_DIR}/proj1-update-mark + PATCH_COMMAND ${CMAKE_COMMAND} -E touch ${CMAKE_CURRENT_BINARY_DIR}/proj1-patch-mark + CONFIGURE_COMMAND ${CMAKE_COMMAND} -E touch ${CMAKE_CURRENT_BINARY_DIR}/proj1-configure-mark + BUILD_COMMAND ${CMAKE_COMMAND} -E touch ${CMAKE_CURRENT_BINARY_DIR}/proj1-build-mark + INSTALL_COMMAND ${CMAKE_COMMAND} -E touch ${CMAKE_CURRENT_BINARY_DIR}/proj1-install-mark + TEST_COMMAND ${CMAKE_COMMAND} -E touch ${CMAKE_CURRENT_BINARY_DIR}/proj1-test-mark + TEST_EXCLUDE_FROM_MAIN 1 # Along with 'STEP_TARGETS test', implies 'STEP_TARGETS install' + UPDATE_DISCONNECTED 1 # Along with 'STEP_TARGETS update', implies 'STEP_TARGETS download' + STEP_TARGETS ${step_targets} + INDEPENDENT_STEP_TARGETS ${independent_step_targets} + ) diff --git a/Tests/RunCMake/ExternalProject/Steps-CMP0114-NEW-build-download-check.cmake b/Tests/RunCMake/ExternalProject/Steps-CMP0114-NEW-build-download-check.cmake new file mode 100644 index 000000000..1439f0216 --- /dev/null +++ b/Tests/RunCMake/ExternalProject/Steps-CMP0114-NEW-build-download-check.cmake @@ -0,0 +1,3 @@ +check_steps_missing(proj0 download configure build) +check_steps_present(proj1 download) +check_steps_missing(proj1 update patch configure build install test) diff --git a/Tests/RunCMake/ExternalProject/Steps-CMP0114-NEW-build-install-check.cmake b/Tests/RunCMake/ExternalProject/Steps-CMP0114-NEW-build-install-check.cmake new file mode 100644 index 000000000..c1c9c8f3b --- /dev/null +++ b/Tests/RunCMake/ExternalProject/Steps-CMP0114-NEW-build-install-check.cmake @@ -0,0 +1,3 @@ +check_steps_present(proj0 download configure build) +check_steps_present(proj1 download patch configure build install) +check_steps_missing(proj1 test) diff --git a/Tests/RunCMake/ExternalProject/Steps-CMP0114-NEW-build-test-check.cmake b/Tests/RunCMake/ExternalProject/Steps-CMP0114-NEW-build-test-check.cmake new file mode 100644 index 000000000..fe256f200 --- /dev/null +++ b/Tests/RunCMake/ExternalProject/Steps-CMP0114-NEW-build-test-check.cmake @@ -0,0 +1,2 @@ +check_steps_present(proj0 download configure build) +check_steps_present(proj1 download patch configure build install test) diff --git a/Tests/RunCMake/ExternalProject/Steps-CMP0114-NEW-build-update-check.cmake b/Tests/RunCMake/ExternalProject/Steps-CMP0114-NEW-build-update-check.cmake new file mode 100644 index 000000000..63e2e1dcf --- /dev/null +++ b/Tests/RunCMake/ExternalProject/Steps-CMP0114-NEW-build-update-check.cmake @@ -0,0 +1,3 @@ +check_steps_missing(proj0 download configure build) +check_steps_present(proj1 download update) +check_steps_missing(proj1 patch configure build install test) diff --git a/Tests/RunCMake/ExternalProject/Steps-CMP0114-NEW.cmake b/Tests/RunCMake/ExternalProject/Steps-CMP0114-NEW.cmake new file mode 100644 index 000000000..9d8e99ee1 --- /dev/null +++ b/Tests/RunCMake/ExternalProject/Steps-CMP0114-NEW.cmake @@ -0,0 +1,2 @@ +cmake_policy(SET CMP0114 NEW) +include(Steps-CMP0114-Common.cmake) diff --git a/Tests/RunCMake/ExternalProject/Steps-CMP0114-OLD-build-download-check.cmake b/Tests/RunCMake/ExternalProject/Steps-CMP0114-OLD-build-download-check.cmake new file mode 100644 index 000000000..1439f0216 --- /dev/null +++ b/Tests/RunCMake/ExternalProject/Steps-CMP0114-OLD-build-download-check.cmake @@ -0,0 +1,3 @@ +check_steps_missing(proj0 download configure build) +check_steps_present(proj1 download) +check_steps_missing(proj1 update patch configure build install test) diff --git a/Tests/RunCMake/ExternalProject/Steps-CMP0114-OLD-build-install-check.cmake b/Tests/RunCMake/ExternalProject/Steps-CMP0114-OLD-build-install-check.cmake new file mode 100644 index 000000000..c1c9c8f3b --- /dev/null +++ b/Tests/RunCMake/ExternalProject/Steps-CMP0114-OLD-build-install-check.cmake @@ -0,0 +1,3 @@ +check_steps_present(proj0 download configure build) +check_steps_present(proj1 download patch configure build install) +check_steps_missing(proj1 test) diff --git a/Tests/RunCMake/ExternalProject/Steps-CMP0114-OLD-build-test-check.cmake b/Tests/RunCMake/ExternalProject/Steps-CMP0114-OLD-build-test-check.cmake new file mode 100644 index 000000000..fe256f200 --- /dev/null +++ b/Tests/RunCMake/ExternalProject/Steps-CMP0114-OLD-build-test-check.cmake @@ -0,0 +1,2 @@ +check_steps_present(proj0 download configure build) +check_steps_present(proj1 download patch configure build install test) diff --git a/Tests/RunCMake/ExternalProject/Steps-CMP0114-OLD-build-update-check.cmake b/Tests/RunCMake/ExternalProject/Steps-CMP0114-OLD-build-update-check.cmake new file mode 100644 index 000000000..63e2e1dcf --- /dev/null +++ b/Tests/RunCMake/ExternalProject/Steps-CMP0114-OLD-build-update-check.cmake @@ -0,0 +1,3 @@ +check_steps_missing(proj0 download configure build) +check_steps_present(proj1 download update) +check_steps_missing(proj1 patch configure build install test) diff --git a/Tests/RunCMake/ExternalProject/Steps-CMP0114-OLD.cmake b/Tests/RunCMake/ExternalProject/Steps-CMP0114-OLD.cmake new file mode 100644 index 000000000..0b51ad8d6 --- /dev/null +++ b/Tests/RunCMake/ExternalProject/Steps-CMP0114-OLD.cmake @@ -0,0 +1,2 @@ +cmake_policy(SET CMP0114 OLD) +include(Steps-CMP0114-Common.cmake) diff --git a/Tests/RunCMake/ExternalProject/Xcode-CMP0114-stderr.txt b/Tests/RunCMake/ExternalProject/Xcode-CMP0114-stderr.txt new file mode 100644 index 000000000..a616185c9 --- /dev/null +++ b/Tests/RunCMake/ExternalProject/Xcode-CMP0114-stderr.txt @@ -0,0 +1,11 @@ +^CMake Warning \(dev\) at .*/Modules/ExternalProject.cmake:[0-9]+ \(message\): + Policy CMP0114 is not set to NEW. In order to support the Xcode "new build + system", this project must be updated to set policy CMP0114 to NEW. + + Since CMake is generating for the Xcode "new build system", + ExternalProject_Add will use policy CMP0114's NEW behavior anyway, but the + generated build system may not match what the project intends. +Call Stack \(most recent call first\): + Xcode-CMP0114.cmake:[0-9]+ \(ExternalProject_Add\) + CMakeLists.txt:[0-9]+ \(include\) +This warning is for project developers. Use -Wno-dev to suppress it.$ diff --git a/Tests/RunCMake/ExternalProject/Xcode-CMP0114.cmake b/Tests/RunCMake/ExternalProject/Xcode-CMP0114.cmake new file mode 100644 index 000000000..5039daaca --- /dev/null +++ b/Tests/RunCMake/ExternalProject/Xcode-CMP0114.cmake @@ -0,0 +1,2 @@ +include(ExternalProject) +ExternalProject_Add(MyProj SOURCE_DIR .) |