diff options
Diffstat (limited to 'Tests')
175 files changed, 883 insertions, 1059 deletions
diff --git a/Tests/CMakeLib/testGccDepfileReader.cxx b/Tests/CMakeLib/testGccDepfileReader.cxx index e79f047..d46e8f3 100644 --- a/Tests/CMakeLib/testGccDepfileReader.cxx +++ b/Tests/CMakeLib/testGccDepfileReader.cxx @@ -5,6 +5,8 @@ #include <utility> #include <vector> +#include <cm/optional> + #include "cmsys/FStream.hxx" #include "cmGccDepfileReader.h" @@ -112,17 +114,26 @@ int testGccDepfileReader(int argc, char* argv[]) std::string dataDirPath = argv[1]; dataDirPath += "/testGccDepfileReader_data"; - const int numberOfTestFiles = 3; + const int numberOfTestFiles = 7; // 6th file doesn't exist for (int i = 1; i <= numberOfTestFiles; ++i) { const std::string base = dataDirPath + "/deps" + std::to_string(i); const std::string depfile = base + ".d"; const std::string plainDepfile = base + ".txt"; std::cout << "Comparing " << base << " with " << plainDepfile << std::endl; const auto actual = cmReadGccDepfile(depfile.c_str()); - const auto expected = readPlainDepfile(plainDepfile.c_str()); - if (!compare(actual, expected)) { - dump("actual", actual); - dump("expected", expected); + if (cmSystemTools::FileExists(plainDepfile)) { + if (!actual) { + std::cerr << "Reading " << depfile << " should have succeeded\n"; + return 1; + } + const auto expected = readPlainDepfile(plainDepfile.c_str()); + if (!compare(*actual, expected)) { + dump("actual", *actual); + dump("expected", expected); + return 1; + } + } else if (actual) { + std::cerr << "Reading " << depfile << " should have failed\n"; return 1; } } diff --git a/Tests/CMakeLib/testGccDepfileReader_data/deps4.d b/Tests/CMakeLib/testGccDepfileReader_data/deps4.d new file mode 100644 index 0000000..9977a28 --- /dev/null +++ b/Tests/CMakeLib/testGccDepfileReader_data/deps4.d @@ -0,0 +1 @@ +invalid diff --git a/Tests/CMakeLib/testGccDepfileReader_data/deps5.d b/Tests/CMakeLib/testGccDepfileReader_data/deps5.d new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/Tests/CMakeLib/testGccDepfileReader_data/deps5.d diff --git a/Tests/CMakeLib/testGccDepfileReader_data/deps5.txt b/Tests/CMakeLib/testGccDepfileReader_data/deps5.txt new file mode 100644 index 0000000..6c4a75b --- /dev/null +++ b/Tests/CMakeLib/testGccDepfileReader_data/deps5.txt @@ -0,0 +1,2 @@ +--RULES-- +--DEPENDENCIES-- diff --git a/Tests/CMakeLib/testGccDepfileReader_data/deps7.d b/Tests/CMakeLib/testGccDepfileReader_data/deps7.d new file mode 100644 index 0000000..92280cf --- /dev/null +++ b/Tests/CMakeLib/testGccDepfileReader_data/deps7.d @@ -0,0 +1,6 @@ +out1 \ + out2: \ + in1 \ + in2 + +out3: in3 diff --git a/Tests/CMakeLib/testGccDepfileReader_data/deps7.txt b/Tests/CMakeLib/testGccDepfileReader_data/deps7.txt new file mode 100644 index 0000000..86b6600 --- /dev/null +++ b/Tests/CMakeLib/testGccDepfileReader_data/deps7.txt @@ -0,0 +1,10 @@ +--RULES-- +out1 +out2 +--DEPENDENCIES-- +in1 +in2 +--RULES-- +out3 +--DEPENDENCIES-- +in3 diff --git a/Tests/CMakeLib/testOptional.cxx b/Tests/CMakeLib/testOptional.cxx index de09c0f..2d7dd7c 100644 --- a/Tests/CMakeLib/testOptional.cxx +++ b/Tests/CMakeLib/testOptional.cxx @@ -82,6 +82,18 @@ public: int Value = 0; }; +class NoMoveAssignEventLogger : public EventLogger +{ +public: + using EventLogger::EventLogger; + + NoMoveAssignEventLogger(const NoMoveAssignEventLogger&) = default; + NoMoveAssignEventLogger(NoMoveAssignEventLogger&&) = default; + + NoMoveAssignEventLogger& operator=(const NoMoveAssignEventLogger&) = default; + NoMoveAssignEventLogger& operator=(NoMoveAssignEventLogger&&) = delete; +}; + #define ASSERT_TRUE(x) \ do { \ if (!(x)) { \ @@ -328,12 +340,28 @@ static bool testCopyAssign(std::vector<Event>& expected) o1 = o4; // Intentionally duplicated to test assigning an empty optional to // an empty optional + cm::optional<NoMoveAssignEventLogger> o5{ 1 }; + auto const* v5 = &*o5; + const cm::optional<NoMoveAssignEventLogger> o6{ 2 }; + auto const* v6 = &*o6; + o5 = std::move(o6); + const NoMoveAssignEventLogger e7{ 3 }; + o5 = std::move(e7); + expected = { { Event::VALUE_CONSTRUCT, v2, nullptr, 4 }, { Event::COPY_CONSTRUCT, v1, v2, 4 }, { Event::VALUE_CONSTRUCT, v3, nullptr, 5 }, { Event::COPY_ASSIGN, v1, v3, 5 }, { Event::DESTRUCT, v1, nullptr, 5 }, + { Event::VALUE_CONSTRUCT, v5, nullptr, 1 }, + { Event::VALUE_CONSTRUCT, v6, nullptr, 2 }, + { Event::COPY_ASSIGN, v5, v6, 2 }, + { Event::VALUE_CONSTRUCT, &e7, nullptr, 3 }, + { Event::COPY_ASSIGN, v5, &e7, 3 }, + { Event::DESTRUCT, &e7, nullptr, 3 }, + { Event::DESTRUCT, v6, nullptr, 2 }, + { Event::DESTRUCT, v5, nullptr, 3 }, { Event::DESTRUCT, v3, nullptr, 5 }, { Event::DESTRUCT, v2, nullptr, 4 }, }; diff --git a/Tests/CMakeLib/testUVProcessChain.cxx b/Tests/CMakeLib/testUVProcessChain.cxx index 61a77cf..a003205 100644 --- a/Tests/CMakeLib/testUVProcessChain.cxx +++ b/Tests/CMakeLib/testUVProcessChain.cxx @@ -181,6 +181,10 @@ bool checkOutput(std::istream& outputStream, std::istream& errorStream) } std::string error = getInput(errorStream); + auto qemu_error_pos = error.find("qemu:"); + if (qemu_error_pos != std::string::npos) { + error.resize(qemu_error_pos); + } if (error.length() != 3 || error.find('1') == std::string::npos || error.find('2') == std::string::npos || error.find('3') == std::string::npos) { diff --git a/Tests/CMakeLists.txt b/Tests/CMakeLists.txt index 9aa401d..328ab7f 100644 --- a/Tests/CMakeLists.txt +++ b/Tests/CMakeLists.txt @@ -240,8 +240,6 @@ if(BUILD_TESTING) if(NOT CMake_TEST_EXTERNAL_CMAKE) add_subdirectory(CMakeLib) - - add_subdirectory(CMakeServerLib) endif() add_subdirectory(CMakeOnly) add_subdirectory(RunCMake) @@ -1422,6 +1420,7 @@ if(BUILD_TESTING) GTK2 Iconv ICU + Intl JPEG JsonCpp LAPACK @@ -2910,13 +2909,6 @@ if(BUILD_TESTING) ADD_TEST_MACRO(CMakeCommands.link_directories) ADD_TEST_MACRO(CMakeCommands.target_link_directories) - # The cmake server-mode test requires python for a simple client. - find_package(PythonInterp QUIET) - if(PYTHON_EXECUTABLE) - set(Server_BUILD_OPTIONS -DPYTHON_EXECUTABLE:FILEPATH=${PYTHON_EXECUTABLE}) - ADD_TEST_MACRO(Server Server) - endif() - configure_file( "${CMake_SOURCE_DIR}/Tests/CTestTestCrash/test.cmake.in" "${CMake_BINARY_DIR}/Tests/CTestTestCrash/test.cmake" diff --git a/Tests/CMakeServerLib/CMakeLists.txt b/Tests/CMakeServerLib/CMakeLists.txt deleted file mode 100644 index 2c23c2d..0000000 --- a/Tests/CMakeServerLib/CMakeLists.txt +++ /dev/null @@ -1,21 +0,0 @@ -include_directories( - ${CMAKE_CURRENT_BINARY_DIR} - ${CMake_BINARY_DIR}/Source - ${CMake_SOURCE_DIR}/Source - ) - -set(CMakeServerLib_TESTS - testServerBuffering.cpp - ) - -create_test_sourcelist(CMakeLib_TEST_SRCS CMakeServerLibTests.cxx ${CMakeServerLib_TESTS}) -add_executable(CMakeServerLibTests ${CMakeLib_TEST_SRCS}) -target_link_libraries(CMakeServerLibTests CMakeLib CMakeServerLib) - -SET_PROPERTY(TARGET CMakeServerLibTests PROPERTY C_CLANG_TIDY "") -SET_PROPERTY(TARGET CMakeServerLibTests PROPERTY CXX_CLANG_TIDY "") - -foreach(testfile ${CMakeServerLib_TESTS}) - get_filename_component(test "${testfile}" NAME_WE) - add_test(CMakeServerLib.${test} CMakeServerLibTests ${test} ${${test}_ARGS}) -endforeach() diff --git a/Tests/CMakeServerLib/testServerBuffering.cpp b/Tests/CMakeServerLib/testServerBuffering.cpp deleted file mode 100644 index 6f22940..0000000 --- a/Tests/CMakeServerLib/testServerBuffering.cpp +++ /dev/null @@ -1,87 +0,0 @@ -#include <iostream> -#include <memory> -#include <string> -#include <vector> - -#include "cmConnection.h" -#include "cmServerConnection.h" - -void print_error(const std::vector<std::string>& input, - const std::vector<std::string>& output) -{ - std::cerr << "Responses don't equal input messages input." << std::endl; - std::cerr << "Responses: " << std::endl; - - for (auto& msg : output) { - std::cerr << "'" << msg << "'" << std::endl; - } - - std::cerr << "Input messages" << std::endl; - for (auto& msg : input) { - std::cerr << "'" << msg << "'" << std::endl; - } -} - -std::string trim_newline(const std::string& _buffer) -{ - auto buffer = _buffer; - while (!buffer.empty() && (buffer.back() == '\n' || buffer.back() == '\r')) { - buffer.pop_back(); - } - return buffer; -} - -int testServerBuffering(int, char** const) -{ - std::vector<std::string> messages = { - "{ \"test\": 10}", "{ \"test\": { \"test2\": false} }", - "{ \"test\": [1, 2, 3] }", - "{ \"a\": { \"1\": {}, \n\n\n \"2\":[] \t\t\t\t}}" - }; - - std::string fullMessage; - for (auto& msg : messages) { - fullMessage += "[== \"CMake Server\" ==[\n"; - fullMessage += msg; - fullMessage += "\n]== \"CMake Server\" ==]\n"; - } - - // The buffering strategy should cope with any fragmentation, including - // just getting the characters one at a time. - auto bufferingStrategy = - std::unique_ptr<cmConnectionBufferStrategy>(new cmServerBufferStrategy); - std::vector<std::string> response; - std::string rawBuffer; - for (auto& messageChar : fullMessage) { - rawBuffer += messageChar; - std::string packet = bufferingStrategy->BufferMessage(rawBuffer); - do { - if (!packet.empty() && packet != "\r\n") { - response.push_back(trim_newline(packet)); - } - packet = bufferingStrategy->BufferMessage(rawBuffer); - } while (!packet.empty()); - } - - if (response != messages) { - print_error(messages, response); - return 1; - } - - // We should also be able to deal with getting a bunch at once - response.clear(); - std::string packet = bufferingStrategy->BufferMessage(fullMessage); - do { - if (!packet.empty() && packet != "\r\n") { - response.push_back(trim_newline(packet)); - } - packet = bufferingStrategy->BufferMessage(fullMessage); - } while (!packet.empty()); - - if (response != messages) { - print_error(messages, response); - return 1; - } - - return 0; -} diff --git a/Tests/CMakeTests/EndStuffTestScript.cmake b/Tests/CMakeTests/EndStuffTestScript.cmake index 9f40818..6a6b162 100644 --- a/Tests/CMakeTests/EndStuffTestScript.cmake +++ b/Tests/CMakeTests/EndStuffTestScript.cmake @@ -1,68 +1,40 @@ message(STATUS "testname='${testname}'") -if(testname STREQUAL bad_else) # fail - file(WRITE "${dir}/${testname}.cmake" -"else() -") +function(do_end content) + file(WRITE "${dir}/${testname}.cmake" "${content}") execute_process(COMMAND ${CMAKE_COMMAND} -P "${dir}/${testname}.cmake" RESULT_VARIABLE rv) if(NOT rv EQUAL 0) message(FATAL_ERROR "${testname} failed") endif() +endfunction() + +if(testname STREQUAL bad_else) # fail + do_end("else()\n") elseif(testname STREQUAL bad_elseif) # fail - file(WRITE "${dir}/${testname}.cmake" -"elseif() -") - execute_process(COMMAND ${CMAKE_COMMAND} -P "${dir}/${testname}.cmake" - RESULT_VARIABLE rv) - if(NOT rv EQUAL 0) - message(FATAL_ERROR "${testname} failed") - endif() + do_end("elseif()\n") elseif(testname STREQUAL bad_endforeach) # fail - endforeach() + do_end("endforeach()\n") elseif(testname STREQUAL bad_endfunction) # fail - endfunction() + do_end("endfunction()\n") elseif(testname STREQUAL bad_endif) # fail - file(WRITE "${dir}/${testname}.cmake" -"cmake_minimum_required(VERSION 2.8) -endif() -") - execute_process(COMMAND ${CMAKE_COMMAND} -P "${dir}/${testname}.cmake" - RESULT_VARIABLE rv) - if(NOT rv EQUAL 0) - message(FATAL_ERROR "${testname} failed") - endif() + do_end("cmake_minimum_required(VERSION 2.8)\nendif()\n") -elseif(testname STREQUAL endif_low_min_version) # pass - file(WRITE "${dir}/${testname}.cmake" -"cmake_minimum_required(VERSION 1.2) -endif() -") - execute_process(COMMAND ${CMAKE_COMMAND} -P "${dir}/${testname}.cmake" - RESULT_VARIABLE rv) - if(NOT rv EQUAL 0) - message(FATAL_ERROR "${testname} failed") - endif() +elseif(testname STREQUAL endif_low_min_version) # fail + do_end("cmake_minimum_required(VERSION 1.2)\nendif()\n") -elseif(testname STREQUAL endif_no_min_version) # pass - file(WRITE "${dir}/${testname}.cmake" -"endif() -") - execute_process(COMMAND ${CMAKE_COMMAND} -P "${dir}/${testname}.cmake" - RESULT_VARIABLE rv) - if(NOT rv EQUAL 0) - message(FATAL_ERROR "${testname} failed") - endif() +elseif(testname STREQUAL endif_no_min_version) # fail + do_end("endif()\n") elseif(testname STREQUAL bad_endmacro) # fail - endmacro() + do_end("endmacro()\n") elseif(testname STREQUAL bad_endwhile) # fail - endwhile() + do_end("endwhile()\n") else() # fail message(FATAL_ERROR "testname='${testname}' - error: no such test in '${CMAKE_CURRENT_LIST_FILE}'") diff --git a/Tests/FindIntl/CMakeLists.txt b/Tests/FindIntl/CMakeLists.txt new file mode 100644 index 0000000..0906ede --- /dev/null +++ b/Tests/FindIntl/CMakeLists.txt @@ -0,0 +1,10 @@ +add_test(NAME FindIntl.Test COMMAND + ${CMAKE_CTEST_COMMAND} -C $<CONFIGURATION> + --build-and-test + "${CMake_SOURCE_DIR}/Tests/FindIntl/Test" + "${CMake_BINARY_DIR}/Tests/FindIntl/Test" + ${build_generator_args} + --build-project TestFindIntl + --build-options ${build_options} + --test-command ${CMAKE_CTEST_COMMAND} -V -C $<CONFIGURATION> + ) diff --git a/Tests/FindIntl/Test/CMakeLists.txt b/Tests/FindIntl/Test/CMakeLists.txt new file mode 100644 index 0000000..5140406 --- /dev/null +++ b/Tests/FindIntl/Test/CMakeLists.txt @@ -0,0 +1,14 @@ +cmake_minimum_required(VERSION 3.10) +project(TestFindIntl CXX) +include(CTest) + +find_package(Intl REQUIRED) + +add_executable(test_intl_tgt main.cxx) +target_link_libraries(test_intl_tgt Intl::Intl) +add_test(NAME test_intl_tgt COMMAND test_intl_tgt) + +add_executable(test_intl_var main.cxx) +target_include_directories(test_intl_var PRIVATE ${Intl_INCLUDE_DIRS}) +target_link_libraries(test_intl_var PRIVATE ${Intl_LIBRARIES}) +add_test(NAME test_intl_var COMMAND test_intl_var) diff --git a/Tests/FindIntl/Test/main.cxx b/Tests/FindIntl/Test/main.cxx new file mode 100644 index 0000000..d90c095 --- /dev/null +++ b/Tests/FindIntl/Test/main.cxx @@ -0,0 +1,11 @@ +extern "C" { +#include <libintl.h> +} + +int main() +{ + // Check if we include the directory correctly and have no link errors + bindtextdomain("", ""); + gettext(""); + return 0; +} diff --git a/Tests/RunCMake/CommandLine/E_server-arg-result.txt b/Tests/RunCMake/CMP0115/CMP0115-NEW-result.txt index d00491f..d00491f 100644 --- a/Tests/RunCMake/CommandLine/E_server-arg-result.txt +++ b/Tests/RunCMake/CMP0115/CMP0115-NEW-result.txt diff --git a/Tests/RunCMake/CMP0115/CMP0115-NEW-stderr.txt b/Tests/RunCMake/CMP0115/CMP0115-NEW-stderr.txt new file mode 100644 index 0000000..b63c53d --- /dev/null +++ b/Tests/RunCMake/CMP0115/CMP0115-NEW-stderr.txt @@ -0,0 +1,17 @@ +^CMake Error at CMP0115\.cmake:[0-9]+ \(add_executable\): + Cannot find source file: + + main +Call Stack \(most recent call first\): + CMP0115-NEW\.cmake:[0-9]+ \(include\) + CMakeLists\.txt:[0-9]+ \(include\) + + +CMake Error at CMP0115\.cmake:[0-9]+ \(add_executable\): + No SOURCES given to target: exe +Call Stack \(most recent call first\): + CMP0115-NEW\.cmake:[0-9]+ \(include\) + CMakeLists\.txt:[0-9]+ \(include\) + + +CMake Generate step failed\. Build files cannot be regenerated correctly\.$ diff --git a/Tests/RunCMake/CMP0115/CMP0115-NEW.cmake b/Tests/RunCMake/CMP0115/CMP0115-NEW.cmake new file mode 100644 index 0000000..ddf5071 --- /dev/null +++ b/Tests/RunCMake/CMP0115/CMP0115-NEW.cmake @@ -0,0 +1 @@ +include(CMP0115.cmake) diff --git a/Tests/RunCMake/CMP0115/CMP0115-OLD-result.txt b/Tests/RunCMake/CMP0115/CMP0115-OLD-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/CMP0115/CMP0115-OLD-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/CMP0115/CMP0115-OLD-stderr.txt b/Tests/RunCMake/CMP0115/CMP0115-OLD-stderr.txt new file mode 100644 index 0000000..8b90311 --- /dev/null +++ b/Tests/RunCMake/CMP0115/CMP0115-OLD-stderr.txt @@ -0,0 +1,22 @@ +^CMake Error at CMP0115\.cmake:[0-9]+ \(add_executable\): + Cannot find source file: + + noexist + + Tried extensions [^ +]* + [^ +]* +Call Stack \(most recent call first\): + CMP0115-OLD\.cmake:[0-9]+ \(include\) + CMakeLists\.txt:[0-9]+ \(include\) + + +CMake Error at CMP0115\.cmake:[0-9]+ \(add_executable\): + No SOURCES given to target: exe +Call Stack \(most recent call first\): + CMP0115-OLD\.cmake:[0-9]+ \(include\) + CMakeLists\.txt:[0-9]+ \(include\) + + +CMake Generate step failed\. Build files cannot be regenerated correctly\.$ diff --git a/Tests/RunCMake/CMP0115/CMP0115-OLD.cmake b/Tests/RunCMake/CMP0115/CMP0115-OLD.cmake new file mode 100644 index 0000000..ddf5071 --- /dev/null +++ b/Tests/RunCMake/CMP0115/CMP0115-OLD.cmake @@ -0,0 +1 @@ +include(CMP0115.cmake) diff --git a/Tests/RunCMake/CMP0115/CMP0115-WARN-result.txt b/Tests/RunCMake/CMP0115/CMP0115-WARN-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/CMP0115/CMP0115-WARN-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/CMP0115/CMP0115-WARN-stderr.txt b/Tests/RunCMake/CMP0115/CMP0115-WARN-stderr.txt new file mode 100644 index 0000000..7b100b6 --- /dev/null +++ b/Tests/RunCMake/CMP0115/CMP0115-WARN-stderr.txt @@ -0,0 +1,36 @@ +^CMake Warning \(dev\) at CMP0115\.cmake:[0-9]+ \(add_executable\): + Policy CMP0115 is not set: Source file extensions must be explicit\. Run + "cmake --help-policy CMP0115" for policy details\. Use the cmake_policy + command to set the policy and suppress this warning\. + + File: + + [^ +]*/Tests/RunCMake/CMP0115/main\.c +Call Stack \(most recent call first\): + CMP0115-WARN\.cmake:[0-9]+ \(include\) + CMakeLists\.txt:[0-9]+ \(include\) +This warning is for project developers\. Use -Wno-dev to suppress it\. + +CMake Error at CMP0115\.cmake:[0-9]+ \(add_executable\): + Cannot find source file: + + noexist + + Tried extensions [^ +]* + [^ +]* +Call Stack \(most recent call first\): + CMP0115-WARN\.cmake:[0-9]+ \(include\) + CMakeLists\.txt:[0-9]+ \(include\) + + +CMake Error at CMP0115\.cmake:[0-9]+ \(add_executable\): + No SOURCES given to target: exe +Call Stack \(most recent call first\): + CMP0115-WARN\.cmake:[0-9]+ \(include\) + CMakeLists\.txt:[0-9]+ \(include\) + + +CMake Generate step failed\. Build files cannot be regenerated correctly\.$ diff --git a/Tests/RunCMake/CMP0115/CMP0115-WARN.cmake b/Tests/RunCMake/CMP0115/CMP0115-WARN.cmake new file mode 100644 index 0000000..ddf5071 --- /dev/null +++ b/Tests/RunCMake/CMP0115/CMP0115-WARN.cmake @@ -0,0 +1 @@ +include(CMP0115.cmake) diff --git a/Tests/RunCMake/CMP0115/CMP0115.cmake b/Tests/RunCMake/CMP0115/CMP0115.cmake new file mode 100644 index 0000000..be910a4 --- /dev/null +++ b/Tests/RunCMake/CMP0115/CMP0115.cmake @@ -0,0 +1,3 @@ +enable_language(C) + +add_executable(exe main noexist) diff --git a/Tests/RunCMake/CMP0115/CMakeLists.txt b/Tests/RunCMake/CMP0115/CMakeLists.txt new file mode 100644 index 0000000..b646c4a --- /dev/null +++ b/Tests/RunCMake/CMP0115/CMakeLists.txt @@ -0,0 +1,3 @@ +cmake_minimum_required(VERSION 3.18) +project(${RunCMake_TEST} NONE) +include(${RunCMake_TEST}.cmake) diff --git a/Tests/RunCMake/CMP0115/RunCMakeTest.cmake b/Tests/RunCMake/CMP0115/RunCMakeTest.cmake new file mode 100644 index 0000000..58182ac --- /dev/null +++ b/Tests/RunCMake/CMP0115/RunCMakeTest.cmake @@ -0,0 +1,12 @@ +include(RunCMake) + +function(run_cmp0115 status) + if(NOT status STREQUAL "WARN") + set(RunCMake_TEST_OPTIONS -DCMAKE_POLICY_DEFAULT_CMP0115=${status}) + endif() + run_cmake(CMP0115-${status}) +endfunction() + +run_cmp0115(OLD) +run_cmp0115(WARN) +run_cmp0115(NEW) diff --git a/Tests/Server/buildsystem1/foo.cpp b/Tests/RunCMake/CMP0115/main.c index 7f39d71..8488f4e 100644 --- a/Tests/Server/buildsystem1/foo.cpp +++ b/Tests/RunCMake/CMP0115/main.c @@ -1,5 +1,4 @@ - -int foo() +int main(void) { return 0; } diff --git a/Tests/RunCMake/CMP0116/CMP0116-NEW-NOWARN.cmake b/Tests/RunCMake/CMP0116/CMP0116-NEW-NOWARN.cmake new file mode 100644 index 0000000..f92fac6 --- /dev/null +++ b/Tests/RunCMake/CMP0116/CMP0116-NEW-NOWARN.cmake @@ -0,0 +1,3 @@ +set(depdir) + +include(Common.cmake) diff --git a/Tests/RunCMake/CMP0116/CMP0116-NEW-WARN.cmake b/Tests/RunCMake/CMP0116/CMP0116-NEW-WARN.cmake new file mode 100644 index 0000000..f92fac6 --- /dev/null +++ b/Tests/RunCMake/CMP0116/CMP0116-NEW-WARN.cmake @@ -0,0 +1,3 @@ +set(depdir) + +include(Common.cmake) diff --git a/Tests/RunCMake/CMP0116/CMP0116-OLD-NOWARN.cmake b/Tests/RunCMake/CMP0116/CMP0116-OLD-NOWARN.cmake new file mode 100644 index 0000000..665f485 --- /dev/null +++ b/Tests/RunCMake/CMP0116/CMP0116-OLD-NOWARN.cmake @@ -0,0 +1,3 @@ +set(depdir Subdirectory/) + +include(Common.cmake) diff --git a/Tests/RunCMake/CMP0116/CMP0116-OLD-WARN.cmake b/Tests/RunCMake/CMP0116/CMP0116-OLD-WARN.cmake new file mode 100644 index 0000000..665f485 --- /dev/null +++ b/Tests/RunCMake/CMP0116/CMP0116-OLD-WARN.cmake @@ -0,0 +1,3 @@ +set(depdir Subdirectory/) + +include(Common.cmake) diff --git a/Tests/RunCMake/CMP0116/CMP0116-WARN-NOWARN-stderr.txt b/Tests/RunCMake/CMP0116/CMP0116-WARN-NOWARN-stderr.txt new file mode 100644 index 0000000..843ff1c --- /dev/null +++ b/Tests/RunCMake/CMP0116/CMP0116-WARN-NOWARN-stderr.txt @@ -0,0 +1,7 @@ +^(CMake Warning \(dev\) at Subdirectory/CMakeLists\.txt:[0-9]+ \(add_custom_command\): + Policy CMP0116 is not set: Ninja generators transform DEPFILEs from + add_custom_command\(\)\. Run "cmake --help-policy CMP0116" for policy + details\. Use the cmake_policy command to set the policy and suppress this + warning\. +This warning is for project developers\. Use -Wno-dev to suppress it\. +*)+$ diff --git a/Tests/RunCMake/CMP0116/CMP0116-WARN-NOWARN.cmake b/Tests/RunCMake/CMP0116/CMP0116-WARN-NOWARN.cmake new file mode 100644 index 0000000..665f485 --- /dev/null +++ b/Tests/RunCMake/CMP0116/CMP0116-WARN-NOWARN.cmake @@ -0,0 +1,3 @@ +set(depdir Subdirectory/) + +include(Common.cmake) diff --git a/Tests/RunCMake/CMP0116/CMP0116-WARN-WARN-stderr.txt b/Tests/RunCMake/CMP0116/CMP0116-WARN-WARN-stderr.txt new file mode 100644 index 0000000..e29af91 --- /dev/null +++ b/Tests/RunCMake/CMP0116/CMP0116-WARN-WARN-stderr.txt @@ -0,0 +1,16 @@ +^(CMake Warning \(dev\) at Common\.cmake:[0-9]+ \(add_custom_command\): + Policy CMP0116 is not set: Ninja generators transform DEPFILEs from + add_custom_command\(\)\. Run "cmake --help-policy CMP0116" for policy + details\. Use the cmake_policy command to set the policy and suppress this + warning\. +Call Stack \(most recent call first\): + CMP0116-WARN-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 Subdirectory/CMakeLists\.txt:[0-9]+ \(add_custom_command\): + Policy CMP0116 is not set: Ninja generators transform DEPFILEs from + add_custom_command\(\)\. Run "cmake --help-policy CMP0116" for policy + details\. Use the cmake_policy command to set the policy and suppress this + warning\. +This warning is for project developers\. Use -Wno-dev to suppress it\. +*)+$ diff --git a/Tests/RunCMake/CMP0116/CMP0116-WARN-WARN.cmake b/Tests/RunCMake/CMP0116/CMP0116-WARN-WARN.cmake new file mode 100644 index 0000000..665f485 --- /dev/null +++ b/Tests/RunCMake/CMP0116/CMP0116-WARN-WARN.cmake @@ -0,0 +1,3 @@ +set(depdir Subdirectory/) + +include(Common.cmake) diff --git a/Tests/RunCMake/CMP0116/CMakeLists.txt b/Tests/RunCMake/CMP0116/CMakeLists.txt new file mode 100644 index 0000000..b646c4a --- /dev/null +++ b/Tests/RunCMake/CMP0116/CMakeLists.txt @@ -0,0 +1,3 @@ +cmake_minimum_required(VERSION 3.18) +project(${RunCMake_TEST} NONE) +include(${RunCMake_TEST}.cmake) diff --git a/Tests/RunCMake/CMP0116/Common.cmake b/Tests/RunCMake/CMP0116/Common.cmake new file mode 100644 index 0000000..472b162 --- /dev/null +++ b/Tests/RunCMake/CMP0116/Common.cmake @@ -0,0 +1,8 @@ +add_custom_command( + OUTPUT top.txt + COMMAND ${CMAKE_COMMAND} -DOUTFILE=top.txt -DINFILE=topdep.txt -DDEPFILE=top.txt.d -DSTAMPFILE=topstamp.txt -DDEPDIR= -P ${CMAKE_SOURCE_DIR}/WriteDepfile.cmake + DEPFILE top.txt.d + ) +add_custom_target(top ALL DEPENDS top.txt) + +add_subdirectory(Subdirectory) diff --git a/Tests/RunCMake/CMP0116/RunCMakeTest.cmake b/Tests/RunCMake/CMP0116/RunCMakeTest.cmake new file mode 100644 index 0000000..8a83cc1 --- /dev/null +++ b/Tests/RunCMake/CMP0116/RunCMakeTest.cmake @@ -0,0 +1,49 @@ +include(RunCMake) + +function(run_cmp0116 status warn) + if(warn) + set(name CMP0116-${status}-WARN) + else() + set(name CMP0116-${status}-NOWARN) + endif() + set(RunCMake_TEST_OPTIONS + -DCMAKE_POLICY_WARNING_CMP0116:BOOL=${warn} + ) + if(NOT status STREQUAL "WARN") + list(APPEND RunCMake_TEST_OPTIONS + -DCMAKE_POLICY_DEFAULT_CMP0116:STRING=${status} + ) + endif() + + set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/${name}-build) + run_cmake(${name}) + unset(RunCMake_TEST_OPTIONS) + set(RunCMake_TEST_NO_CLEAN 1) + set(RunCMake-check-file check.cmake) + + file(TOUCH "${RunCMake_TEST_BINARY_DIR}/topdep.txt") + file(TOUCH "${RunCMake_TEST_BINARY_DIR}/Subdirectory/subdep.txt") + set(cmp0116_step 1) + run_cmake_command(${name}-build1 ${CMAKE_COMMAND} --build . --config Debug) + file(REMOVE "${RunCMake_TEST_BINARY_DIR}/topstamp.txt") + file(REMOVE "${RunCMake_TEST_BINARY_DIR}/Subdirectory/substamp.txt") + execute_process(COMMAND ${CMAKE_COMMAND} -E sleep 1.25) + + file(TOUCH "${RunCMake_TEST_BINARY_DIR}/topdep.txt") + file(TOUCH "${RunCMake_TEST_BINARY_DIR}/Subdirectory/subdep.txt") + set(cmp0116_step 2) + run_cmake_command(${name}-build2 ${CMAKE_COMMAND} --build . --config Debug) + file(REMOVE "${RunCMake_TEST_BINARY_DIR}/topstamp.txt") + file(REMOVE "${RunCMake_TEST_BINARY_DIR}/Subdirectory/substamp.txt") + execute_process(COMMAND ${CMAKE_COMMAND} -E sleep 1.25) + + set(cmp0116_step 3) + run_cmake_command(${name}-build3 ${CMAKE_COMMAND} --build . --config Debug) +endfunction() + +run_cmp0116(WARN OFF) +run_cmp0116(OLD OFF) +run_cmp0116(NEW OFF) +run_cmp0116(WARN ON) +run_cmp0116(OLD ON) +run_cmp0116(NEW ON) diff --git a/Tests/RunCMake/CMP0116/Subdirectory/CMakeLists.txt b/Tests/RunCMake/CMP0116/Subdirectory/CMakeLists.txt new file mode 100644 index 0000000..f0f60b2 --- /dev/null +++ b/Tests/RunCMake/CMP0116/Subdirectory/CMakeLists.txt @@ -0,0 +1,6 @@ +add_custom_command( + OUTPUT sub.txt + COMMAND ${CMAKE_COMMAND} -DOUTFILE=sub.txt -DINFILE=subdep.txt -DDEPFILE=sub.txt.d -DSTAMPFILE=substamp.txt -DDEPDIR=${depdir} -P ${CMAKE_SOURCE_DIR}/WriteDepfile.cmake + DEPFILE ${depdir}sub.txt.d + ) +add_custom_target(sub ALL DEPENDS sub.txt) diff --git a/Tests/RunCMake/CMP0116/WriteDepfile.cmake b/Tests/RunCMake/CMP0116/WriteDepfile.cmake new file mode 100644 index 0000000..1a74d2a --- /dev/null +++ b/Tests/RunCMake/CMP0116/WriteDepfile.cmake @@ -0,0 +1,3 @@ +file(TOUCH "${OUTFILE}") +file(TOUCH "${STAMPFILE}") +file(WRITE "${DEPFILE}" "${DEPDIR}${OUTFILE}: ${DEPDIR}${INFILE}\n") diff --git a/Tests/RunCMake/CMP0116/check.cmake b/Tests/RunCMake/CMP0116/check.cmake new file mode 100644 index 0000000..1b16748 --- /dev/null +++ b/Tests/RunCMake/CMP0116/check.cmake @@ -0,0 +1,18 @@ +function(check_exists file) + if(NOT EXISTS "${file}") + string(APPEND RunCMake_TEST_FAILED "${file} does not exist\n") + endif() + set(RunCMake_TEST_FAILED "${RunCMake_TEST_FAILED}" PARENT_SCOPE) +endfunction() + +function(check_not_exists file) + if(EXISTS "${file}") + string(APPEND RunCMake_TEST_FAILED "${file} exists\n") + endif() + set(RunCMake_TEST_FAILED "${RunCMake_TEST_FAILED}" PARENT_SCOPE) +endfunction() + +if(cmp0116_step EQUAL 3) + check_not_exists("${RunCMake_TEST_BINARY_DIR}/topstamp.txt") + check_not_exists("${RunCMake_TEST_BINARY_DIR}/Subdirectory/substamp.txt") +endif() diff --git a/Tests/RunCMake/CMakeLists.txt b/Tests/RunCMake/CMakeLists.txt index 7b85061..9fc5b69 100644 --- a/Tests/RunCMake/CMakeLists.txt +++ b/Tests/RunCMake/CMakeLists.txt @@ -125,6 +125,10 @@ if(CMake_TEST_CUDA) endif() add_RunCMake_test(CMP0106) add_RunCMake_test(CMP0111) +add_RunCMake_test(CMP0115) +if(CMAKE_GENERATOR MATCHES "Ninja") + add_RunCMake_test(CMP0116) +endif() # The test for Policy 65 requires the use of the # CMAKE_SHARED_LIBRARY_LINK_CXX_FLAGS variable, which both the VS and Xcode @@ -561,7 +565,8 @@ if (CMAKE_SYSTEM_NAME MATCHES "(Linux|Darwin)" endif() -add_RunCMake_test(CommandLine -DCMAKE_SYSTEM_NAME=${CMAKE_SYSTEM_NAME} -DCYGWIN=${CYGWIN} -DPYTHON_EXECUTABLE=${PYTHON_EXECUTABLE}) +add_executable(pseudo_llvm-rc pseudo_llvm-rc.c) +add_RunCMake_test(CommandLine -DLLVM_RC=$<TARGET_FILE:pseudo_llvm-rc> -DCMAKE_SYSTEM_NAME=${CMAKE_SYSTEM_NAME} -DCYGWIN=${CYGWIN} -DPYTHON_EXECUTABLE=${PYTHON_EXECUTABLE}) add_RunCMake_test(CommandLineTar) if(CMAKE_PLATFORM_NO_VERSIONED_SONAME OR (NOT CMAKE_SHARED_LIBRARY_SONAME_FLAG AND NOT CMAKE_SHARED_LIBRARY_SONAME_C_FLAG)) @@ -770,6 +775,7 @@ add_RunCMake_test(PrecompileHeaders -DCMAKE_C_COMPILER_ID=${CMAKE_C_COMPILER_ID} add_RunCMake_test("UnityBuild") add_RunCMake_test(CMakePresets -DPYTHON_EXECUTABLE=${PYTHON_EXECUTABLE} -DCMake_TEST_JSON_SCHEMA=${CMake_TEST_JSON_SCHEMA}) +add_RunCMake_test(TransformDepfile) if(WIN32) add_RunCMake_test(Win32GenEx) diff --git a/Tests/RunCMake/CTest/RunCMakeTest.cmake b/Tests/RunCMake/CTest/RunCMakeTest.cmake index ffc8f78..b81f319 100644 --- a/Tests/RunCMake/CTest/RunCMakeTest.cmake +++ b/Tests/RunCMake/CTest/RunCMakeTest.cmake @@ -5,6 +5,7 @@ run_cmake(BeforeProject) unset(RunCMake_TEST_OPTIONS) run_cmake(NotOn) +run_cmake(Site) function(run_CMakeCTestArguments) run_cmake_with_options(CMakeCTestArguments "-DCMAKE_CTEST_ARGUMENTS=--quiet\\;--output-log\\;output-log.txt") diff --git a/Tests/RunCMake/CTest/Site.cmake b/Tests/RunCMake/CTest/Site.cmake new file mode 100644 index 0000000..2c96f23 --- /dev/null +++ b/Tests/RunCMake/CTest/Site.cmake @@ -0,0 +1,5 @@ +include(CTest) +get_property(site CACHE SITE PROPERTY VALUE) +if(NOT "${site}" STREQUAL "${SITE}") + message(FATAL_ERROR "SITE is not a cache entry") +endif() diff --git a/Tests/RunCMake/CheckModules/CMP0075-stderr.txt b/Tests/RunCMake/CheckModules/CMP0075-stderr.txt index 960fe94..97833f5 100644 --- a/Tests/RunCMake/CheckModules/CMP0075-stderr.txt +++ b/Tests/RunCMake/CheckModules/CMP0075-stderr.txt @@ -47,4 +47,15 @@ CMake Warning \(dev\) at [^ Call Stack \(most recent call first\): CMP0075.cmake:41 \(check_include_files\) CMakeLists.txt:[0-9]+ \(include\) -This warning is for project developers. Use -Wno-dev to suppress it.$ +This warning is for project developers. Use -Wno-dev to suppress it. ++ +CMake Deprecation Warning at CMP0075.cmake:[0-9]+ \(cmake_policy\): + The OLD behavior for policy CMP0075 will be removed from a future version + of CMake. + + The cmake-policies\(7\) manual explains that the OLD behaviors of all + policies are deprecated and that a policy should be set to OLD only under + specific short-term circumstances. Projects should be ported to the NEW + behavior and not rely on setting a policy to OLD. +Call Stack \(most recent call first\): + CMakeLists.txt:[0-9]+ \(include\)$ diff --git a/Tests/RunCMake/CommandLine/E_capabilities-stdout.txt b/Tests/RunCMake/CommandLine/E_capabilities-stdout.txt index e24e131..a8b6584 100644 --- a/Tests/RunCMake/CommandLine/E_capabilities-stdout.txt +++ b/Tests/RunCMake/CommandLine/E_capabilities-stdout.txt @@ -1 +1 @@ -^{"fileApi":{"requests":\[{"kind":"codemodel","version":\[{"major":2,"minor":2}]},{"kind":"cache","version":\[{"major":2,"minor":0}]},{"kind":"cmakeFiles","version":\[{"major":1,"minor":0}]}]},"generators":\[.*\],"serverMode":true,"version":{.*}}$ +^{"fileApi":{"requests":\[{"kind":"codemodel","version":\[{"major":2,"minor":2}]},{"kind":"cache","version":\[{"major":2,"minor":0}]},{"kind":"cmakeFiles","version":\[{"major":1,"minor":0}]}]},"generators":\[.*\],"serverMode":false,"version":{.*}}$ diff --git a/Tests/RunCMake/CommandLine/E_server-arg-stderr.txt b/Tests/RunCMake/CommandLine/E_server-arg-stderr.txt deleted file mode 100644 index 4dcbab9..0000000 --- a/Tests/RunCMake/CommandLine/E_server-arg-stderr.txt +++ /dev/null @@ -1 +0,0 @@ -^CMake Error: Unknown argument for server mode$ diff --git a/Tests/RunCMake/CommandLine/E_server-pipe-result.txt b/Tests/RunCMake/CommandLine/E_server-pipe-result.txt deleted file mode 100644 index 0cfbf08..0000000 --- a/Tests/RunCMake/CommandLine/E_server-pipe-result.txt +++ /dev/null @@ -1 +0,0 @@ -2 diff --git a/Tests/RunCMake/CommandLine/E_server-pipe-stderr.txt b/Tests/RunCMake/CommandLine/E_server-pipe-stderr.txt deleted file mode 100644 index 7193ba6..0000000 --- a/Tests/RunCMake/CommandLine/E_server-pipe-stderr.txt +++ /dev/null @@ -1 +0,0 @@ -^CMake Error: No pipe given after --pipe=$ diff --git a/Tests/RunCMake/CommandLine/E_server-result.txt b/Tests/RunCMake/CommandLine/E_server-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/CommandLine/E_server-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/CommandLine/E_server-stderr.txt b/Tests/RunCMake/CommandLine/E_server-stderr.txt new file mode 100644 index 0000000..0cd0e56 --- /dev/null +++ b/Tests/RunCMake/CommandLine/E_server-stderr.txt @@ -0,0 +1 @@ +^CMake Error: CMake server mode has been removed in favor of the file-api\.$ diff --git a/Tests/RunCMake/CommandLine/RunCMakeTest.cmake b/Tests/RunCMake/CommandLine/RunCMakeTest.cmake index b23c8c2..c438860 100644 --- a/Tests/RunCMake/CommandLine/RunCMakeTest.cmake +++ b/Tests/RunCMake/CommandLine/RunCMakeTest.cmake @@ -25,8 +25,7 @@ run_cmake_command(E_compare_files-ignore-eol-nonexistent ${CMAKE_COMMAND} -E com run_cmake_command(E_compare_files-invalid-arguments ${CMAKE_COMMAND} -E compare_files file1.txt file2.txt file3.txt) run_cmake_command(E_echo_append ${CMAKE_COMMAND} -E echo_append) run_cmake_command(E_rename-no-arg ${CMAKE_COMMAND} -E rename) -run_cmake_command(E_server-arg ${CMAKE_COMMAND} -E server --extra-arg) -run_cmake_command(E_server-pipe ${CMAKE_COMMAND} -E server --pipe=) +run_cmake_command(E_server ${CMAKE_COMMAND} -E server) run_cmake_command(E_true ${CMAKE_COMMAND} -E true) run_cmake_command(E_true-extraargs ${CMAKE_COMMAND} -E true ignored) run_cmake_command(E_false ${CMAKE_COMMAND} -E false) @@ -202,8 +201,8 @@ function(run_BuildDir) run_cmake_command(BuildDir--build--parallel-large ${CMAKE_COMMAND} -E chdir .. ${CMAKE_COMMAND} --build BuildDir-build --parallel 4294967293) - # No default jobs for Xcode and FreeBSD build command - if(NOT RunCMake_GENERATOR MATCHES "Xcode" AND NOT CMAKE_SYSTEM_NAME MATCHES "FreeBSD") + # No default jobs for FreeBSD build command + if(NOT CMAKE_SYSTEM_NAME MATCHES "FreeBSD") run_cmake_command(BuildDir--build-jobs-no-number ${CMAKE_COMMAND} -E chdir .. ${CMAKE_COMMAND} --build BuildDir-build -j) run_cmake_command(BuildDir--build-jobs-no-number-trailing--target ${CMAKE_COMMAND} -E chdir .. @@ -790,7 +789,7 @@ function(run_llvm_rc) "test.tmp was not deleted") endif() file(MAKE_DIRECTORY "${RunCMake_TEST_BINARY_DIR}/ExpandSourceDir") - run_cmake_command(llvm_rc_full_run ${CMAKE_COMMAND} -E cmake_llvm_rc ${RunCMake_TEST_BINARY_DIR}/ExpandSourceDir/source_file test.tmp ${CMAKE_COMMAND} -E echo "This is a test" ++ ${CMAKE_COMMAND} -E copy test.tmp SOURCE_DIR/llvmrc.result ) + run_cmake_command(llvm_rc_full_run ${CMAKE_COMMAND} -E cmake_llvm_rc ${RunCMake_TEST_BINARY_DIR}/ExpandSourceDir/source_file test.tmp ${CMAKE_COMMAND} -E echo "This is a test" ++ ${LLVM_RC} -bad /FO SOURCE_DIR/llvmrc.result test.tmp ) if(EXISTS ${RunCMake_TEST_BINARY_DIR}/ExpandSourceDir/test.tmp) message(SEND_ERROR "${test} - FAILED:\n" "test.tmp was not deleted") diff --git a/Tests/RunCMake/ExternalData/BadArguments-stderr.txt b/Tests/RunCMake/ExternalData/BadArguments-stderr.txt new file mode 100644 index 0000000..44efe7e --- /dev/null +++ b/Tests/RunCMake/ExternalData/BadArguments-stderr.txt @@ -0,0 +1,7 @@ +CMake Warning \(dev\) at .*/Modules/ExternalData.cmake:[0-9]+ \(message\): + Ignoring unrecognized arguments passed to ExternalData_add_target: + `UNKNOWN_ARGUMENT` +Call Stack \(most recent call first\): + BadArguments.cmake:[0-9]+ \(ExternalData_Add_Target\) + CMakeLists.txt:[0-9]+ \(include\) +This warning is for project developers. Use -Wno-dev to suppress it. diff --git a/Tests/RunCMake/ExternalData/BadArguments.cmake b/Tests/RunCMake/ExternalData/BadArguments.cmake new file mode 100644 index 0000000..dad0007 --- /dev/null +++ b/Tests/RunCMake/ExternalData/BadArguments.cmake @@ -0,0 +1,5 @@ +include(ExternalData) +set(ExternalData_URL_TEMPLATES + "file:///path/to/%(algo)/%(hash)" + ) +ExternalData_Add_Target(Data UNKNOWN_ARGUMENT) diff --git a/Tests/RunCMake/ExternalData/RunCMakeTest.cmake b/Tests/RunCMake/ExternalData/RunCMakeTest.cmake index b5ab22d..b4cc95e 100644 --- a/Tests/RunCMake/ExternalData/RunCMakeTest.cmake +++ b/Tests/RunCMake/ExternalData/RunCMakeTest.cmake @@ -2,6 +2,7 @@ include(RunCMake) run_cmake(BadAlgoMap1) run_cmake(BadAlgoMap2) +run_cmake(BadArguments) run_cmake(BadCustom1) run_cmake(BadCustom2) run_cmake(BadCustom3) diff --git a/Tests/RunCMake/GeneratorExpression/RunCMakeTest.cmake b/Tests/RunCMake/GeneratorExpression/RunCMakeTest.cmake index 6349112..edeb6bd 100644 --- a/Tests/RunCMake/GeneratorExpression/RunCMakeTest.cmake +++ b/Tests/RunCMake/GeneratorExpression/RunCMakeTest.cmake @@ -35,6 +35,9 @@ run_cmake(TARGET_NAME_IF_EXISTS-no-arg) run_cmake(TARGET_NAME_IF_EXISTS-empty-arg) run_cmake(TARGET_NAME_IF_EXISTS) run_cmake(TARGET_NAME_IF_EXISTS-not-a-target) +run_cmake(TARGET_NAME_IF_EXISTS-alias-target) +run_cmake(TARGET_NAME_IF_EXISTS-imported-target) +run_cmake(TARGET_NAME_IF_EXISTS-imported-global-target) run_cmake(REMOVE_DUPLICATES-empty) run_cmake(REMOVE_DUPLICATES-1) run_cmake(REMOVE_DUPLICATES-2) diff --git a/Tests/RunCMake/GeneratorExpression/TARGET_NAME_IF_EXISTS-alias-target-check.cmake b/Tests/RunCMake/GeneratorExpression/TARGET_NAME_IF_EXISTS-alias-target-check.cmake new file mode 100644 index 0000000..8ae2ecc --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/TARGET_NAME_IF_EXISTS-alias-target-check.cmake @@ -0,0 +1,5 @@ +file(READ "${RunCMake_TEST_BINARY_DIR}/TARGET_NAME_IF_EXISTS-generated-alias.txt" content) + +if(NOT content STREQUAL aliasTarget) + set(RunCMake_TEST_FAILED "actual content:\n ${content}\nbut expected [[aliasTarget]]") +endif() diff --git a/Tests/RunCMake/GeneratorExpression/TARGET_NAME_IF_EXISTS-alias-target.cmake b/Tests/RunCMake/GeneratorExpression/TARGET_NAME_IF_EXISTS-alias-target.cmake new file mode 100644 index 0000000..d3ef0f8 --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/TARGET_NAME_IF_EXISTS-alias-target.cmake @@ -0,0 +1,8 @@ +enable_language(CXX) + +file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/dummy_executable.cpp" "int main(int,char**) { return 0; }\n") +add_executable(executableTarget "${CMAKE_CURRENT_BINARY_DIR}/dummy_executable.cpp") +add_executable(aliasTarget ALIAS executableTarget) + +cmake_policy(SET CMP0070 NEW) +file(GENERATE OUTPUT TARGET_NAME_IF_EXISTS-generated-alias.txt CONTENT "$<TARGET_NAME_IF_EXISTS:aliasTarget>") diff --git a/Tests/RunCMake/GeneratorExpression/TARGET_NAME_IF_EXISTS-imported-global-target-check.cmake b/Tests/RunCMake/GeneratorExpression/TARGET_NAME_IF_EXISTS-imported-global-target-check.cmake new file mode 100644 index 0000000..b14c9e1 --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/TARGET_NAME_IF_EXISTS-imported-global-target-check.cmake @@ -0,0 +1,5 @@ +file(READ "${RunCMake_TEST_BINARY_DIR}/TARGET_NAME_IF_EXISTS-generated-imported-global.txt" content) + +if(NOT content STREQUAL importedGlobalTarget) + set(RunCMake_TEST_FAILED "actual content:\n ${content}\nbut expected [[importedGlobalTarget]]") +endif() diff --git a/Tests/RunCMake/GeneratorExpression/TARGET_NAME_IF_EXISTS-imported-global-target.cmake b/Tests/RunCMake/GeneratorExpression/TARGET_NAME_IF_EXISTS-imported-global-target.cmake new file mode 100644 index 0000000..b685558 --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/TARGET_NAME_IF_EXISTS-imported-global-target.cmake @@ -0,0 +1,4 @@ +add_executable(importedGlobalTarget IMPORTED GLOBAL) + +cmake_policy(SET CMP0070 NEW) +file(GENERATE OUTPUT TARGET_NAME_IF_EXISTS-generated-imported-global.txt CONTENT "$<TARGET_NAME_IF_EXISTS:importedGlobalTarget>") diff --git a/Tests/RunCMake/GeneratorExpression/TARGET_NAME_IF_EXISTS-imported-target-check.cmake b/Tests/RunCMake/GeneratorExpression/TARGET_NAME_IF_EXISTS-imported-target-check.cmake new file mode 100644 index 0000000..9615893 --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/TARGET_NAME_IF_EXISTS-imported-target-check.cmake @@ -0,0 +1,5 @@ +file(READ "${RunCMake_TEST_BINARY_DIR}/TARGET_NAME_IF_EXISTS-generated-imported.txt" content) + +if(NOT content STREQUAL importedTarget) + set(RunCMake_TEST_FAILED "actual content:\n ${content}\nbut expected [[importedTarget]]") +endif() diff --git a/Tests/RunCMake/GeneratorExpression/TARGET_NAME_IF_EXISTS-imported-target.cmake b/Tests/RunCMake/GeneratorExpression/TARGET_NAME_IF_EXISTS-imported-target.cmake new file mode 100644 index 0000000..2008907 --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/TARGET_NAME_IF_EXISTS-imported-target.cmake @@ -0,0 +1,4 @@ +add_executable(importedTarget IMPORTED) + +cmake_policy(SET CMP0070 NEW) +file(GENERATE OUTPUT TARGET_NAME_IF_EXISTS-generated-imported.txt CONTENT "$<TARGET_NAME_IF_EXISTS:importedTarget>") diff --git a/Tests/RunCMake/Syntax/FunctionUnmatched-stderr.txt b/Tests/RunCMake/Syntax/FunctionUnmatched-stderr.txt index 306c255..87fa746 100644 --- a/Tests/RunCMake/Syntax/FunctionUnmatched-stderr.txt +++ b/Tests/RunCMake/Syntax/FunctionUnmatched-stderr.txt @@ -1,8 +1,4 @@ -^CMake Error in FunctionUnmatched.cmake: - A logical block opening on the line - - .*/Tests/RunCMake/Syntax/FunctionUnmatched.cmake:[0-9]+ \(function\) - - is not closed. +^CMake Error at FunctionUnmatched\.cmake:[0-9]+ \(function\): + Flow control statements are not properly nested\. Call Stack \(most recent call first\): - CMakeLists.txt:[0-9]+ \(include\)$ + CMakeLists\.txt:[0-9]+ \(include\)$ diff --git a/Tests/RunCMake/Syntax/FunctionUnmatchedForeach-stderr.txt b/Tests/RunCMake/Syntax/FunctionUnmatchedForeach-stderr.txt index f4ff709..7904b87 100644 --- a/Tests/RunCMake/Syntax/FunctionUnmatchedForeach-stderr.txt +++ b/Tests/RunCMake/Syntax/FunctionUnmatchedForeach-stderr.txt @@ -1,8 +1,4 @@ -^CMake Error at FunctionUnmatchedForeach.cmake:[0-9]+ \(f\): - A logical block opening on the line - - .*/Tests/RunCMake/Syntax/FunctionUnmatchedForeach.cmake:[0-9]+ \(foreach\) - - is not closed. +^CMake Error at FunctionUnmatchedForeach\.cmake:[0-9]+ \(endfunction\): + Flow control statements are not properly nested\. Call Stack \(most recent call first\): - CMakeLists.txt:[0-9]+ \(include\)$ + CMakeLists\.txt:[0-9]+ \(include\)$ diff --git a/Tests/RunCMake/Syntax/ImproperNesting-result.txt b/Tests/RunCMake/Syntax/ImproperNesting-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/Syntax/ImproperNesting-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/Syntax/ImproperNesting-stderr.txt b/Tests/RunCMake/Syntax/ImproperNesting-stderr.txt new file mode 100644 index 0000000..a209ef6 --- /dev/null +++ b/Tests/RunCMake/Syntax/ImproperNesting-stderr.txt @@ -0,0 +1,4 @@ +^CMake Error at ImproperNesting\.cmake:[0-9]+ \(endforeach\): + Flow control statements are not properly nested\. +Call Stack \(most recent call first\): + CMakeLists\.txt:[0-9]+ \(include\)$ diff --git a/Tests/RunCMake/Syntax/ImproperNesting.cmake b/Tests/RunCMake/Syntax/ImproperNesting.cmake new file mode 100644 index 0000000..47ff9f9 --- /dev/null +++ b/Tests/RunCMake/Syntax/ImproperNesting.cmake @@ -0,0 +1,7 @@ +message(FATAL_ERROR "This should not happen") + +foreach(i 1 2) + if(1) +endforeach() +endif() +endif() diff --git a/Tests/RunCMake/Syntax/MacroUnmatched-stderr.txt b/Tests/RunCMake/Syntax/MacroUnmatched-stderr.txt index 440d863..a7af590 100644 --- a/Tests/RunCMake/Syntax/MacroUnmatched-stderr.txt +++ b/Tests/RunCMake/Syntax/MacroUnmatched-stderr.txt @@ -1,8 +1,4 @@ -^CMake Error in MacroUnmatched.cmake: - A logical block opening on the line - - .*/Tests/RunCMake/Syntax/MacroUnmatched.cmake:[0-9]+ \(macro\) - - is not closed. +^CMake Error at MacroUnmatched\.cmake:[0-9]+ \(macro\): + Flow control statements are not properly nested\. Call Stack \(most recent call first\): - CMakeLists.txt:[0-9]+ \(include\)$ + CMakeLists\.txt:[0-9]+ \(include\)$ diff --git a/Tests/RunCMake/Syntax/MacroUnmatchedForeach-stderr.txt b/Tests/RunCMake/Syntax/MacroUnmatchedForeach-stderr.txt index 820cd2e..30c4a4c 100644 --- a/Tests/RunCMake/Syntax/MacroUnmatchedForeach-stderr.txt +++ b/Tests/RunCMake/Syntax/MacroUnmatchedForeach-stderr.txt @@ -1,8 +1,4 @@ -^CMake Error at MacroUnmatchedForeach.cmake:[0-9]+ \(m\): - A logical block opening on the line - - .*/Tests/RunCMake/Syntax/MacroUnmatchedForeach.cmake:[0-9]+ \(foreach\) - - is not closed. +^CMake Error at MacroUnmatchedForeach\.cmake:[0-9]+ \(endmacro\): + Flow control statements are not properly nested\. Call Stack \(most recent call first\): - CMakeLists.txt:[0-9]+ \(include\)$ + CMakeLists\.txt:[0-9]+ \(include\)$ diff --git a/Tests/RunCMake/Syntax/Override.cmake b/Tests/RunCMake/Syntax/Override.cmake new file mode 100644 index 0000000..af62db1 --- /dev/null +++ b/Tests/RunCMake/Syntax/Override.cmake @@ -0,0 +1,6 @@ +function(override) + function(${FUNCTION_NAME}) + endfunction() +endfunction() +override() +message(FATAL_ERROR "This shouldn't happen") diff --git a/Tests/RunCMake/Syntax/OverrideBreak-result.txt b/Tests/RunCMake/Syntax/OverrideBreak-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/Syntax/OverrideBreak-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/Syntax/OverrideContinue-result.txt b/Tests/RunCMake/Syntax/OverrideContinue-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/Syntax/OverrideContinue-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/Syntax/OverrideElse-result.txt b/Tests/RunCMake/Syntax/OverrideElse-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/Syntax/OverrideElse-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/Syntax/OverrideElseIf-result.txt b/Tests/RunCMake/Syntax/OverrideElseIf-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/Syntax/OverrideElseIf-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/Syntax/OverrideEndForeach-result.txt b/Tests/RunCMake/Syntax/OverrideEndForeach-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/Syntax/OverrideEndForeach-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/Syntax/OverrideEndFunction-result.txt b/Tests/RunCMake/Syntax/OverrideEndFunction-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/Syntax/OverrideEndFunction-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/Syntax/OverrideEndIf-result.txt b/Tests/RunCMake/Syntax/OverrideEndIf-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/Syntax/OverrideEndIf-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/Syntax/OverrideEndMacro-result.txt b/Tests/RunCMake/Syntax/OverrideEndMacro-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/Syntax/OverrideEndMacro-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/Syntax/OverrideEndWhile-result.txt b/Tests/RunCMake/Syntax/OverrideEndWhile-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/Syntax/OverrideEndWhile-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/Syntax/OverrideForeach-result.txt b/Tests/RunCMake/Syntax/OverrideForeach-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/Syntax/OverrideForeach-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/Syntax/OverrideFunction-result.txt b/Tests/RunCMake/Syntax/OverrideFunction-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/Syntax/OverrideFunction-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/Syntax/OverrideIf-result.txt b/Tests/RunCMake/Syntax/OverrideIf-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/Syntax/OverrideIf-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/Syntax/OverrideMacro-result.txt b/Tests/RunCMake/Syntax/OverrideMacro-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/Syntax/OverrideMacro-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/Syntax/OverrideReturn-result.txt b/Tests/RunCMake/Syntax/OverrideReturn-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/Syntax/OverrideReturn-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/Syntax/OverrideWhile-result.txt b/Tests/RunCMake/Syntax/OverrideWhile-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/Syntax/OverrideWhile-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/Syntax/RunCMakeTest.cmake b/Tests/RunCMake/Syntax/RunCMakeTest.cmake index 8d74dc1..4d24657 100644 --- a/Tests/RunCMake/Syntax/RunCMakeTest.cmake +++ b/Tests/RunCMake/Syntax/RunCMakeTest.cmake @@ -72,6 +72,7 @@ run_cmake(UnterminatedBrace2) run_cmake(UnterminatedBracket0) run_cmake(UnterminatedBracket1) run_cmake(UnterminatedBracketComment) +run_cmake(ImproperNesting) # Variable expansion tests run_cmake(ExpandInAt) @@ -122,3 +123,30 @@ run_cmake(FunctionUnmatched) run_cmake(FunctionUnmatchedForeach) run_cmake(MacroUnmatched) run_cmake(MacroUnmatchedForeach) + +function(run_override name) + string(TOLOWER "${name}" lname) + set(RunCMake_DEFAULT_stderr "^CMake Error at [^ +]*/Tests/RunCMake/Syntax/Override\\.cmake:[0-9]+ \\(function\\): + Built-in flow control command \"${lname}\" cannot be overridden\\. +Call Stack \\(most recent call first\\): + [^ +]*/Tests/RunCMake/Syntax/Override\\.cmake:[0-9]+ \\(override\\)$") + run_cmake_command(Override${name} "${CMAKE_COMMAND}" -DFUNCTION_NAME=${name} -P "${RunCMake_SOURCE_DIR}/Override.cmake") +endfunction() + +run_override(Break) +run_override(Continue) +run_override(Else) +run_override(ElseIf) +run_override(EndForeach) +run_override(EndFunction) +run_override(EndIf) +run_override(EndMacro) +run_override(EndWhile) +run_override(Foreach) +run_override(Function) +run_override(If) +run_override(Macro) +run_override(Return) +run_override(While) diff --git a/Tests/RunCMake/TargetSources/AddCustomTargetCheckProperty.cmake b/Tests/RunCMake/TargetSources/AddCustomTargetCheckProperty.cmake new file mode 100644 index 0000000..1787e87 --- /dev/null +++ b/Tests/RunCMake/TargetSources/AddCustomTargetCheckProperty.cmake @@ -0,0 +1,16 @@ +add_custom_target(target1 ALL) +target_sources(target1 PRIVATE main.cpp) +get_property(actualProp1 TARGET target1 PROPERTY SOURCES) +set(desiredProp1 main.cpp) +if(NOT desiredProp1 STREQUAL actualProp1) + message("source property not set. desired: \"${desiredProp1}\" actual: \"${actualProp1}\"") +endif() + +add_custom_target(target2 ALL SOURCES main.cpp) +target_sources(target2 PRIVATE empty_1.cpp empty_2.cpp) +target_sources(target2 PRIVATE empty_3.cpp) +get_property(actualProp2 TARGET target2 PROPERTY SOURCES) +set(desiredProp2 main.cpp empty_1.cpp empty_2.cpp empty_3.cpp) +if (NOT desiredProp2 STREQUAL actualProp2) + message("source property not set. desired: \"${desiredProp2}\" actual: \"${actualProp2}\"") +endif() diff --git a/Tests/RunCMake/TargetSources/AddCustomTargetGenx.cmake b/Tests/RunCMake/TargetSources/AddCustomTargetGenx.cmake new file mode 100644 index 0000000..0078eab --- /dev/null +++ b/Tests/RunCMake/TargetSources/AddCustomTargetGenx.cmake @@ -0,0 +1,2 @@ +add_custom_target(target ALL) +target_sources(target PRIVATE $<IF:1,${CMAKE_CURRENT_LIST_DIR}/main.cpp,${CMAKE_CURRENT_LIST_DIR}/empty_1.cpp>) diff --git a/Tests/RunCMake/TargetSources/AddCustomTargetInterfaceSources-result.txt b/Tests/RunCMake/TargetSources/AddCustomTargetInterfaceSources-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/TargetSources/AddCustomTargetInterfaceSources-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/TargetSources/AddCustomTargetInterfaceSources-stderr.txt b/Tests/RunCMake/TargetSources/AddCustomTargetInterfaceSources-stderr.txt new file mode 100644 index 0000000..9334bf6 --- /dev/null +++ b/Tests/RunCMake/TargetSources/AddCustomTargetInterfaceSources-stderr.txt @@ -0,0 +1,4 @@ +CMake Error at AddCustomTargetInterfaceSources.cmake:2 \(target_sources\): + target_sources may only set PRIVATE properties on custom targets +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/TargetSources/AddCustomTargetInterfaceSources.cmake b/Tests/RunCMake/TargetSources/AddCustomTargetInterfaceSources.cmake new file mode 100644 index 0000000..42a8ca2 --- /dev/null +++ b/Tests/RunCMake/TargetSources/AddCustomTargetInterfaceSources.cmake @@ -0,0 +1,2 @@ +add_custom_target(target ALL) +target_sources(target INTERFACE main.cpp) diff --git a/Tests/RunCMake/TargetSources/AddCustomTargetPrivateSources.cmake b/Tests/RunCMake/TargetSources/AddCustomTargetPrivateSources.cmake new file mode 100644 index 0000000..11f0258 --- /dev/null +++ b/Tests/RunCMake/TargetSources/AddCustomTargetPrivateSources.cmake @@ -0,0 +1,2 @@ +add_custom_target(target ALL) +target_sources(target PRIVATE main.cpp) diff --git a/Tests/RunCMake/TargetSources/AddCustomTargetPublicSources-result.txt b/Tests/RunCMake/TargetSources/AddCustomTargetPublicSources-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/TargetSources/AddCustomTargetPublicSources-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/TargetSources/AddCustomTargetPublicSources-stderr.txt b/Tests/RunCMake/TargetSources/AddCustomTargetPublicSources-stderr.txt new file mode 100644 index 0000000..afba4be --- /dev/null +++ b/Tests/RunCMake/TargetSources/AddCustomTargetPublicSources-stderr.txt @@ -0,0 +1,4 @@ +CMake Error at AddCustomTargetPublicSources.cmake:2 \(target_sources\): + target_sources may only set PRIVATE properties on custom targets +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/TargetSources/AddCustomTargetPublicSources.cmake b/Tests/RunCMake/TargetSources/AddCustomTargetPublicSources.cmake new file mode 100644 index 0000000..d9e82c0 --- /dev/null +++ b/Tests/RunCMake/TargetSources/AddCustomTargetPublicSources.cmake @@ -0,0 +1,2 @@ +add_custom_target(target ALL) +target_sources(target PUBLIC main.cpp) diff --git a/Tests/RunCMake/TargetSources/AddCustomTargetSources-result.txt b/Tests/RunCMake/TargetSources/AddCustomTargetSources-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/TargetSources/AddCustomTargetSources-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/TargetSources/AddCustomTargetSources-stderr.txt b/Tests/RunCMake/TargetSources/AddCustomTargetSources-stderr.txt new file mode 100644 index 0000000..4a153e9 --- /dev/null +++ b/Tests/RunCMake/TargetSources/AddCustomTargetSources-stderr.txt @@ -0,0 +1,4 @@ +CMake Error at AddCustomTargetSources.cmake:2 \(target_sources\): + target_sources called with invalid arguments +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/TargetSources/AddCustomTargetSources.cmake b/Tests/RunCMake/TargetSources/AddCustomTargetSources.cmake new file mode 100644 index 0000000..dd688d3 --- /dev/null +++ b/Tests/RunCMake/TargetSources/AddCustomTargetSources.cmake @@ -0,0 +1,2 @@ +add_custom_target(target ALL) +target_sources(target main.cpp) diff --git a/Tests/RunCMake/TargetSources/RunCMakeTest.cmake b/Tests/RunCMake/TargetSources/RunCMakeTest.cmake index 0d462ba..b56ee44 100644 --- a/Tests/RunCMake/TargetSources/RunCMakeTest.cmake +++ b/Tests/RunCMake/TargetSources/RunCMakeTest.cmake @@ -14,3 +14,9 @@ run_cmake(RelativePathInSubdirInterface) run_cmake(RelativePathInSubdirPrivate) run_cmake(RelativePathInSubdirInclude) run_cmake(ExportBuild) +run_cmake(AddCustomTargetPublicSources) +run_cmake(AddCustomTargetPrivateSources) +run_cmake(AddCustomTargetInterfaceSources) +run_cmake(AddCustomTargetSources) +run_cmake(AddCustomTargetCheckProperty) +run_cmake(AddCustomTargetGenx) diff --git a/Tests/RunCMake/ToolchainFile/CheckLanguage-stdout.txt b/Tests/RunCMake/ToolchainFile/CheckLanguage-stdout.txt new file mode 100644 index 0000000..b96eee6 --- /dev/null +++ b/Tests/RunCMake/ToolchainFile/CheckLanguage-stdout.txt @@ -0,0 +1 @@ +-- Looking for a C compiler - NOTFOUND diff --git a/Tests/RunCMake/ToolchainFile/CheckLanguage-toolchain.cmake b/Tests/RunCMake/ToolchainFile/CheckLanguage-toolchain.cmake new file mode 100644 index 0000000..081f905 --- /dev/null +++ b/Tests/RunCMake/ToolchainFile/CheckLanguage-toolchain.cmake @@ -0,0 +1,4 @@ +get_property(in_try_compile GLOBAL PROPERTY IN_TRY_COMPILE) +if(in_try_compile) + message(FATAL_ERROR "Toolchain file included") +endif() diff --git a/Tests/RunCMake/ToolchainFile/CheckLanguage.cmake b/Tests/RunCMake/ToolchainFile/CheckLanguage.cmake new file mode 100644 index 0000000..854b3d4 --- /dev/null +++ b/Tests/RunCMake/ToolchainFile/CheckLanguage.cmake @@ -0,0 +1,2 @@ +include(CheckLanguage) +check_language(C) diff --git a/Tests/RunCMake/ToolchainFile/RunCMakeTest.cmake b/Tests/RunCMake/ToolchainFile/RunCMakeTest.cmake index 7eb4485..659523c 100644 --- a/Tests/RunCMake/ToolchainFile/RunCMakeTest.cmake +++ b/Tests/RunCMake/ToolchainFile/RunCMakeTest.cmake @@ -7,6 +7,7 @@ endfunction() run_cmake_toolchain(CallEnableLanguage) run_cmake_toolchain(CallProject) +run_cmake_toolchain(CheckLanguage) run_cmake_toolchain(FlagsInit) run_cmake_toolchain(LinkFlagsInit) diff --git a/Tests/RunCMake/TransformDepfile/RunCMakeTest.cmake b/Tests/RunCMake/TransformDepfile/RunCMakeTest.cmake new file mode 100644 index 0000000..cb75eb0 --- /dev/null +++ b/Tests/RunCMake/TransformDepfile/RunCMakeTest.cmake @@ -0,0 +1,21 @@ +include(RunCMake) + +function(run_transform_depfile name) + set(RunCMake-check-file gccdepfile.cmake) + run_cmake_command(${name}-gcc + ${CMAKE_COMMAND} -E cmake_transform_depfile gccdepfile ../ ${CMAKE_CURRENT_LIST_DIR}/${name}.d out.d + ) + set(RunCMake-check-file vstlog.cmake) + run_cmake_command(${name}-tlog + ${CMAKE_COMMAND} -E cmake_transform_depfile vstlog ../ ${CMAKE_CURRENT_LIST_DIR}/${name}.d out.tlog + ) +endfunction() + +if(WIN32) + run_transform_depfile(deps-windows) +else() + run_transform_depfile(deps-unix) +endif() +run_transform_depfile(noexist) +run_transform_depfile(empty) +run_transform_depfile(invalid) diff --git a/Tests/RunCMake/TransformDepfile/deps-unix.d b/Tests/RunCMake/TransformDepfile/deps-unix.d new file mode 100644 index 0000000..5da5be8 --- /dev/null +++ b/Tests/RunCMake/TransformDepfile/deps-unix.d @@ -0,0 +1,6 @@ +out1 /home/build/out2: in1 /home/build/in2 + +out3 \ + /home/build/out4: \ + in3 \ + /home/build/in4 diff --git a/Tests/RunCMake/TransformDepfile/deps-unix.d.txt b/Tests/RunCMake/TransformDepfile/deps-unix.d.txt new file mode 100644 index 0000000..58770f2 --- /dev/null +++ b/Tests/RunCMake/TransformDepfile/deps-unix.d.txt @@ -0,0 +1,8 @@ +../out1 \ + /home/build/out2: \ + ../in1 \ + /home/build/in2 +../out3 \ + /home/build/out4: \ + ../in3 \ + /home/build/in4 diff --git a/Tests/RunCMake/TransformDepfile/deps-unix.tlog.txt b/Tests/RunCMake/TransformDepfile/deps-unix.tlog.txt new file mode 100644 index 0000000..2a26edf --- /dev/null +++ b/Tests/RunCMake/TransformDepfile/deps-unix.tlog.txt @@ -0,0 +1,6 @@ +^../out1|/home/build/out2 +../in1 +/home/build/in2 +^../out3|/home/build/out4 +../in3 +/home/build/in4 diff --git a/Tests/RunCMake/TransformDepfile/deps-windows.d b/Tests/RunCMake/TransformDepfile/deps-windows.d new file mode 100644 index 0000000..c926670 --- /dev/null +++ b/Tests/RunCMake/TransformDepfile/deps-windows.d @@ -0,0 +1,6 @@ +out1 C:/build/out2: in1 C:/build/in2 + +out3 \ + C:/build/out4: \ + in3 \ + C:/build/in4 diff --git a/Tests/RunCMake/TransformDepfile/deps-windows.d.txt b/Tests/RunCMake/TransformDepfile/deps-windows.d.txt new file mode 100644 index 0000000..47b3ebf --- /dev/null +++ b/Tests/RunCMake/TransformDepfile/deps-windows.d.txt @@ -0,0 +1,8 @@ +../out1 \ + C:/build/out2: \ + ../in1 \ + C:/build/in2 +../out3 \ + C:/build/out4: \ + ../in3 \ + C:/build/in4 diff --git a/Tests/RunCMake/TransformDepfile/deps-windows.tlog.txt b/Tests/RunCMake/TransformDepfile/deps-windows.tlog.txt new file mode 100644 index 0000000..1e6024d --- /dev/null +++ b/Tests/RunCMake/TransformDepfile/deps-windows.tlog.txt @@ -0,0 +1,6 @@ +^..\out1|C:\build\out2 +..\in1 +C:\build\in2 +^..\out3|C:\build\out4 +..\in3 +C:\build\in4 diff --git a/Tests/RunCMake/TransformDepfile/empty.d b/Tests/RunCMake/TransformDepfile/empty.d new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/Tests/RunCMake/TransformDepfile/empty.d diff --git a/Tests/RunCMake/TransformDepfile/empty.d.txt b/Tests/RunCMake/TransformDepfile/empty.d.txt new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/Tests/RunCMake/TransformDepfile/empty.d.txt diff --git a/Tests/RunCMake/TransformDepfile/empty.tlog.txt b/Tests/RunCMake/TransformDepfile/empty.tlog.txt new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/Tests/RunCMake/TransformDepfile/empty.tlog.txt diff --git a/Tests/RunCMake/TransformDepfile/gccdepfile.cmake b/Tests/RunCMake/TransformDepfile/gccdepfile.cmake new file mode 100644 index 0000000..be1e210 --- /dev/null +++ b/Tests/RunCMake/TransformDepfile/gccdepfile.cmake @@ -0,0 +1,16 @@ +if(EXISTS "${RunCMake_SOURCE_DIR}/${name}.d.txt") + file(READ "${RunCMake_SOURCE_DIR}/${name}.d.txt" expected_contents) + + if(EXISTS "${RunCMake_TEST_BINARY_DIR}/out.d") + file(READ "${RunCMake_TEST_BINARY_DIR}/out.d" actual_contents) + if(NOT actual_contents STREQUAL expected_contents) + string(REPLACE "\n" "\n " p_expected_contents "${expected_contents}") + string(REPLACE "\n" "\n " p_actual_contents "${actual_contents}") + string(APPEND RunCMake_TEST_FAILED "Expected contents of ${RunCMake_TEST_BINARY_DIR}/out.d:\n ${p_expected_contents}\nActual contents:\n ${p_actual_contents}") + endif() + else() + string(APPEND RunCMake_TEST_FAILED "${RunCMake_TEST_BINARY_DIR}/out.d should exist\n") + endif() +elseif(EXISTS "${RunCMake_TEST_BINARY_DIR}/out.d") + string(APPEND RunCMake_TEST_FAILED "${RunCMake_TEST_BINARY_DIR}/out.d should not exist\n") +endif() diff --git a/Tests/RunCMake/TransformDepfile/invalid-gcc-result.txt b/Tests/RunCMake/TransformDepfile/invalid-gcc-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/TransformDepfile/invalid-gcc-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/TransformDepfile/invalid-tlog-result.txt b/Tests/RunCMake/TransformDepfile/invalid-tlog-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/TransformDepfile/invalid-tlog-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/TransformDepfile/invalid.d b/Tests/RunCMake/TransformDepfile/invalid.d new file mode 100644 index 0000000..9977a28 --- /dev/null +++ b/Tests/RunCMake/TransformDepfile/invalid.d @@ -0,0 +1 @@ +invalid diff --git a/Tests/RunCMake/TransformDepfile/noexist.d.txt b/Tests/RunCMake/TransformDepfile/noexist.d.txt new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/Tests/RunCMake/TransformDepfile/noexist.d.txt diff --git a/Tests/RunCMake/TransformDepfile/noexist.tlog.txt b/Tests/RunCMake/TransformDepfile/noexist.tlog.txt new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/Tests/RunCMake/TransformDepfile/noexist.tlog.txt diff --git a/Tests/RunCMake/TransformDepfile/vstlog.cmake b/Tests/RunCMake/TransformDepfile/vstlog.cmake new file mode 100644 index 0000000..afa78d0 --- /dev/null +++ b/Tests/RunCMake/TransformDepfile/vstlog.cmake @@ -0,0 +1,16 @@ +if(EXISTS "${RunCMake_SOURCE_DIR}/${name}.tlog.txt") + file(READ "${RunCMake_SOURCE_DIR}/${name}.tlog.txt" expected_contents) + + if(EXISTS "${RunCMake_TEST_BINARY_DIR}/out.tlog") + file(READ "${RunCMake_TEST_BINARY_DIR}/out.tlog" actual_contents) + if(NOT actual_contents STREQUAL expected_contents) + string(REPLACE "\n" "\n " p_expected_contents "${expected_contents}") + string(REPLACE "\n" "\n " p_actual_contents "${actual_contents}") + string(APPEND RunCMake_TEST_FAILED "Expected contents of ${RunCMake_TEST_BINARY_DIR}/out.tlog:\n ${p_expected_contents}\nActual contents:\n ${p_actual_contents}") + endif() + else() + string(APPEND RunCMake_TEST_FAILED "${RunCMake_TEST_BINARY_DIR}/out.tlog should exist\n") + endif() +elseif(EXISTS "${RunCMake_TEST_BINARY_DIR}/out.tlog") + string(APPEND RunCMake_TEST_FAILED "${RunCMake_TEST_BINARY_DIR}/out.tlog should not exist\n") +endif() diff --git a/Tests/RunCMake/add_custom_command/AppendNotOutput-stderr.txt b/Tests/RunCMake/add_custom_command/AppendNotOutput-stderr.txt index b7ee23a..9324302 100644 --- a/Tests/RunCMake/add_custom_command/AppendNotOutput-stderr.txt +++ b/Tests/RunCMake/add_custom_command/AppendNotOutput-stderr.txt @@ -1,5 +1,5 @@ CMake Error at AppendNotOutput.cmake:1 \(add_custom_command\): - add_custom_command given APPEND option with output + Attempt to APPEND to custom command with output .*RunCMake/add_custom_command/AppendNotOutput-build/out diff --git a/Tests/RunCMake/add_library/CMP0073-stderr.txt b/Tests/RunCMake/add_library/CMP0073-stderr.txt new file mode 100644 index 0000000..7f43fd7 --- /dev/null +++ b/Tests/RunCMake/add_library/CMP0073-stderr.txt @@ -0,0 +1,10 @@ +^CMake Deprecation Warning at CMP0073.cmake:[0-9]+ \(cmake_policy\): + The OLD behavior for policy CMP0073 will be removed from a future version + of CMake. + + The cmake-policies\(7\) manual explains that the OLD behaviors of all + policies are deprecated and that a policy should be set to OLD only under + specific short-term circumstances. Projects should be ported to the NEW + behavior and not rely on setting a policy to OLD. +Call Stack \(most recent call first\): + CMakeLists.txt:[0-9]+ \(include\)$ diff --git a/Tests/RunCMake/configure_file/RunCMakeTest.cmake b/Tests/RunCMake/configure_file/RunCMakeTest.cmake index 71694fb..0a2e3f9 100644 --- a/Tests/RunCMake/configure_file/RunCMakeTest.cmake +++ b/Tests/RunCMake/configure_file/RunCMakeTest.cmake @@ -16,6 +16,13 @@ run_cmake(NewLineStyle-WrongArg) run_cmake(NewLineStyle-ValidArg) run_cmake(NewLineStyle-COPYONLY) run_cmake(NoSourcePermissions) +run_cmake(SourcePermissionsInvalidArg-1) +run_cmake(SourcePermissionsInvalidArg-2) +run_cmake(SourcePermissionsInvalidArg-3) +run_cmake(SourcePermissionsInvalidArg-4) +run_cmake(SourcePermissionsInvalidArg-5) +run_cmake(UseSourcePermissions) +run_cmake(SourcePermissions) if(RunCMake_GENERATOR MATCHES "Make") # Use a single build tree for a few tests without cleaning. diff --git a/Tests/RunCMake/configure_file/SourcePermissions-result.txt b/Tests/RunCMake/configure_file/SourcePermissions-result.txt new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/Tests/RunCMake/configure_file/SourcePermissions-result.txt diff --git a/Tests/RunCMake/configure_file/SourcePermissions-stderr.txt b/Tests/RunCMake/configure_file/SourcePermissions-stderr.txt new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/Tests/RunCMake/configure_file/SourcePermissions-stderr.txt diff --git a/Tests/RunCMake/configure_file/SourcePermissions.cmake b/Tests/RunCMake/configure_file/SourcePermissions.cmake new file mode 100644 index 0000000..50330fc --- /dev/null +++ b/Tests/RunCMake/configure_file/SourcePermissions.cmake @@ -0,0 +1,34 @@ +configure_file(${CMAKE_CURRENT_SOURCE_DIR}/sourcefile.txt + ${CMAKE_CURRENT_BINARY_DIR}/sourcefile-source-permissions.txt + FILE_PERMISSIONS + OWNER_READ OWNER_EXECUTE + GROUP_READ GROUP_EXECUTE + WORLD_READ +) + +if (UNIX) + find_program(STAT_EXECUTABLE NAMES stat) + if(NOT STAT_EXECUTABLE) + return() + endif() + + if (CMAKE_SYSTEM_NAME MATCHES "FreeBSD") + execute_process(COMMAND "${STAT_EXECUTABLE}" -f %Lp "${CMAKE_CURRENT_BINARY_DIR}/sourcefile-source-permissions.txt" + OUTPUT_VARIABLE output + ) + elseif(CMAKE_SYSTEM_NAME MATCHES "Darwin") + execute_process(COMMAND "${STAT_EXECUTABLE}" -f %A "${CMAKE_CURRENT_BINARY_DIR}/sourcefile-source-permissions.txt" + OUTPUT_VARIABLE output + ) + else() + execute_process(COMMAND "${STAT_EXECUTABLE}" -c %a "${CMAKE_CURRENT_BINARY_DIR}/sourcefile-source-permissions.txt" + OUTPUT_VARIABLE output + ) + endif() + + if (NOT output EQUAL "554") + message(FATAL_ERROR "configure file has different permissions than " + "desired, generated permissions: ${output}") + endif() + +endif() diff --git a/Tests/RunCMake/configure_file/SourcePermissionsInvalidArg-1-result.txt b/Tests/RunCMake/configure_file/SourcePermissionsInvalidArg-1-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/configure_file/SourcePermissionsInvalidArg-1-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/configure_file/SourcePermissionsInvalidArg-1-stderr.txt b/Tests/RunCMake/configure_file/SourcePermissionsInvalidArg-1-stderr.txt new file mode 100644 index 0000000..d483d34 --- /dev/null +++ b/Tests/RunCMake/configure_file/SourcePermissionsInvalidArg-1-stderr.txt @@ -0,0 +1,5 @@ +CMake Error at SourcePermissionsInvalidArg-1.cmake:1 \(configure_file\): + configure_file given both USE_SOURCE_PERMISSIONS and NO_SOURCE_PERMISSIONS. + Only one option allowed. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/configure_file/SourcePermissionsInvalidArg-1.cmake b/Tests/RunCMake/configure_file/SourcePermissionsInvalidArg-1.cmake new file mode 100644 index 0000000..4969880 --- /dev/null +++ b/Tests/RunCMake/configure_file/SourcePermissionsInvalidArg-1.cmake @@ -0,0 +1,5 @@ +configure_file(sourcefile.txt + ${CMAKE_CURRENT_BINARY_DIR}/sourcefile.txt + NO_SOURCE_PERMISSIONS + USE_SOURCE_PERMISSIONS +) diff --git a/Tests/RunCMake/configure_file/SourcePermissionsInvalidArg-2-result.txt b/Tests/RunCMake/configure_file/SourcePermissionsInvalidArg-2-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/configure_file/SourcePermissionsInvalidArg-2-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/configure_file/SourcePermissionsInvalidArg-2-stderr.txt b/Tests/RunCMake/configure_file/SourcePermissionsInvalidArg-2-stderr.txt new file mode 100644 index 0000000..2fcfe58 --- /dev/null +++ b/Tests/RunCMake/configure_file/SourcePermissionsInvalidArg-2-stderr.txt @@ -0,0 +1,5 @@ +CMake Error at SourcePermissionsInvalidArg-2.cmake:1 \(configure_file\): + configure_file given both FILE_PERMISSIONS and NO_SOURCE_PERMISSIONS. Only + one option allowed. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/configure_file/SourcePermissionsInvalidArg-2.cmake b/Tests/RunCMake/configure_file/SourcePermissionsInvalidArg-2.cmake new file mode 100644 index 0000000..8a3fb87 --- /dev/null +++ b/Tests/RunCMake/configure_file/SourcePermissionsInvalidArg-2.cmake @@ -0,0 +1,5 @@ +configure_file(sourcefile.txt + ${CMAKE_CURRENT_BINARY_DIR}/sourcefile.txt + NO_SOURCE_PERMISSIONS + FILE_PERMISSIONS OWNER_READ +) diff --git a/Tests/RunCMake/configure_file/SourcePermissionsInvalidArg-3-result.txt b/Tests/RunCMake/configure_file/SourcePermissionsInvalidArg-3-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/configure_file/SourcePermissionsInvalidArg-3-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/configure_file/SourcePermissionsInvalidArg-3-stderr.txt b/Tests/RunCMake/configure_file/SourcePermissionsInvalidArg-3-stderr.txt new file mode 100644 index 0000000..29fae1b --- /dev/null +++ b/Tests/RunCMake/configure_file/SourcePermissionsInvalidArg-3-stderr.txt @@ -0,0 +1,5 @@ +CMake Error at SourcePermissionsInvalidArg-3.cmake:1 \(configure_file\): + configure_file given both FILE_PERMISSIONS and USE_SOURCE_PERMISSIONS. + Only one option allowed. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/configure_file/SourcePermissionsInvalidArg-3.cmake b/Tests/RunCMake/configure_file/SourcePermissionsInvalidArg-3.cmake new file mode 100644 index 0000000..78ecb0f --- /dev/null +++ b/Tests/RunCMake/configure_file/SourcePermissionsInvalidArg-3.cmake @@ -0,0 +1,5 @@ +configure_file(sourcefile.txt + ${CMAKE_CURRENT_BINARY_DIR}/sourcefile.txt + USE_SOURCE_PERMISSIONS + FILE_PERMISSIONS OWNER_READ +) diff --git a/Tests/RunCMake/configure_file/SourcePermissionsInvalidArg-4-result.txt b/Tests/RunCMake/configure_file/SourcePermissionsInvalidArg-4-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/configure_file/SourcePermissionsInvalidArg-4-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/configure_file/SourcePermissionsInvalidArg-4-stderr.txt b/Tests/RunCMake/configure_file/SourcePermissionsInvalidArg-4-stderr.txt new file mode 100644 index 0000000..7d477cb --- /dev/null +++ b/Tests/RunCMake/configure_file/SourcePermissionsInvalidArg-4-stderr.txt @@ -0,0 +1,4 @@ +CMake Error at SourcePermissionsInvalidArg-4.cmake:1 \(configure_file\): + configure_file given FILE_PERMISSIONS without any options. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/configure_file/SourcePermissionsInvalidArg-4.cmake b/Tests/RunCMake/configure_file/SourcePermissionsInvalidArg-4.cmake new file mode 100644 index 0000000..308b455 --- /dev/null +++ b/Tests/RunCMake/configure_file/SourcePermissionsInvalidArg-4.cmake @@ -0,0 +1,4 @@ +configure_file(sourcefile.txt + ${CMAKE_CURRENT_BINARY_DIR}/sourcefile.txt + FILE_PERMISSIONS +) diff --git a/Tests/RunCMake/configure_file/SourcePermissionsInvalidArg-5-result.txt b/Tests/RunCMake/configure_file/SourcePermissionsInvalidArg-5-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/configure_file/SourcePermissionsInvalidArg-5-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/configure_file/SourcePermissionsInvalidArg-5-stderr.txt b/Tests/RunCMake/configure_file/SourcePermissionsInvalidArg-5-stderr.txt new file mode 100644 index 0000000..7cab120 --- /dev/null +++ b/Tests/RunCMake/configure_file/SourcePermissionsInvalidArg-5-stderr.txt @@ -0,0 +1,4 @@ +CMake Error at SourcePermissionsInvalidArg-5.cmake:1 \(configure_file\): + configure_file given invalid permission "OWNER_RX","GROUP_RWX". +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/configure_file/SourcePermissionsInvalidArg-5.cmake b/Tests/RunCMake/configure_file/SourcePermissionsInvalidArg-5.cmake new file mode 100644 index 0000000..15c6f9a --- /dev/null +++ b/Tests/RunCMake/configure_file/SourcePermissionsInvalidArg-5.cmake @@ -0,0 +1,6 @@ +configure_file(${CMAKE_CURRENT_SOURCE_DIR}/sourcefile.txt + ${CMAKE_CURRENT_BINARY_DIR}/sourcefile-source-permissions.txt + FILE_PERMISSIONS + OWNER_READ OWNER_RX + GROUP_RWX +) diff --git a/Tests/RunCMake/configure_file/UseSourcePermissions.cmake b/Tests/RunCMake/configure_file/UseSourcePermissions.cmake new file mode 100644 index 0000000..f7aedd1 --- /dev/null +++ b/Tests/RunCMake/configure_file/UseSourcePermissions.cmake @@ -0,0 +1,40 @@ +configure_file(${CMAKE_CURRENT_SOURCE_DIR}/sourcefile.txt + ${CMAKE_CURRENT_BINARY_DIR}/sourcefile-use-source-permissions.txt + USE_SOURCE_PERMISSIONS +) + +if (UNIX) + find_program(STAT_EXECUTABLE NAMES stat) + if(NOT STAT_EXECUTABLE) + return() + endif() + + if (CMAKE_SYSTEM_NAME MATCHES "FreeBSD") + execute_process(COMMAND "${STAT_EXECUTABLE}" -f %Lp "${CMAKE_CURRENT_SOURCE_DIR}/sourcefile.txt" + OUTPUT_VARIABLE output1 + ) + execute_process(COMMAND "${STAT_EXECUTABLE}" -f %Lp "${CMAKE_CURRENT_BINARY_DIR}/sourcefile-use-source-permissions.txt" + OUTPUT_VARIABLE output2 + ) + elseif (CMAKE_SYSTEM_NAME MATCHES "Darwin") + execute_process(COMMAND "${STAT_EXECUTABLE}" -f %A "${CMAKE_CURRENT_SOURCE_DIR}/sourcefile.txt" + OUTPUT_VARIABLE output1 + ) + execute_process(COMMAND "${STAT_EXECUTABLE}" -f %A "${CMAKE_CURRENT_BINARY_DIR}/sourcefile-use-source-permissions.txt" + OUTPUT_VARIABLE output2 + ) + else() + execute_process(COMMAND "${STAT_EXECUTABLE}" -c %a "${CMAKE_CURRENT_SOURCE_DIR}/sourcefile.txt" + OUTPUT_VARIABLE output1 + ) + execute_process(COMMAND "${STAT_EXECUTABLE}" -c %a "${CMAKE_CURRENT_BINARY_DIR}/sourcefile-use-source-permissions.txt" + OUTPUT_VARIABLE output2 + ) + endif() + + if (NOT output1 EQUAL output2) + message(FATAL_ERROR "configure file has different permissions source " + "permissions: ${output1} generated permissions: ${output2}") + endif() + +endif() diff --git a/Tests/RunCMake/configure_file/sourcefile.txt b/Tests/RunCMake/configure_file/sourcefile.txt new file mode 100644 index 0000000..2296808 --- /dev/null +++ b/Tests/RunCMake/configure_file/sourcefile.txt @@ -0,0 +1 @@ +an empty file diff --git a/Tests/RunCMake/if/duplicate-deep-else-stderr.txt b/Tests/RunCMake/if/duplicate-deep-else-stderr.txt index ac2335c..ee886e0 100644 --- a/Tests/RunCMake/if/duplicate-deep-else-stderr.txt +++ b/Tests/RunCMake/if/duplicate-deep-else-stderr.txt @@ -1,4 +1,4 @@ -CMake Error at duplicate-deep-else.cmake:[0-9]+ \(else\): - A duplicate ELSE command was found inside an IF block. +CMake Error at duplicate-deep-else\.cmake:[0-9]+ \(else\): + Flow control statements are not properly nested\. Call Stack \(most recent call first\): - CMakeLists.txt:3 \(include\) + CMakeLists\.txt:[0-9]+ \(include\) diff --git a/Tests/RunCMake/if/duplicate-else-after-elseif-stderr.txt b/Tests/RunCMake/if/duplicate-else-after-elseif-stderr.txt index ba6765c..60c8484 100644 --- a/Tests/RunCMake/if/duplicate-else-after-elseif-stderr.txt +++ b/Tests/RunCMake/if/duplicate-else-after-elseif-stderr.txt @@ -1,4 +1,4 @@ -CMake Error at duplicate-else-after-elseif.cmake:[0-9]+ \(else\): - A duplicate ELSE command was found inside an IF block. +CMake Error at duplicate-else-after-elseif\.cmake:[0-9]+ \(else\): + Flow control statements are not properly nested\. Call Stack \(most recent call first\): - CMakeLists.txt:3 \(include\) + CMakeLists\.txt:[0-9]+ \(include\) diff --git a/Tests/RunCMake/if/duplicate-else-stderr.txt b/Tests/RunCMake/if/duplicate-else-stderr.txt index e0dd01f..518c43f 100644 --- a/Tests/RunCMake/if/duplicate-else-stderr.txt +++ b/Tests/RunCMake/if/duplicate-else-stderr.txt @@ -1,4 +1,4 @@ -CMake Error at duplicate-else.cmake:[0-9]+ \(else\): - A duplicate ELSE command was found inside an IF block. +CMake Error at duplicate-else\.cmake:[0-9]+ \(else\): + Flow control statements are not properly nested\. Call Stack \(most recent call first\): - CMakeLists.txt:3 \(include\) + CMakeLists\.txt:[0-9]+ \(include\) diff --git a/Tests/RunCMake/if/misplaced-elseif-stderr.txt b/Tests/RunCMake/if/misplaced-elseif-stderr.txt index c4b0266..5138f11 100644 --- a/Tests/RunCMake/if/misplaced-elseif-stderr.txt +++ b/Tests/RunCMake/if/misplaced-elseif-stderr.txt @@ -1,4 +1,4 @@ -CMake Error at misplaced-elseif.cmake:[0-9]+ \(elseif\): - An ELSEIF command was found after an ELSE command. +CMake Error at misplaced-elseif\.cmake:[0-9]+ \(elseif\): + Flow control statements are not properly nested\. Call Stack \(most recent call first\): - CMakeLists.txt:3 \(include\) + CMakeLists\.txt:[0-9]+ \(include\) diff --git a/Tests/RunCMake/include/ExportExportInclude-stderr.txt b/Tests/RunCMake/include/ExportExportInclude-stderr.txt index 70d013c..6d5c02f 100644 --- a/Tests/RunCMake/include/ExportExportInclude-stderr.txt +++ b/Tests/RunCMake/include/ExportExportInclude-stderr.txt @@ -1,5 +1,5 @@ CMake Error at ExportExportInclude.cmake:6 \(include\): - include could not find load file: + include could not find requested file: .*/Tests/RunCMake/include/ExportExportInclude-build/theTargets.cmake Call Stack \(most recent call first\): diff --git a/Tests/RunCMake/include/IncludeIsDirectory-result.txt b/Tests/RunCMake/include/IncludeIsDirectory-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/include/IncludeIsDirectory-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/include/IncludeIsDirectory-stderr.txt b/Tests/RunCMake/include/IncludeIsDirectory-stderr.txt new file mode 100644 index 0000000..5735c29 --- /dev/null +++ b/Tests/RunCMake/include/IncludeIsDirectory-stderr.txt @@ -0,0 +1,6 @@ +CMake Error at IncludeIsDirectory.cmake:1 \(include\): + include requested file is a directory: + + .*/Tests/RunCMake/include/IncludeIsDirectory-build +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/include/IncludeIsDirectory.cmake b/Tests/RunCMake/include/IncludeIsDirectory.cmake new file mode 100644 index 0000000..74189e3 --- /dev/null +++ b/Tests/RunCMake/include/IncludeIsDirectory.cmake @@ -0,0 +1 @@ +include("${CMAKE_CURRENT_BINARY_DIR}") diff --git a/Tests/RunCMake/include/IncludeMalformed-result.txt b/Tests/RunCMake/include/IncludeMalformed-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/include/IncludeMalformed-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/include/IncludeMalformed-stderr.txt b/Tests/RunCMake/include/IncludeMalformed-stderr.txt new file mode 100644 index 0000000..fc75549 --- /dev/null +++ b/Tests/RunCMake/include/IncludeMalformed-stderr.txt @@ -0,0 +1,13 @@ +CMake Error at malformedInclude.cmake:1: + Parse error. Function missing ending "\)". End of file reached. +Call Stack \(most recent call first\): + IncludeMalformed.cmake:1 \(include\) + CMakeLists.txt:3 \(include\) + + +CMake Error at IncludeMalformed.cmake:1 \(include\): + include could not load requested file: + + malformedInclude.cmake +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/include/IncludeMalformed.cmake b/Tests/RunCMake/include/IncludeMalformed.cmake new file mode 100644 index 0000000..9560142 --- /dev/null +++ b/Tests/RunCMake/include/IncludeMalformed.cmake @@ -0,0 +1 @@ +include("malformedInclude.cmake") diff --git a/Tests/RunCMake/include/RunCMakeTest.cmake b/Tests/RunCMake/include/RunCMakeTest.cmake index bea7d5c..8fb7201 100644 --- a/Tests/RunCMake/include/RunCMakeTest.cmake +++ b/Tests/RunCMake/include/RunCMakeTest.cmake @@ -5,3 +5,5 @@ run_cmake(EmptyStringOptional) run_cmake(CMP0024-WARN) run_cmake(CMP0024-NEW) run_cmake(ExportExportInclude) +run_cmake(IncludeIsDirectory) +run_cmake(IncludeMalformed) diff --git a/Tests/RunCMake/include/malformedInclude.cmake b/Tests/RunCMake/include/malformedInclude.cmake new file mode 100644 index 0000000..3cec3ad --- /dev/null +++ b/Tests/RunCMake/include/malformedInclude.cmake @@ -0,0 +1 @@ +if( diff --git a/Tests/RunCMake/pseudo_llvm-rc.c b/Tests/RunCMake/pseudo_llvm-rc.c new file mode 100644 index 0000000..7acb2a3 --- /dev/null +++ b/Tests/RunCMake/pseudo_llvm-rc.c @@ -0,0 +1,30 @@ +#include <stdio.h> +#include <string.h> + +int main(int argc, char* argv[]) +{ + FILE* source; + FILE* target; + int i; + for (i = 1; i < argc; ++i) { + if (strcmp(argv[i], "-bad") == 0) { + fprintf(stdout, "stdout from bad command line arg '-bad'\n"); + fprintf(stderr, "stderr from bad command line arg '-bad'\n"); + return 1; + } + } + source = fopen(argv[argc - 1], "rb"); + if (source == NULL) { + return 1; + } + target = fopen(argv[argc - 2], "wb"); + if (target != NULL) { + char buffer[500]; + size_t n = fread(buffer, 1, sizeof(buffer), source); + fwrite(buffer, 1, n, target); + fclose(source); + fclose(target); + return 0; + } + return 1; +} diff --git a/Tests/RunCMake/while/EndAlone-stderr.txt b/Tests/RunCMake/while/EndAlone-stderr.txt index 5fe6655..3195fa0 100644 --- a/Tests/RunCMake/while/EndAlone-stderr.txt +++ b/Tests/RunCMake/while/EndAlone-stderr.txt @@ -1,5 +1,4 @@ -^CMake Error at EndAlone.cmake:1 \(endwhile\): - endwhile An ENDWHILE command was found outside of a proper WHILE ENDWHILE - structure. Or its arguments did not match the opening WHILE command. +^CMake Error at EndAlone\.cmake:[0-9]+ \(endwhile\): + Flow control statements are not properly nested\. Call Stack \(most recent call first\): - CMakeLists.txt:3 \(include\)$ + CMakeLists\.txt:[0-9]+ \(include\)$ diff --git a/Tests/RunCMake/while/EndAloneArgs-stderr.txt b/Tests/RunCMake/while/EndAloneArgs-stderr.txt index a8c043d..1634e3b 100644 --- a/Tests/RunCMake/while/EndAloneArgs-stderr.txt +++ b/Tests/RunCMake/while/EndAloneArgs-stderr.txt @@ -1,5 +1,4 @@ -^CMake Error at EndAloneArgs.cmake:1 \(endwhile\): - endwhile An ENDWHILE command was found outside of a proper WHILE ENDWHILE - structure. Or its arguments did not match the opening WHILE command. +^CMake Error at EndAloneArgs\.cmake:[0-9]+ \(endwhile\): + Flow control statements are not properly nested\. Call Stack \(most recent call first\): - CMakeLists.txt:3 \(include\)$ + CMakeLists\.txt:[0-9]+ \(include\)$ diff --git a/Tests/RunCMake/while/EndMissing-stderr.txt b/Tests/RunCMake/while/EndMissing-stderr.txt index 964792f..1e3be4d 100644 --- a/Tests/RunCMake/while/EndMissing-stderr.txt +++ b/Tests/RunCMake/while/EndMissing-stderr.txt @@ -1,8 +1,4 @@ -^CMake Error in EndMissing.cmake: - A logical block opening on the line - - .*/Tests/RunCMake/while/EndMissing.cmake:1 \(while\) - - is not closed. +^CMake Error at EndMissing\.cmake:[0-9]+ \(while\): + Flow control statements are not properly nested\. Call Stack \(most recent call first\): - CMakeLists.txt:[0-9]+ \(include\)$ + CMakeLists\.txt:[0-9]+ \(include\)$ diff --git a/Tests/RunCMake/while/MissingArgument-stderr.txt b/Tests/RunCMake/while/MissingArgument-stderr.txt index 7ff0971..59e8ee3 100644 --- a/Tests/RunCMake/while/MissingArgument-stderr.txt +++ b/Tests/RunCMake/while/MissingArgument-stderr.txt @@ -1,4 +1,11 @@ -^CMake Error at MissingArgument.cmake:1 \(while\): +^CMake Error at MissingArgument\.cmake:[0-9]+ \(while\): while called with incorrect number of arguments Call Stack \(most recent call first\): - CMakeLists.txt:3 \(include\)$ + CMakeLists\.txt:[0-9]+ \(include\) + + +CMake Error at MissingArgument\.cmake:[0-9]+ \(endwhile\): + endwhile An ENDWHILE command was found outside of a proper WHILE ENDWHILE + structure\. Or its arguments did not match the opening WHILE command\. +Call Stack \(most recent call first\): + CMakeLists\.txt:[0-9]+ \(include\)$ diff --git a/Tests/RunCMake/while/MissingArgument.cmake b/Tests/RunCMake/while/MissingArgument.cmake index 32eaa26..3fe2d97 100644 --- a/Tests/RunCMake/while/MissingArgument.cmake +++ b/Tests/RunCMake/while/MissingArgument.cmake @@ -1 +1,2 @@ while() +endwhile() diff --git a/Tests/Server/CMakeLists.txt b/Tests/Server/CMakeLists.txt deleted file mode 100644 index 8321edb..0000000 --- a/Tests/Server/CMakeLists.txt +++ /dev/null @@ -1,28 +0,0 @@ -cmake_minimum_required(VERSION 3.4) -project(Server CXX) - -find_package(Python REQUIRED) - -macro(do_test bsname file type) - execute_process(COMMAND ${Python_EXECUTABLE} - -B # no .pyc files - "${CMAKE_SOURCE_DIR}/${type}-test.py" - "${CMAKE_COMMAND}" - "${CMAKE_SOURCE_DIR}/${file}" - "${CMAKE_SOURCE_DIR}" - "${CMAKE_BINARY_DIR}" - "${CMAKE_GENERATOR}" - RESULT_VARIABLE test_result - ) - - if (NOT test_result EQUAL 0) - message(SEND_ERROR "TEST FAILED: ${test_result}") - endif() -endmacro() - -do_test("test_cache" "tc_cache.json" "server") -do_test("test_handshake" "tc_handshake.json" "server") -do_test("test_globalSettings" "tc_globalSettings.json" "server") -do_test("test_buildsystem1" "tc_buildsystem1.json" "server") - -add_executable(Server empty.cpp) diff --git a/Tests/Server/buildsystem1/CMakeLists.txt b/Tests/Server/buildsystem1/CMakeLists.txt deleted file mode 100644 index d690472..0000000 --- a/Tests/Server/buildsystem1/CMakeLists.txt +++ /dev/null @@ -1,22 +0,0 @@ -cmake_minimum_required(VERSION 3.4) - -project(buildsystem2) - -set(var1 123) - -set(var2 345) - -add_executable(main main.cpp) - -add_executable(m_other main.cpp) - -add_library(foo foo.cpp) - -function(f1) -endfunction() - -set(var3 345) - -add_library(someImportedLib UNKNOWN IMPORTED) - -add_subdirectory(subdir) diff --git a/Tests/Server/buildsystem1/main.cpp b/Tests/Server/buildsystem1/main.cpp deleted file mode 100644 index 766b775..0000000 --- a/Tests/Server/buildsystem1/main.cpp +++ /dev/null @@ -1,5 +0,0 @@ - -int main() -{ - return 0; -} diff --git a/Tests/Server/buildsystem1/subdir/CMakeLists.txt b/Tests/Server/buildsystem1/subdir/CMakeLists.txt deleted file mode 100644 index 9157312..0000000 --- a/Tests/Server/buildsystem1/subdir/CMakeLists.txt +++ /dev/null @@ -1,5 +0,0 @@ -set(bar4 something) - -set(bar5 more) - -add_executable(ooo empty.cpp) diff --git a/Tests/Server/buildsystem1/subdir/empty.cpp b/Tests/Server/buildsystem1/subdir/empty.cpp deleted file mode 100644 index 7f39d71..0000000 --- a/Tests/Server/buildsystem1/subdir/empty.cpp +++ /dev/null @@ -1,5 +0,0 @@ - -int foo() -{ - return 0; -} diff --git a/Tests/Server/cmakelib.py b/Tests/Server/cmakelib.py deleted file mode 100644 index 546ae4c..0000000 --- a/Tests/Server/cmakelib.py +++ /dev/null @@ -1,380 +0,0 @@ -from __future__ import print_function -import sys, subprocess, json, os, select, shutil, time, socket - -termwidth = 150 - -print_communication = True - -def ordered(obj): - if isinstance(obj, dict): - return sorted((k, ordered(v)) for k, v in obj.items()) - if isinstance(obj, list): - return sorted(ordered(x) for x in obj) - else: - return obj - -def col_print(title, array): - print() - print() - print(title) - - indentwidth = 4 - indent = " " * indentwidth - - if not array: - print(indent + "<None>") - return - - padwidth = 2 - - maxitemwidth = len(max(array, key=len)) - - numCols = max(1, int((termwidth - indentwidth + padwidth) / (maxitemwidth + padwidth))) - - numRows = len(array) // numCols + 1 - - pad = " " * padwidth - - for index in range(numRows): - print(indent + pad.join(item.ljust(maxitemwidth) for item in array[index::numRows])) - -filterPacket = lambda x: x - -STDIN = 0 -PIPE = 1 - -communicationMethods = [STDIN] - -if hasattr(socket, 'AF_UNIX'): - communicationMethods.append(PIPE) - -def defaultExitWithError(proc): - data = "" - try: - while select.select([proc.outPipe], [], [], 3.)[0]: - data = data + proc.outPipe.read(1) - if len(data): - print("Rest of raw buffer from server:") - printServer(data) - except: - pass - proc.outPipe.close() - proc.inPipe.close() - proc.kill() - sys.exit(1) - -exitWithError = lambda proc: defaultExitWithError(proc) - -serverTag = "SERVER" - -def printServer(*args): - print(serverTag + ">", *args) - print() - sys.stdout.flush() - -def printClient(*args): - print("CLIENT>", *args) - print() - sys.stdout.flush() - -def waitForRawMessage(cmakeCommand): - stdoutdata = "" - payload = "" - while not cmakeCommand.poll(): - stdoutdataLine = cmakeCommand.outPipe.readline() - if stdoutdataLine: - stdoutdata += stdoutdataLine.decode('utf-8') - else: - break - begin = stdoutdata.find('[== "CMake Server" ==[\n') - end = stdoutdata.find(']== "CMake Server" ==]') - - if begin != -1 and end != -1: - begin += len('[== "CMake Server" ==[\n') - payload = stdoutdata[begin:end] - jsonPayload = json.loads(payload) - filteredPayload = filterPacket(jsonPayload) - if print_communication and filteredPayload: - printServer(filteredPayload) - if filteredPayload is not None or jsonPayload is None: - return jsonPayload - stdoutdata = stdoutdata[(end+len(']== "CMake Server" ==]')):] - -# Python2 has no problem writing the output of encodes directly, -# but Python3 returns only 'int's for encode and so must be turned -# into bytes. We use the existence of 'to_bytes' on an int to -# determine which behavior is appropriate. It might be more clear -# to do this in the code which uses the flag, but introducing -# this lookup cost at every byte sent isn't ideal. -has_to_bytes = "to_bytes" in dir(10) - -def writeRawData(cmakeCommand, content): - writeRawData.counter += 1 - payload = """ -[== "CMake Server" ==[ -%s -]== "CMake Server" ==] -""" % content - - rn = ( writeRawData.counter % 2 ) == 0 - - if rn: - payload = payload.replace('\n', '\r\n') - - if print_communication: - printClient(content, "(Use \\r\\n:", rn, ")") - - # To stress test how cmake deals with fragmentation in the - # communication channel, we send only one byte at a time. - # Certain communication methods / platforms might still buffer - # it all into one message since its so close together, but in - # general this will catch places where we assume full buffers - # come in all at once. - encoded_payload = payload.encode('utf-8') - - # Python version 3+ can't write ints directly; but 'to_bytes' - # for int was only added in python 3.2. If this is a 3+ version - # of python without that conversion function; just write the whole - # thing out at once. - if sys.version_info[0] > 2 and not has_to_bytes: - cmakeCommand.write(encoded_payload) - else: - for c in encoded_payload: - if has_to_bytes: - c = c.to_bytes(1, byteorder='big') - cmakeCommand.write(c) - -writeRawData.counter = 0 - -def writePayload(cmakeCommand, obj): - writeRawData(cmakeCommand, json.dumps(obj)) - -def getPipeName(): - return "/tmp/server-test-socket" - -def attachPipe(cmakeCommand, pipeName): - time.sleep(1) - sock = socket.socket(socket.AF_UNIX, socket.SOCK_STREAM) - sock.connect(pipeName) - global serverTag - serverTag = "SERVER(PIPE)" - cmakeCommand.outPipe = sock.makefile() - cmakeCommand.inPipe = sock - cmakeCommand.write = cmakeCommand.inPipe.sendall - -def writeAndFlush(pipe, val): - pipe.write(val) - pipe.flush() - -def initServerProc(cmakeCommand, comm): - if comm == PIPE: - pipeName = getPipeName() - cmakeCommand = subprocess.Popen([cmakeCommand, "-E", "server", "--experimental", "--pipe=" + pipeName]) - attachPipe(cmakeCommand, pipeName) - else: - cmakeCommand = subprocess.Popen([cmakeCommand, "-E", "server", "--experimental", "--debug"], - stdin=subprocess.PIPE, - stdout=subprocess.PIPE) - cmakeCommand.outPipe = cmakeCommand.stdout - cmakeCommand.inPipe = cmakeCommand.stdin - cmakeCommand.write = lambda val: writeAndFlush(cmakeCommand.inPipe, val) - - packet = waitForRawMessage(cmakeCommand) - if packet == None: - print("Not in server mode") - sys.exit(2) - - if packet['type'] != 'hello': - print("No hello message") - sys.exit(3) - - return cmakeCommand - -def exitProc(cmakeCommand): - # Tell the server to exit. - cmakeCommand.stdin.close() - cmakeCommand.stdout.close() - - # Wait for the server to exit. - # If this version of python supports it, terminate the server after a timeout. - try: - cmakeCommand.wait(timeout=5) - except TypeError: - cmakeCommand.wait() - except: - cmakeCommand.terminate() - raise - -def waitForMessage(cmakeCommand, expected): - data = ordered(expected) - packet = ordered(waitForRawMessage(cmakeCommand)) - - if packet != data: - print ("Received unexpected message; test failed") - exitWithError(cmakeCommand) - return packet - -def waitForReply(cmakeCommand, originalType, cookie, skipProgress): - gotResult = False - while True: - packet = waitForRawMessage(cmakeCommand) - t = packet['type'] - if packet['cookie'] != cookie or packet['inReplyTo'] != originalType: - print("cookie or inReplyTo mismatch") - sys.exit(4) - if t == 'message' or t == 'progress': - if skipProgress: - continue - if t == 'reply': - break - print("Unrecognized message", packet) - sys.exit(5) - - return packet - -def waitForError(cmakeCommand, originalType, cookie, message): - packet = waitForRawMessage(cmakeCommand) - if packet['cookie'] != cookie or packet['type'] != 'error' or packet['inReplyTo'] != originalType or packet['errorMessage'] != message: - sys.exit(6) - -def waitForProgress(cmakeCommand, originalType, cookie, current, message): - packet = waitForRawMessage(cmakeCommand) - if packet['cookie'] != cookie or packet['type'] != 'progress' or packet['inReplyTo'] != originalType or packet['progressCurrent'] != current or packet['progressMessage'] != message: - sys.exit(7) - -def handshake(cmakeCommand, major, minor, source, build, generator, extraGenerator): - version = { 'major': major } - if minor >= 0: - version['minor'] = minor - - writePayload(cmakeCommand, { 'type': 'handshake', 'protocolVersion': version, - 'cookie': 'TEST_HANDSHAKE', 'sourceDirectory': source, 'buildDirectory': build, - 'generator': generator, 'extraGenerator': extraGenerator }) - waitForReply(cmakeCommand, 'handshake', 'TEST_HANDSHAKE', False) - -def validateGlobalSettings(cmakeCommand, cmakeCommandPath, data): - packet = waitForReply(cmakeCommand, 'globalSettings', '', False) - - capabilities = packet['capabilities'] - - # validate version: - cmakeoutput = subprocess.check_output([ cmakeCommandPath, "--version" ], universal_newlines=True) - cmakeVersion = cmakeoutput.splitlines()[0][14:] - - version = capabilities['version'] - versionString = version['string'] - vs = str(version['major']) + '.' + str(version['minor']) + '.' + str(version['patch']) - if (versionString != vs and not versionString.startswith(vs + '-')): - sys.exit(8) - if (versionString != cmakeVersion): - sys.exit(9) - - # validate generators: - generatorObjects = capabilities['generators'] - - cmakeoutput = subprocess.check_output([ cmakeCommandPath, "--help" ], universal_newlines=True) - index = cmakeoutput.index('\nGenerators\n\n') - cmakeGenerators = [] - for line in cmakeoutput[index + 12:].splitlines(): - if not line: - continue - if line[0] == '*': # default generator marker - line = ' ' + line[1:] - if not line.startswith(' '): - continue - if line.startswith(' '): - continue - equalPos = line.find('=') - tmp = '' - if (equalPos > 0): - tmp = line[2:equalPos].strip() - else: - tmp = line.strip() - if tmp.endswith(" [arch]"): - tmp = tmp[0:len(tmp) - 7] - if (len(tmp) > 0) and (" - " not in tmp): - cmakeGenerators.append(tmp) - - generators = [] - for genObj in generatorObjects: - generators.append(genObj['name']) - - generators.sort() - cmakeGenerators.sort() - - for gen in cmakeGenerators: - if (not gen in generators): - sys.exit(10) - - gen = packet['generator'] - if (gen != '' and not (gen in generators)): - sys.exit(11) - - for i in data: - print("Validating", i) - if (packet[i] != data[i]): - sys.exit(12) - -def validateCache(cmakeCommand, data): - packet = waitForReply(cmakeCommand, 'cache', '', False) - - cache = packet['cache'] - - if (data['isEmpty']): - if (cache != []): - print('Expected empty cache, but got data.\n') - sys.exit(1) - return; - - if (cache == []): - print('Expected cache contents, but got none.\n') - sys.exit(1) - - hadHomeDir = False - for value in cache: - if (value['key'] == 'CMAKE_HOME_DIRECTORY'): - hadHomeDir = True - - if (not hadHomeDir): - print('No CMAKE_HOME_DIRECTORY found in cache.') - sys.exit(1) - -def handleBasicMessage(proc, obj, debug): - if 'sendRaw' in obj: - data = obj['sendRaw'] - if debug: print("Sending raw:", data) - writeRawData(proc, data) - return True - elif 'send' in obj: - data = obj['send'] - if debug: print("Sending:", json.dumps(data)) - writePayload(proc, data) - return True - elif 'recv' in obj: - data = obj['recv'] - if debug: print("Waiting for:", json.dumps(data)) - waitForMessage(proc, data) - return True - elif 'message' in obj: - print("MESSAGE:", obj["message"]) - sys.stdout.flush() - return True - return False - -def shutdownProc(proc): - # Tell the server to exit. - proc.inPipe.close() - proc.outPipe.close() - - # Wait for the server to exit. - # If this version of python supports it, terminate the server after a timeout. - try: - proc.wait(timeout=5) - except TypeError: - proc.wait() - except: - proc.terminate() - raise - - print('cmake-server exited: %d' % proc.returncode) - sys.exit(proc.returncode) diff --git a/Tests/Server/empty.cpp b/Tests/Server/empty.cpp deleted file mode 100644 index 766b775..0000000 --- a/Tests/Server/empty.cpp +++ /dev/null @@ -1,5 +0,0 @@ - -int main() -{ - return 0; -} diff --git a/Tests/Server/server-test.py b/Tests/Server/server-test.py deleted file mode 100644 index 701c6e9..0000000 --- a/Tests/Server/server-test.py +++ /dev/null @@ -1,105 +0,0 @@ -from __future__ import print_function -import sys, cmakelib, json, os, shutil - -debug = True - -cmakeCommand = sys.argv[1] -testFile = sys.argv[2] -sourceDir = sys.argv[3] -buildDir = sys.argv[4] + "/" + os.path.splitext(os.path.basename(testFile))[0] -cmakeGenerator = sys.argv[5] - -print("Server Test:", testFile, - "\n-- SourceDir:", sourceDir, - "\n-- BuildDir:", buildDir, - "\n-- Generator:", cmakeGenerator) - -if os.path.exists(buildDir): - shutil.rmtree(buildDir) - -cmakelib.filterBase = sourceDir - -with open(testFile) as f: - testData = json.loads(f.read()) - -for communicationMethod in cmakelib.communicationMethods: - proc = cmakelib.initServerProc(cmakeCommand, communicationMethod) - if proc is None: - continue - - for obj in testData: - if cmakelib.handleBasicMessage(proc, obj, debug): - pass - elif 'reply' in obj: - data = obj['reply'] - if debug: print("Waiting for reply:", json.dumps(data)) - originalType = "" - cookie = "" - skipProgress = False; - if 'cookie' in data: cookie = data['cookie'] - if 'type' in data: originalType = data['type'] - if 'skipProgress' in data: skipProgress = data['skipProgress'] - cmakelib.waitForReply(proc, originalType, cookie, skipProgress) - elif 'error' in obj: - data = obj['error'] - if debug: print("Waiting for error:", json.dumps(data)) - originalType = "" - cookie = "" - message = "" - if 'cookie' in data: cookie = data['cookie'] - if 'type' in data: originalType = data['type'] - if 'message' in data: message = data['message'] - cmakelib.waitForError(proc, originalType, cookie, message) - elif 'progress' in obj: - data = obj['progress'] - if debug: print("Waiting for progress:", json.dumps(data)) - originalType = '' - cookie = "" - current = 0 - message = "" - if 'cookie' in data: cookie = data['cookie'] - if 'type' in data: originalType = data['type'] - if 'current' in data: current = data['current'] - if 'message' in data: message = data['message'] - cmakelib.waitForProgress(proc, originalType, cookie, current, message) - elif 'handshake' in obj: - data = obj['handshake'] - if debug: print("Doing handshake:", json.dumps(data)) - major = -1 - minor = -1 - generator = cmakeGenerator - extraGenerator = '' - sourceDirectory = sourceDir - buildDirectory = buildDir - if 'major' in data: major = data['major'] - if 'minor' in data: minor = data['minor'] - if 'buildDirectory' in data: buildDirectory = data['buildDirectory'] - if 'sourceDirectory' in data: sourceDirectory = data['sourceDirectory'] - if 'generator' in data: generator = data['generator'] - if 'extraGenerator' in data: extraGenerator = data['extraGenerator'] - - if not os.path.isabs(buildDirectory): - buildDirectory = buildDir + "/" + buildDirectory - if sourceDirectory != '' and not os.path.isabs(sourceDirectory): - sourceDirectory = sourceDir + "/" + sourceDirectory - cmakelib.handshake(proc, major, minor, sourceDirectory, buildDirectory, - generator, extraGenerator) - elif 'validateGlobalSettings' in obj: - data = obj['validateGlobalSettings'] - if not 'buildDirectory' in data: data['buildDirectory'] = buildDir - if not 'sourceDirectory' in data: data['sourceDirectory'] = sourceDir - if not 'generator' in data: data['generator'] = cmakeGenerator - if not 'extraGenerator' in data: data['extraGenerator'] = '' - cmakelib.validateGlobalSettings(proc, cmakeCommand, data) - elif 'validateCache' in obj: - data = obj['validateCache'] - if not 'isEmpty' in data: data['isEmpty'] = false - cmakelib.validateCache(proc, data) - elif 'reconnect' in obj: - cmakelib.exitProc(proc) - proc = cmakelib.initServerProc(cmakeCommand, communicationMethod) - else: - print("Unknown command:", json.dumps(obj)) - sys.exit(2) - cmakelib.shutdownProc(proc) - print("Completed") diff --git a/Tests/Server/tc_buildsystem1.json b/Tests/Server/tc_buildsystem1.json deleted file mode 100644 index 08831b7..0000000 --- a/Tests/Server/tc_buildsystem1.json +++ /dev/null @@ -1,27 +0,0 @@ -[ -{ "message": "Testing globalSettings" }, - -{ "handshake": {"major": 1, "sourceDirectory":"buildsystem1","buildDirectory":"buildsystem1"} }, - -{ "message": "Configure:" }, -{ "send": { "type": "configure", "cookie":"CONFIG" } }, -{ "reply": { "type": "configure", "cookie":"CONFIG", "skipProgress":true } }, - -{ "message": "Compute:" }, -{ "send": { "type": "compute", "cookie":"COMPUTE" } }, -{ "reply": { "type": "compute", "cookie":"COMPUTE", "skipProgress":true } }, - -{ "message": "Codemodel:" }, -{ "send": { "type": "codemodel", "cookie":"CODEMODEL" } }, -{ "reply": { "type": "codemodel", "cookie":"CODEMODEL" } }, - -{ "message": "CMake Inputs:"}, -{ "send": { "type": "cmakeInputs", "cookie":"INPUTS" } }, -{ "reply": { "type": "cmakeInputs", "cookie":"INPUTS" } }, - -{ "message": "Cache:"}, -{ "send": { "type": "cache", "cookie":"CACHE" } }, -{ "reply": { "type": "cache", "cookie":"CACHE" } }, - -{ "message": "Everything ok." } -] diff --git a/Tests/Server/tc_cache.json b/Tests/Server/tc_cache.json deleted file mode 100644 index 74af6d9..0000000 --- a/Tests/Server/tc_cache.json +++ /dev/null @@ -1,24 +0,0 @@ -[ -{ "message": "Testing cache" }, - -{ "message": "Cache after first handshake is empty:" }, -{ "handshake": {"major": 1, "sourceDirectory": "buildsystem1", "buildDirectory": "buildsystem1"} }, -{ "send": { "type": "cache" } }, -{ "validateCache": { "isEmpty": true } }, - -{ "message": "Cache after configure is populated:" }, -{ "send": { "type": "configure" } }, -{ "reply": { "type": "configure", "skipProgress":true } }, -{ "send": { "type": "cache" } }, -{ "validateCache": { "isEmpty": false } }, - -{ "message": "Handshake for existing cache requires buildDirectory only:" }, -{ "reconnect": {} }, -{ "handshake": {"major": 1, "sourceDirectory": "", "buildDirectory": "buildsystem1"} }, - -{ "message": "Cache after reconnect is again populated:" }, -{ "send": { "type": "cache" } }, -{ "validateCache": { "isEmpty": false } }, - -{ "message": "Everything ok." } -] diff --git a/Tests/Server/tc_globalSettings.json b/Tests/Server/tc_globalSettings.json deleted file mode 100644 index d72fb41..0000000 --- a/Tests/Server/tc_globalSettings.json +++ /dev/null @@ -1,140 +0,0 @@ -[ -{ "message": "Testing globalSettings" }, - -{ "handshake": {"major": 1} }, - -{ "send": { "type": "globalSettings"} }, -{ "validateGlobalSettings": { "warnUnused": false, "debugOutput": false, "warnUninitialized": false, "traceExpand": false, "trace": false, "warnUnusedCli": true, "checkSystemVars": false } }, - - - -{ "message": "Change settings:" }, - -{ "send": { "type": "setGlobalSettings", "warnUnused": true } }, -{ "reply": { "type": "setGlobalSettings" } }, - -{ "send": { "type": "globalSettings"} }, -{ "validateGlobalSettings": { "warnUnused": true, "debugOutput": false, "warnUninitialized": false, "traceExpand": false, "trace": false, "warnUnusedCli": true, "checkSystemVars": false } }, - -{ "send": { "type": "setGlobalSettings", "warnUnused": false } }, -{ "reply": { "type": "setGlobalSettings" } }, - -{ "send": { "type": "globalSettings"} }, -{ "validateGlobalSettings": { "warnUnused": false, "debugOutput": false, "warnUninitialized": false, "traceExpand": false, "trace": false, "warnUnusedCli": true, "checkSystemVars": false } }, - -{ "send": { "type": "setGlobalSettings", "debugOutput": true } }, -{ "reply": { "type": "setGlobalSettings" } }, - -{ "send": { "type": "globalSettings"} }, -{ "validateGlobalSettings": { "warnUnused": false, "debugOutput": true, "warnUninitialized": false, "traceExpand": false, "trace": false, "warnUnusedCli": true, "checkSystemVars": false } }, - -{ "send": { "type": "setGlobalSettings", "debugOutput": false } }, -{ "reply": { "type": "setGlobalSettings" } }, - -{ "send": { "type": "globalSettings"} }, -{ "validateGlobalSettings": { "warnUnused": false, "debugOutput": false, "warnUninitialized": false, "traceExpand": false, "trace": false, "warnUnusedCli": true, "checkSystemVars": false } }, - -{ "send": { "type": "setGlobalSettings", "warnUninitialized": true } }, -{ "reply": { "type": "setGlobalSettings" } }, - -{ "send": { "type": "globalSettings"} }, -{ "validateGlobalSettings": { "warnUnused": false, "debugOutput": false, "warnUninitialized": true, "traceExpand": false, "trace": false, "warnUnusedCli": true, "checkSystemVars": false } }, - -{ "send": { "type": "setGlobalSettings", "warnUninitialized": false } }, -{ "reply": { "type": "setGlobalSettings" } }, - -{ "send": { "type": "globalSettings"} }, -{ "validateGlobalSettings": { "warnUnused": false, "debugOutput": false, "warnUninitialized": false, "traceExpand": false, "trace": false, "warnUnusedCli": true, "checkSystemVars": false } }, - -{ "send": { "type": "setGlobalSettings", "traceExpand": true } }, -{ "reply": { "type": "setGlobalSettings" } }, - -{ "send": { "type": "globalSettings"} }, -{ "validateGlobalSettings": { "warnUnused": false, "debugOutput": false, "warnUninitialized": false, "traceExpand": true, "trace": false, "warnUnusedCli": true, "checkSystemVars": false } }, - -{ "send": { "type": "setGlobalSettings", "traceExpand": false } }, -{ "reply": { "type": "setGlobalSettings" } }, - -{ "send": { "type": "globalSettings"} }, -{ "validateGlobalSettings": { "warnUnused": false, "debugOutput": false, "warnUninitialized": false, "traceExpand": false, "trace": false, "warnUnusedCli": true, "checkSystemVars": false } }, - - - -{ "send": { "type": "setGlobalSettings", "trace": true } }, -{ "reply": { "type": "setGlobalSettings" } }, - -{ "send": { "type": "globalSettings"} }, -{ "validateGlobalSettings": { "warnUnused": false, "debugOutput": false, "warnUninitialized": false, "traceExpand": false, "trace": true, "warnUnusedCli": true, "checkSystemVars": false } }, - -{ "send": { "type": "setGlobalSettings", "trace": false } }, -{ "reply": { "type": "setGlobalSettings" } }, - -{ "send": { "type": "globalSettings"} }, -{ "validateGlobalSettings": { "warnUnused": false, "debugOutput": false, "warnUninitialized": false, "traceExpand": false, "trace": false, "warnUnusedCli": true, "checkSystemVars": false } }, - -{ "send": { "type": "setGlobalSettings", "warnUnusedCli": false } }, -{ "reply": { "type": "setGlobalSettings" } }, - -{ "send": { "type": "globalSettings"} }, -{ "validateGlobalSettings": { "warnUnused": false, "debugOutput": false, "warnUninitialized": false, "traceExpand": false, "trace": false, "warnUnusedCli": false, "checkSystemVars": false } }, - -{ "send": { "type": "setGlobalSettings", "warnUnusedCli": true } }, -{ "reply": { "type": "setGlobalSettings" } }, - -{ "send": { "type": "globalSettings"} }, -{ "validateGlobalSettings": { "warnUnused": false, "debugOutput": false, "warnUninitialized": false, "traceExpand": false, "trace": false, "warnUnusedCli": true, "checkSystemVars": false } }, - -{ "send": { "type": "setGlobalSettings", "checkSystemVars": true } }, -{ "reply": { "type": "setGlobalSettings" } }, - -{ "send": { "type": "globalSettings"} }, -{ "validateGlobalSettings": { "warnUnused": false, "debugOutput": false, "warnUninitialized": false, "traceExpand": false, "trace": false, "warnUnusedCli": true, "checkSystemVars": true } }, - -{ "send": { "type": "setGlobalSettings", "checkSystemVars": false } }, -{ "reply": { "type": "setGlobalSettings" } }, - -{ "send": { "type": "globalSettings"} }, -{ "validateGlobalSettings": { "warnUnused": false, "debugOutput": false, "warnUninitialized": false, "traceExpand": false, "trace": false, "warnUnusedCli": true, "checkSystemVars": false } }, - -{ "send": { "type": "setGlobalSettings", "warnUnused": true, "debugOutput": true, "warnUninitialized": true, "traceExpand": true, "trace": true, "warnUnusedCli": false, "checkSystemVars": true } }, -{ "reply": { "type": "setGlobalSettings" } }, - -{ "send": { "type": "globalSettings"} }, -{ "validateGlobalSettings": { "warnUnused": true, "debugOutput": true, "warnUninitialized": true, "traceExpand": true, "trace": true, "warnUnusedCli": false, "checkSystemVars": true } }, - -{ "message": "Ignore unknown/readonly" }, - -{ "send": { "type": "setGlobalSettings", "unknownKey": "unknownValue", "extraGenerator": "XXX", "generator": "YYY", "sourceDirectory": "/tmp/source", "buildDirectory": "/tmp/build" } }, -{ "reply": { "type": "setGlobalSettings" } }, - -{ "send": { "type": "globalSettings"} }, -{ "validateGlobalSettings": { "warnUnused": true, "debugOutput": true, "warnUninitialized": true, "traceExpand": true, "trace": true, "warnUnusedCli": false, "checkSystemVars": true } }, - -{ "message": "Error paths:" }, - -{ "send": { "type": "setGlobalSettings", "debugOutput": true, "warnUnused": 1 } }, -{ "error": { "type": "setGlobalSettings", "message": "\"warnUnused\" must be unset or a bool value." } }, - -{ "send": { "type": "setGlobalSettings", "warnUnused": true, "debugOutput": 1 } }, -{ "error": { "type": "setGlobalSettings", "message": "\"debugOutput\" must be unset or a bool value." } }, - -{ "send": { "type": "setGlobalSettings", "warnUninitialized": 1, "warnUnused": true, "debugOutput": true } }, -{ "error": { "type": "setGlobalSettings", "message": "\"warnUninitialized\" must be unset or a bool value." } }, - -{ "send": { "type": "setGlobalSettings", "warnUnused": true, "debugOutput": true, "traceExpand": 1 } }, -{ "error": { "type": "setGlobalSettings", "message": "\"traceExpand\" must be unset or a bool value." } }, - -{ "send": { "type": "setGlobalSettings", "debugOutput": true, "trace": 1, "warnUnused": true } }, -{ "error": { "type": "setGlobalSettings", "message": "\"trace\" must be unset or a bool value." } }, - -{ "send": { "type": "setGlobalSettings", "warnUnused": true, "debugOutput": true, "warnUnusedCli": 1.0 } }, -{ "error": { "type": "setGlobalSettings", "message": "\"warnUnusedCli\" must be unset or a bool value." } }, - -{ "send": { "type": "setGlobalSettings", "warnUnused": true, "debugOutput": true, "checkSystemVars": "some string" } }, -{ "error": { "type": "setGlobalSettings", "message": "\"checkSystemVars\" must be unset or a bool value." } }, - -{ "send": { "type": "globalSettings"} }, -{ "validateGlobalSettings": { "warnUnused": true, "debugOutput": true, "warnUninitialized": true, "traceExpand": true, "trace": true, "warnUnusedCli": false, "checkSystemVars": true } }, - -{ "message": "Everything ok." } -] diff --git a/Tests/Server/tc_handshake.json b/Tests/Server/tc_handshake.json deleted file mode 100644 index 4bb7fa7..0000000 --- a/Tests/Server/tc_handshake.json +++ /dev/null @@ -1,75 +0,0 @@ -[ -{ "message": "Testing basic message handling:" }, - -{ "sendRaw": "Sometext"}, -{ "recv": {"cookie":"","errorMessage":"Failed to parse JSON input.","inReplyTo":"","type":"error"} }, - -{ "message": "Testing invalid json input"}, -{ "send": { "test": "sometext" } }, -{ "recv": {"cookie":"","errorMessage":"No type given in request.","inReplyTo":"","type":"error"} }, - -{ "send": {"test": "sometext","cookie":"monster"} }, -{ "recv": {"cookie":"monster","errorMessage":"No type given in request.","inReplyTo":"","type":"error"} }, - -{ "message": "Testing commands before handshake" }, -{ "send": {"type": "cache","cookie":"monster"} }, -{ "recv": {"cookie":"monster","errorMessage":"Waiting for type \"handshake\".","inReplyTo":"cache","type":"error"} }, - -{ "message": "Testing handshake" }, -{ "send": {"type": "sometype","cookie":"monster2"} }, -{ "recv": {"cookie":"monster2","errorMessage":"Waiting for type \"handshake\".","inReplyTo":"sometype","type":"error"} }, - -{ "send": {"type": "handshake"} }, -{ "recv": {"cookie":"","errorMessage":"\"protocolVersion\" is required for \"handshake\".","inReplyTo":"handshake","type":"error"} }, - -{ "send": {"type": "handshake","foo":"bar"} }, -{ "recv": {"cookie":"","errorMessage":"\"protocolVersion\" is required for \"handshake\".","inReplyTo":"handshake","type":"error"} }, - -{ "send": {"type": "handshake","protocolVersion":"bar"} }, -{ "recv": {"cookie":"","errorMessage":"\"protocolVersion\" must be a JSON object.","inReplyTo":"handshake","type":"error"} }, - -{ "send": {"type": "handshake","protocolVersion":{}} }, -{ "recv": {"cookie":"","errorMessage":"\"major\" must be set and an integer.","inReplyTo":"handshake","type":"error"} }, - -{ "send": {"type": "handshake","protocolVersion":{"major":"foo"}} }, -{ "recv": {"cookie":"","errorMessage":"\"major\" must be set and an integer.","inReplyTo":"handshake","type":"error"} }, - -{ "send": {"type": "handshake","protocolVersion":{"major":1, "minor":"foo"}} }, -{ "recv": {"cookie":"","errorMessage":"\"minor\" must be unset or an integer.","inReplyTo":"handshake","type":"error"} }, - -{ "send": {"type": "handshake","protocolVersion":{"major":-1, "minor":-1}} }, -{ "recv": {"cookie":"","errorMessage":"\"major\" must be >= 0.","inReplyTo":"handshake","type":"error"} }, - -{ "send": {"type": "handshake","protocolVersion":{"major":10, "minor":-1}} }, -{ "recv": {"cookie":"","errorMessage":"\"minor\" must be >= 0 when set.","inReplyTo":"handshake","type":"error"} }, - -{ "send": {"type": "handshake","protocolVersion":{"major":10000}} }, -{ "recv": {"cookie":"","errorMessage":"Protocol version not supported.","inReplyTo":"handshake","type":"error"} }, - -{ "send": {"type": "handshake","protocolVersion":{"major":1, "minor":10000}} }, -{ "recv": {"cookie":"","errorMessage":"Protocol version not supported.","inReplyTo":"handshake","type":"error"} }, - -{ "send": {"cookie":"zimtstern","type": "handshake","protocolVersion":{"major":1}} }, -{ "recv": {"cookie":"zimtstern","inReplyTo":"handshake","type":"error","errorMessage":"Failed to activate protocol version: \"buildDirectory\" is missing."} }, - -{ "message": "Testing protocol version specific options (1.0):" }, -{ "send": {"cookie":"zimtstern","type": "handshake","protocolVersion":{"major":1},"sourceDirectory":"/tmp/src"} }, -{ "recv": {"cookie":"zimtstern","inReplyTo":"handshake","type":"error","errorMessage":"Failed to activate protocol version: \"buildDirectory\" is missing."} }, - -{ "send": {"cookie":"zimtstern","type": "handshake","protocolVersion":{"major":1},"sourceDirectory":"/tmp/src","buildDirectory":"/tmp/build"} }, -{ "recv": {"cookie":"zimtstern","inReplyTo":"handshake","type":"error","errorMessage":"Failed to activate protocol version: \"sourceDirectory\" is not a directory."} }, - -{ "send": {"cookie":"zimtstern","type": "handshake","protocolVersion":{"major":1},"sourceDirectory":".","buildDirectory":"/tmp/build","extraGenerator":"CodeBlocks"} }, -{ "recv": {"cookie":"zimtstern","inReplyTo":"handshake","type":"error","errorMessage":"Failed to activate protocol version: \"generator\" is unset but required."} }, - -{ "send": {"cookie":"zimtstern","type": "handshake","protocolVersion":{"major":1},"sourceDirectory":".","buildDirectory":"/tmp/build","generator":"XXXX","extraGenerator":"CodeBlocks"} }, -{ "recv": {"cookie":"zimtstern","inReplyTo":"handshake","type":"error","errorMessage":"Failed to activate protocol version: Generator \"XXXX\" not supported."} }, - -{ "send": {"cookie":"zimtstern","type": "handshake","protocolVersion":{"major":1},"sourceDirectory":".","buildDirectory":"/tmp/build","generator":"Ninja","extraGenerator":"XXXX"} }, -{ "recv": {"cookie":"zimtstern","inReplyTo":"handshake","type":"error","errorMessage":"Failed to activate protocol version: The combination of generator \"Ninja\" and extra generator \"XXXX\" is not supported."} }, - -{ "send": {"cookie":"zimtstern","type": "handshake","protocolVersion":{"major":1},"sourceDirectory":".","buildDirectory":"/tmp/build","generator":"Ninja","extraGenerator":"CodeBlocks"} }, -{ "recv": {"cookie":"zimtstern","inReplyTo":"handshake","type":"reply"} }, - -{ "message": "Everything ok." } -] |