diff options
Diffstat (limited to 'Tests')
-rw-r--r-- | Tests/CMakeLib/testList.cxx | 70 | ||||
-rw-r--r-- | Tests/CMakeLists.txt | 24 | ||||
-rw-r--r-- | Tests/CPackInnoSetupGenerator/CMakeLists.txt | 55 | ||||
-rw-r--r-- | Tests/CPackInnoSetupGenerator/Code.pas | 4 | ||||
-rw-r--r-- | Tests/CPackInnoSetupGenerator/RunCPackVerifyResult.cmake | 136 | ||||
-rw-r--r-- | Tests/CPackInnoSetupGenerator/main.c | 7 | ||||
-rw-r--r-- | Tests/CPackInnoSetupGenerator/my_bitmap.bmp | bin | 0 -> 9294 bytes | |||
-rw-r--r-- | Tests/CPackInnoSetupGenerator/my_file.txt | 1 | ||||
-rw-r--r-- | Tests/CompileFeatures/default_dialect.c | 3 | ||||
-rw-r--r-- | Tests/FindX11/Test/CMakeLists.txt | 51 | ||||
-rw-r--r-- | Tests/FindX11/Test/main.c | 527 | ||||
-rw-r--r-- | Tests/RunCMake/RunCMake.cmake | 2 |
12 files changed, 802 insertions, 78 deletions
diff --git a/Tests/CMakeLib/testList.cxx b/Tests/CMakeLib/testList.cxx index 7294be0..f6ec720 100644 --- a/Tests/CMakeLib/testList.cxx +++ b/Tests/CMakeLib/testList.cxx @@ -8,7 +8,7 @@ #include <utility> #include <vector> -#include <cm/string_view> +#include <cmext/string_view> #include "cmList.h" @@ -42,7 +42,7 @@ bool testConstructors() } { cmList list1{ "aa", "bb" }; - cmList list2("aa;bb"); + cmList list2("aa;bb"_s); if (list1.size() != 2 || list2.size() != 2 || list1 != list2) { result = false; @@ -174,7 +174,7 @@ bool testAssign() { cmList list{ "cc", "dd" }; - list = "aa;bb"; + list = "aa;bb"_s; if (list.size() != 2) { result = false; } @@ -195,7 +195,7 @@ bool testConversions() bool result = true; { - cmList list("a;b;c"); + cmList list("a;b;c"_s); std::string s = list.to_string(); if (s != "a;b;c") { @@ -203,7 +203,7 @@ bool testConversions() } } { - cmList list("a;b;c"); + cmList list("a;b;c"_s); std::vector<std::string> v = list; if (list.size() != 3 || v.size() != 3) { @@ -211,7 +211,7 @@ bool testConversions() } } { - cmList list("a;b;c"); + cmList list("a;b;c"_s); std::vector<std::string> v = std::move(list); // Microsoft compiler is not able to handle correctly the move semantics @@ -221,7 +221,7 @@ bool testConversions() } } { - cmList list("a;b;c"); + cmList list("a;b;c"_s); std::vector<std::string> v; // compiler is not able to select the cmList conversion operator @@ -247,20 +247,20 @@ bool testAccess() { cmList list{ "a", "b", "c" }; - if (list.at(1) != "b") { + if (list.get_item(1) != "b") { result = false; } } { cmList list{ "a", "b", "c" }; - if (list.at(-3) != "a") { + if (list.get_item(-3) != "a") { result = false; } } { try { cmList list{ "a", "b", "c" }; - if (list.at(4) != "a") { + if (list.get_item(4) != "a") { result = false; } } catch (std::out_of_range&) { @@ -269,7 +269,7 @@ bool testAccess() { try { cmList list{ "a", "b", "c" }; - if (list.at(-4) != "a") { + if (list.get_item(-4) != "a") { result = false; } } catch (std::out_of_range&) { @@ -342,7 +342,7 @@ bool testModifiers() { cmList list{ "1;2;3;4;5" }; - auto it = list.insert(list.begin() + 2, "6;7;8"); + auto it = list.insert(list.begin() + 2, "6;7;8"_s); if (list.size() != 8 || list.to_string() != "1;2;6;7;8;3;4;5") { result = false; } @@ -354,7 +354,7 @@ bool testModifiers() cmList list{ "1;2;3;4;5" }; auto it = - list.insert(list.begin() + 2, "6;7;8", cmList::ExpandElements::No); + list.insert(list.begin() + 2, "6;7;8"_s, cmList::ExpandElements::No); if (list.size() != 6 || list.to_string() != "1;2;6;7;8;3;4;5") { result = false; } @@ -479,7 +479,7 @@ bool testRemoveItems() bool result = true; { - cmList list("a;b;c;d;e;f;g;h"); + cmList list("a;b;c;d;e;f;g;h"_s); list.remove_items({ 1, 3, 5 }); @@ -488,7 +488,7 @@ bool testRemoveItems() } } { - cmList list("a;b;c;b;a;d;e;f"); + cmList list("a;b;c;b;a;d;e;f"_s); list.remove_items({ "a", "b", "h" }); @@ -497,7 +497,7 @@ bool testRemoveItems() } } { - cmList list("a;b;c;d;e;f;g;h"); + cmList list("a;b;c;d;e;f;g;h"_s); std::vector<cmList::index_type> remove{ 1, 3, 5 }; list.remove_items(remove.begin(), remove.end()); @@ -507,7 +507,7 @@ bool testRemoveItems() } } { - cmList list("a;b;c;b;a;d;e;f"); + cmList list("a;b;c;b;a;d;e;f"_s); std::vector<std::string> remove{ "b", "a", "h" }; list.remove_items(remove.begin(), remove.end()); @@ -529,7 +529,7 @@ bool testRemoveDuplicates() bool result = true; { - cmList list("b;c;b;a;a;c;b;a;c;b"); + cmList list("b;c;b;a;a;c;b;a;c;b"_s); list.remove_duplicates(); @@ -803,7 +803,7 @@ bool testStaticModifiers() { std::vector<std::string> v{ "a", "b", "c" }; - cmList::assign("d;e", v); + cmList::assign(v, "d;e"_s); if (v.size() != 2 || v[0] != "d" || v[1] != "e") { result = false; @@ -811,7 +811,7 @@ bool testStaticModifiers() } { std::vector<std::string> v{ "a", "b", "c" }; - cmList::append("d;;e", v); + cmList::append(v, "d;;e"_s); if (v.size() != 5 || v[3] != "d" || v[4] != "e") { result = false; @@ -819,7 +819,7 @@ bool testStaticModifiers() } { std::vector<std::string> v{ "a", "b", "c" }; - cmList::append("d;;e", v, cmList::EmptyElements::Yes); + cmList::append(v, "d;;e"_s, cmList::EmptyElements::Yes); if (v.size() != 6 || v[3] != "d" || !v[4].empty() || v[5] != "e") { result = false; @@ -827,7 +827,7 @@ bool testStaticModifiers() } { std::vector<std::string> v{ "a", "b", "c" }; - cmList::prepend("d;e", v); + cmList::prepend(v, "d;e"_s); if (v.size() != 5 || v[0] != "d" || v[1] != "e") { result = false; @@ -835,7 +835,7 @@ bool testStaticModifiers() } { std::vector<std::string> v{ "a", "b", "c" }; - cmList::prepend("d;;e", v, cmList::EmptyElements::Yes); + cmList::prepend(v, "d;;e"_s, cmList::EmptyElements::Yes); if (v.size() != 6 || v[0] != "d" || !v[1].empty() || v[2] != "e") { result = false; @@ -843,7 +843,7 @@ bool testStaticModifiers() } { std::string list{ "a;b;c" }; - cmList::append("d;e", list); + cmList::append(list, "d;e"_s); if (list != "a;b;c;d;e") { result = false; @@ -851,7 +851,7 @@ bool testStaticModifiers() } { std::string list; - cmList::append("d;e", list); + cmList::append(list, "d;e"_s); if (list != "d;e") { result = false; @@ -859,7 +859,7 @@ bool testStaticModifiers() } { std::string list{ "a;b;c" }; - cmList::append("", list); + cmList::append(list, ""); if (list != "a;b;c;") { result = false; @@ -868,7 +868,7 @@ bool testStaticModifiers() { std::string list{ "a;b;c" }; std::vector<std::string> v{ "d", "e" }; - cmList::append(v.begin(), v.end(), list); + cmList::append(list, v.begin(), v.end()); if (list != "a;b;c;d;e") { result = false; @@ -877,7 +877,7 @@ bool testStaticModifiers() { std::string list{ "a;b;c" }; std::vector<std::string> v; - cmList::append(v.begin(), v.end(), list); + cmList::append(list, v.begin(), v.end()); if (list != "a;b;c") { result = false; @@ -886,7 +886,7 @@ bool testStaticModifiers() { std::string list; std::vector<std::string> v{ "d", "e" }; - cmList::append(v.begin(), v.end(), list); + cmList::append(list, v.begin(), v.end()); if (list != "d;e") { result = false; @@ -894,7 +894,7 @@ bool testStaticModifiers() } { std::string list{ "a;b;c" }; - cmList::prepend("d;e", list); + cmList::prepend(list, "d;e"); if (list != "d;e;a;b;c") { result = false; @@ -902,7 +902,7 @@ bool testStaticModifiers() } { std::string list; - cmList::prepend("d;e", list); + cmList::prepend(list, "d;e"); if (list != "d;e") { result = false; @@ -910,7 +910,7 @@ bool testStaticModifiers() } { std::string list{ "a;b;c" }; - cmList::prepend("", list); + cmList::prepend(list, ""); if (list != ";a;b;c") { result = false; @@ -919,7 +919,7 @@ bool testStaticModifiers() { std::string list{ "a;b;c" }; std::vector<std::string> v{ "d", "e" }; - cmList::prepend(v.begin(), v.end(), list); + cmList::prepend(list, v.begin(), v.end()); if (list != "d;e;a;b;c") { result = false; @@ -928,7 +928,7 @@ bool testStaticModifiers() { std::string list{ "a;b;c" }; std::vector<std::string> v; - cmList::prepend(v.begin(), v.end(), list); + cmList::prepend(list, v.begin(), v.end()); if (list != "a;b;c") { result = false; @@ -937,7 +937,7 @@ bool testStaticModifiers() { std::string list; std::vector<std::string> v{ "d", "e" }; - cmList::prepend(v.begin(), v.end(), list); + cmList::prepend(list, v.begin(), v.end()); if (list != "d;e") { result = false; diff --git a/Tests/CMakeLists.txt b/Tests/CMakeLists.txt index e92d1c1..e3b5ec4 100644 --- a/Tests/CMakeLists.txt +++ b/Tests/CMakeLists.txt @@ -986,6 +986,30 @@ if(BUILD_TESTING) endif() endif() + # On Windows run the CPackInnoSetupGenerator test + if(WIN32 AND CMake_TEST_CPACK_INNOSETUP) + add_test(CPackInnoSetupGenerator ${CMAKE_CTEST_COMMAND} + -C \${CTEST_CONFIGURATION_TYPE} + --build-and-test + "${CMake_SOURCE_DIR}/Tests/CPackInnoSetupGenerator" + "${CMake_BINARY_DIR}/Tests/CPackInnoSetupGenerator" + ${build_generator_args} + --build-project CPackInnoSetupGenerator + --build-options + --test-command ${CMAKE_CMAKE_COMMAND} + "-DCPackInnoSetupGenerator_BINARY_DIR:PATH=${CMake_BINARY_DIR}/Tests/CPackInnoSetupGenerator" + "-Dconfig=\${CTEST_CONFIGURATION_TYPE}" + -P "${CMake_SOURCE_DIR}/Tests/CPackInnoSetupGenerator/RunCPackVerifyResult.cmake") + + set_property(TEST CPackInnoSetupGenerator PROPERTY + ATTACHED_FILES_ON_FAIL + "${CMake_BINARY_DIR}/Tests/CPackInnoSetupGenerator/_CPack_Packages/win32/INNOSETUP/ISCCOutput.log") + + set_property(TEST CPackInnoSetupGenerator PROPERTY + ATTACHED_FILES + "${CMake_BINARY_DIR}/Tests/CPackInnoSetupGenerator/_CPack_Packages/win32/INNOSETUP/ISScript.iss") + endif() + # On Windows run the CPackNSISGenerator test # if the nsis is available if(WIN32 AND NSIS_MAKENSIS_EXECUTABLE) diff --git a/Tests/CPackInnoSetupGenerator/CMakeLists.txt b/Tests/CPackInnoSetupGenerator/CMakeLists.txt new file mode 100644 index 0000000..bca0ad6 --- /dev/null +++ b/Tests/CPackInnoSetupGenerator/CMakeLists.txt @@ -0,0 +1,55 @@ +cmake_minimum_required(VERSION 3.13) + +project(CPackInnoSetupGenerator VERSION 42.0 HOMEPAGE_URL "https://www.example.com") + +add_executable(hello main.c) +file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/empty) + +install(TARGETS hello DESTINATION / COMPONENT application) +install(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/empty DESTINATION / COMPONENT extras) +install(FILES my_bitmap.bmp DESTINATION awesome COMPONENT extras) +install(FILES my_file.txt DESTINATION / COMPONENT hidden_component) +install(FILES my_file.txt DESTINATION / COMPONENT hidden_component2) + +set(CPACK_GENERATOR "INNOSETUP") + +set(CPACK_PACKAGE_NAME "Hello, World!") # Test constant escape (like {cm:...}, see code documentation) +set(CPACK_PACKAGE_VENDOR "Sheldon Cooper") +set(CPACK_PACKAGE_INSTALL_DIRECTORY "hello_world") +set(CPACK_PACKAGE_INSTALL_REGISTRY_KEY "hello_world") +set(CPACK_PACKAGE_FILE_NAME "hello_world_setup") +set(CPACK_SYSTEM_NAME "win32") +set(CPACK_PACKAGE_ICON "${CMAKE_CURRENT_SOURCE_DIR}/my_bitmap.bmp") +set(CPACK_VERBATIM_VARIABLES ON) +set(CPACK_PACKAGE_EXECUTABLES "hello" "Hello, World!") +set(CPACK_CREATE_DESKTOP_LINKS hello) + +set(CPACK_INNOSETUP_INSTALL_ROOT "{autopf}\\Sheldon Cooper") +set(CPACK_INNOSETUP_PROGRAM_MENU_FOLDER ".") +set(CPACK_INNOSETUP_IGNORE_LICENSE_PAGE ON) +set(CPACK_INNOSETUP_IGNORE_README_PAGE OFF) # Test if only readme page is shown +set(CPACK_INNOSETUP_SETUP_AppComments ON) # Test if CPACK_INNOSETUP_USE_CMAKE_BOOL_FORMAT works +set(CPACK_INNOSETUP_CUSTOM_INSTALL_INSTRUCTIONS "extras/empty" + "Name: \"{userdocs}\\empty\"\; Check: ReturnTrue\; Components: accessories\\extras") +set(CPACK_INNOSETUP_MENU_LINKS "https://www.example.com" "Web" + "my_file.txt" "Text") +set(CPACK_INNOSETUP_RUN_EXECUTABLES hello) +set(CPACK_INNOSETUP_CREATE_UNINSTALL_LINK ON) +# Test if this macro is available in the code file below containing the check function +set(CPACK_INNOSETUP_DEFINE_PascalMacro "end;") +set(CPACK_INNOSETUP_CODE_FILES "${CMAKE_CURRENT_SOURCE_DIR}/Code.pas") +set(CPACK_INNOSETUP_EXECUTABLE "ISCC.exe") + +include(CPackComponent) + +cpack_add_install_type(basic DISPLAY_NAME "Basic installation") +cpack_add_install_type(full DISPLAY_NAME "\"Large\" installation") # Test double quote syntax +cpack_add_component_group(accessories DISPLAY_NAME "Accessories") + +cpack_add_component(application DISPLAY_NAME "Application" INSTALL_TYPES basic full REQUIRED) +cpack_add_component(extras DISPLAY_NAME "Additional components" INSTALL_TYPES full GROUP accessories) +cpack_add_component(hidden_component HIDDEN) +cpack_add_component(hidden_component2 HIDDEN DISABLED) +set(CPACK_INNOSETUP_extras_INSTALL_DIRECTORY "{userdocs}") + +include(CPack) diff --git a/Tests/CPackInnoSetupGenerator/Code.pas b/Tests/CPackInnoSetupGenerator/Code.pas new file mode 100644 index 0000000..d96d82f --- /dev/null +++ b/Tests/CPackInnoSetupGenerator/Code.pas @@ -0,0 +1,4 @@ +function ReturnTrue(): Boolean; +begin + Result := true; +{#PascalMacro} diff --git a/Tests/CPackInnoSetupGenerator/RunCPackVerifyResult.cmake b/Tests/CPackInnoSetupGenerator/RunCPackVerifyResult.cmake new file mode 100644 index 0000000..72a26ee --- /dev/null +++ b/Tests/CPackInnoSetupGenerator/RunCPackVerifyResult.cmake @@ -0,0 +1,136 @@ +message(STATUS "=============================================================") +message(STATUS "CTEST_FULL_OUTPUT (Avoid ctest truncation of output)") +message(STATUS "") + +if(NOT CPackInnoSetupGenerator_BINARY_DIR) + message(FATAL_ERROR "CPackInnoSetupGenerator_BINARY_DIR not set") +endif() + +message(STATUS "CMAKE_COMMAND: ${CMAKE_COMMAND}") +message(STATUS "CMAKE_CPACK_COMMAND: ${CMAKE_CPACK_COMMAND}") +message(STATUS "CPackInnoSetupGenerator_BINARY_DIR: ${CPackInnoSetupGenerator_BINARY_DIR}") + +if(config) + set(_C_config -C ${config}) +endif() + +execute_process(COMMAND "${CMAKE_CPACK_COMMAND}" + ${_C_config} + RESULT_VARIABLE CPack_result + OUTPUT_VARIABLE CPack_output + ERROR_VARIABLE CPack_output + WORKING_DIRECTORY "${CPackInnoSetupGenerator_BINARY_DIR}") + +if(CPack_result) + message(FATAL_ERROR "CPack execution went wrong!, Output: ${CPack_output}") +else () + message(STATUS "Output: ${CPack_output}") +endif() + +file(GLOB project_file "${CPackInnoSetupGenerator_BINARY_DIR}/_CPack_Packages/win32/INNOSETUP/ISScript.iss") +file(GLOB installer_file "${CPackInnoSetupGenerator_BINARY_DIR}/_CPack_Packages/win32/INNOSETUP/hello_world_setup.exe") + +message(STATUS "Project file: '${project_file}'") +message(STATUS "Installer file: '${installer_file}'") + +if(NOT project_file) + message(FATAL_ERROR "Project file does not exist") +endif() + +if(NOT installer_file) + message(FATAL_ERROR "Installer file does not exist") +endif() + +# Test if the correct registry key is set +file(STRINGS "${project_file}" results REGEX "^AppId=hello_world$") +if(results STREQUAL "") + message(FATAL_ERROR "CPACK_PACKAGE_INSTALL_REGISTRY_KEY doesn't match AppId") +endif() + +# Test if only readme page is shown +file(STRINGS "${project_file}" results REGEX "^LicenseFile=") +file(STRINGS "${project_file}" results2 REGEX "^InfoBeforeFile=") +if(NOT results STREQUAL "" OR results2 STREQUAL "") + message(FATAL_ERROR "Erroneous output with license and readme files") +endif() + +# Test if classic style is used by default +file(STRINGS "${project_file}" results REGEX "compiler:SetupClassicIcon\\.ico") +file(STRINGS "${project_file}" results2 REGEX "compiler:WizClassicImage\\.bmp") +if(results STREQUAL "" OR results2 STREQUAL "") + message(FATAL_ERROR "Images of classic style not used") +endif() + +# Test if the top-level start menu folder is used +file(STRINGS "${project_file}" results REGEX "{autoprograms}") +file(STRINGS "${project_file}" results2 REGEX "{group}") +if(results STREQUAL "" OR NOT results2 STREQUAL "") + message(FATAL_ERROR "Top-level start menu folder not used") +endif() + +# Test CPACK_INNOSETUP_USE_CMAKE_BOOL_FORMAT +file(STRINGS "${project_file}" results REGEX "^AppComments=yes$") +if(results STREQUAL "") + message(FATAL_ERROR "CPACK_INNOSETUP_USE_CMAKE_BOOL_FORMAT doesn't convert booleans") +endif() + +# Test the custom installation rule +file(STRINGS "${project_file}" results REGEX "^Name: \"{userdocs}\\\\empty\"; Check: ReturnTrue; Components: accessories\\\\extras$") +if(results STREQUAL "") + message(FATAL_ERROR "Custom installation rule not found or incomplete") +endif() + +# Test if an uninstall shortcut has been created +file(STRINGS "${project_file}" results REGEX "{uninstallexe}") +if(results STREQUAL "") + message(FATAL_ERROR "No uninstall shortcut created") +endif() + +# Test CPACK_INNOSETUP_<compName>_INSTALL_DIRECTORY +file(STRINGS "${project_file}" results REGEX "{app}.*Components: accessories\\\\extras") +if(NOT results STREQUAL "") + message(FATAL_ERROR "Component not in custom install directory") +endif() + +# Test if component names are nested correctly +file(STRINGS "${project_file}" results REGEX "Components:.* extras") +if(NOT results STREQUAL "") + message(FATAL_ERROR "Component names must contain their parent groups according to the documentation") +endif() + +# Test if custom installation type exists +file(STRINGS "${project_file}" results REGEX "Flags: .*iscustom") +if(results STREQUAL "") + message(FATAL_ERROR "Custom installation type doesn't exist") +endif() + +# Test if hidden components are processed but not displayed +file(STRINGS "${project_file}" results REGEX "Source:.+hidden_component\\\\my_file\\.txt") +file(STRINGS "${project_file}" results2 REGEX "Name: \"hidden_component\"") +if(results STREQUAL "" OR NOT results2 STREQUAL "") + message(FATAL_ERROR "Hidden component displayed or one of its files ignored") +endif() + +# Test if disabled and hidden components are ignored at all +file(STRINGS "${project_file}" results REGEX "Source:.+hidden_component2\\\\my_file\\.txt") +if(NOT results STREQUAL "") + message(FATAL_ERROR "Disabled and hidden component not ignored") +endif() + +# Test if required components ignore their installation types +file(STRINGS "${project_file}" results REGEX "Types: (basic|full|custom|basic full|full basic|basic custom|full custom); Flags: fixed") +if(NOT results STREQUAL "") + message(FATAL_ERROR "Required components don't ignore their installation types") +endif() + +# Test constant escape (should contain Hello%2c World!) +file(STRINGS "${project_file}" results REGEX "Hello%2c World!") +if(results STREQUAL "") + message(FATAL_ERROR "The comma character isn't escaped to %2c") +endif() + +# Test double quote syntax +file(STRINGS "${project_file}" results REGEX "\"\"Large\"\"") +if(results STREQUAL "") + message(FATAL_ERROR "The quote character isn't escaped correctly") +endif() diff --git a/Tests/CPackInnoSetupGenerator/main.c b/Tests/CPackInnoSetupGenerator/main.c new file mode 100644 index 0000000..413899c --- /dev/null +++ b/Tests/CPackInnoSetupGenerator/main.c @@ -0,0 +1,7 @@ +#include <stdio.h> + +int main() +{ + printf("Hello, World!\n"); + return 42; +} diff --git a/Tests/CPackInnoSetupGenerator/my_bitmap.bmp b/Tests/CPackInnoSetupGenerator/my_bitmap.bmp Binary files differnew file mode 100644 index 0000000..d0e562f --- /dev/null +++ b/Tests/CPackInnoSetupGenerator/my_bitmap.bmp diff --git a/Tests/CPackInnoSetupGenerator/my_file.txt b/Tests/CPackInnoSetupGenerator/my_file.txt new file mode 100644 index 0000000..8ab686e --- /dev/null +++ b/Tests/CPackInnoSetupGenerator/my_file.txt @@ -0,0 +1 @@ +Hello, World! diff --git a/Tests/CompileFeatures/default_dialect.c b/Tests/CompileFeatures/default_dialect.c index b990e53..c696c83 100644 --- a/Tests/CompileFeatures/default_dialect.c +++ b/Tests/CompileFeatures/default_dialect.c @@ -20,7 +20,8 @@ # error Buildsystem error # endif # if defined(__STDC_VERSION__) && \ - !(defined(__SUNPRO_C) && __STDC_VERSION__ == 199409L) + !(__STDC_VERSION__ == 199409L && \ + (defined(__INTEL_COMPILER) || defined(__SUNPRO_C))) # error Unexpected __STDC_VERSION__ definition # endif #endif diff --git a/Tests/FindX11/Test/CMakeLists.txt b/Tests/FindX11/Test/CMakeLists.txt index e39ffb1..3312f6f 100644 --- a/Tests/FindX11/Test/CMakeLists.txt +++ b/Tests/FindX11/Test/CMakeLists.txt @@ -32,16 +32,38 @@ test_x11_component(x11_components Xau) test_x11_component(x11_components Xaw) test_x11_component(x11_components xcb) test_x11_component(x11_components X11_xcb) +test_x11_component(x11_components xcb_composite) test_x11_component(x11_components xcb_cursor) +test_x11_component(x11_components xcb_damage) +test_x11_component(x11_components xcb_dpms) +test_x11_component(x11_components xcb_dri2) +test_x11_component(x11_components xcb_dri3) +test_x11_component(x11_components xcb_errors) +test_x11_component(x11_components xcb_ewmh) +test_x11_component(x11_components xcb_glx) test_x11_component(x11_components xcb_icccm) +test_x11_component(x11_components xcb_image) +test_x11_component(x11_components xcb_keysyms) +test_x11_component(x11_components xcb_present) test_x11_component(x11_components xcb_randr) +test_x11_component(x11_components xcb_record) +test_x11_component(x11_components xcb_render) +test_x11_component(x11_components xcb_render_util) +test_x11_component(x11_components xcb_res) +test_x11_component(x11_components xcb_screensaver) test_x11_component(x11_components xcb_shape) +test_x11_component(x11_components xcb_shm) +test_x11_component(x11_components xcb_sync) test_x11_component(x11_components xcb_util) +test_x11_component(x11_components xcb_xf86dri) test_x11_component(x11_components xcb_xfixes) +test_x11_component(x11_components xcb_xinerama) +test_x11_component(x11_components xcb_xinput) +test_x11_component(x11_components xcb_xkb) test_x11_component(x11_components xcb_xrm) test_x11_component(x11_components xcb_xtest) -test_x11_component(x11_components xcb_keysyms) -test_x11_component(x11_components xcb_xkb) +test_x11_component(x11_components xcb_xvmc) +test_x11_component(x11_components xcb_xv) test_x11_component(x11_components Xcomposite) test_x11_component(x11_components Xdamage) test_x11_component(x11_components Xdmcp) @@ -79,13 +101,38 @@ foreach(lib Xaw xcb X11_xcb + xcb_composite xcb_cursor + xcb_damage + xcb_dpms + xcb_dri2 + xcb_dri3 + xcb_errors + xcb_ewmh + xcb_glx xcb_icccm + xcb_image + xcb_keysyms + xcb_present xcb_randr + xcb_record + xcb_render + xcb_render_util + xcb_res + xcb_screensaver xcb_shape + xcb_shm + xcb_sync xcb_util + xcb_xf86dri xcb_xfixes + xcb_xinerama + xcb_xinput + xcb_xkb xcb_xrm + xcb_xtest + xcb_xvmc + xcb_xv Xcomposite Xdamage Xdmcp diff --git a/Tests/FindX11/Test/main.c b/Tests/FindX11/Test/main.c index 5240de0..2542145 100644 --- a/Tests/FindX11/Test/main.c +++ b/Tests/FindX11/Test/main.c @@ -326,7 +326,7 @@ static void test_Xaw(void) #endif -#ifdef HAVE_xcb +#ifdef HAVE_X11_xcb # include <xcb/xcb.h> static void test_xcb(void) @@ -336,24 +336,216 @@ static void test_xcb(void) xcb_disconnect(connection); } -# ifdef HAVE_xcb_cursor -# include <xcb/xcb_cursor.h> +#endif + +#ifdef HAVE_X11_xcb_composite +# include <xcb/composite.h> +# include <xcb/xcb.h> + +static void test_xcb_composite(void) +{ + xcb_connection_t* connection = xcb_connect(NULL, NULL); + xcb_composite_query_version(connection, 0, 0); + xcb_disconnect(connection); +} + +#endif + +#ifdef HAVE_X11_xcb_cursor +# include <xcb/xcb.h> +# include <xcb/xcb_cursor.h> static void test_xcb_cursor(void) { int screen_nbr; xcb_connection_t* connection = xcb_connect(NULL, &screen_nbr); - xcb_screen_t* screen = xcb_aux_get_screen(conn, screen_nbr); + xcb_screen_iterator_t screens = + xcb_setup_roots_iterator(xcb_get_setup(connection)); xcb_cursor_context_t* ctx; - xcb_cursor_context_new(connection, screen, &ctx); + xcb_cursor_context_new(connection, screens.data, &ctx); xcb_cursor_context_free(ctx); xcb_disconnect(connection); } -# endif +#endif -# ifdef HAVE_xcb_randr -# include <xcb/randr.h> +#ifdef HAVE_X11_xcb_damage +# include <xcb/damage.h> +# include <xcb/xcb.h> + +static void test_xcb_damage(void) +{ + int screen_nbr; + xcb_connection_t* connection = xcb_connect(NULL, &screen_nbr); + xcb_damage_query_version_cookie_t cookie = + xcb_damage_query_version(connection, 0, 0); + xcb_disconnect(connection); +} + +#endif + +#ifdef HAVE_X11_xcb_dpms +# include <xcb/dpms.h> +# include <xcb/xcb.h> + +static void test_xcb_dpms(void) +{ + int screen_nbr; + xcb_connection_t* connection = xcb_connect(NULL, &screen_nbr); + xcb_dpms_get_version_cookie_t cookie = + xcb_dpms_get_version(connection, 0, 0); + xcb_disconnect(connection); +} + +#endif + +#ifdef HAVE_X11_xcb_dri2 +# include <xcb/dri2.h> +# include <xcb/xcb.h> + +static void test_xcb_dri2(void) +{ + int screen_nbr; + xcb_connection_t* connection = xcb_connect(NULL, &screen_nbr); + xcb_dri2_query_version_cookie_t cookie = + xcb_dri2_query_version(connection, 0, 0); + xcb_disconnect(connection); +} + +#endif + +#ifdef HAVE_X11_xcb_dri3 +# include <xcb/dri3.h> +# include <xcb/xcb.h> + +static void test_xcb_dri3(void) +{ + int screen_nbr; + xcb_connection_t* connection = xcb_connect(NULL, &screen_nbr); + xcb_dri3_query_version_cookie_t cookie = + xcb_dri3_query_version(connection, 0, 0); + xcb_disconnect(connection); +} + +#endif + +#ifdef HAVE_X11_xcb_errors +# include <xcb/xcb.h> +# include <xcb/xcb_errors.h> + +static void test_xcb_errors(void) +{ + int screen_nbr; + xcb_connection_t* connection = xcb_connect(NULL, &screen_nbr); + xcb_errors_context_t* context; + xcb_errors_context_new(connection, &context); + xcb_errors_context_free(context); + xcb_disconnect(connection); +} + +#endif + +#ifdef HAVE_X11_xcb_ewmh +# include <xcb/xcb.h> +# include <xcb/xcb_ewmh.h> + +static void test_xcb_ewmh(void) +{ + int screen_nbr; + xcb_connection_t* connection = xcb_connect(NULL, &screen_nbr); + xcb_ewmh_connection_t ewmh_connection; + xcb_intern_atom_cookie_t* cookie = + xcb_ewmh_init_atoms(connection, &ewmh_connection); + xcb_ewmh_init_atoms_replies(&ewmh_connection, cookie, NULL); + xcb_ewmh_connection_wipe(&ewmh_connection); + xcb_disconnect(connection); +} + +#endif + +#ifdef HAVE_X11_xcb_glx +# include <xcb/glx.h> +# include <xcb/xcb.h> + +static void test_xcb_glx(void) +{ + int screen_nbr; + xcb_connection_t* connection = xcb_connect(NULL, &screen_nbr); + xcb_glx_query_version_cookie_t cookie = + xcb_glx_query_version(connection, 0, 0); + xcb_disconnect(connection); +} + +#endif + +#ifdef HAVE_X11_xcb_icccm +# include <xcb/xcb.h> +# include <xcb/xcb_icccm.h> + +static void test_xcb_icccm(void) +{ + int screen_nbr; + xcb_connection_t* connection = xcb_connect(NULL, &screen_nbr); + xcb_window_t root = + xcb_setup_roots_iterator(xcb_get_setup(connection)).data->root; + xcb_get_property_cookie_t cookie = xcb_icccm_get_wm_name(connection, root); + xcb_icccm_get_text_property_reply_t reply; + xcb_icccm_get_wm_name_reply(connection, cookie, &reply, NULL); + xcb_disconnect(connection); +} + +#endif + +#ifdef HAVE_X11_xcb_image +# include <xcb/xcb.h> +# include <xcb/xcb_image.h> + +static void test_xcb_image(void) +{ + int screen_nbr; + xcb_connection_t* connection = xcb_connect(NULL, &screen_nbr); + // xcb_image is too convoluted/undocumented to make an + // actually working example, apologies :) + xcb_image_create(0, 0, 0, 0, 0, 0, 0, 0, 0, NULL, 0, 0); + xcb_disconnect(connection); +} + +#endif + +#ifdef HAVE_X11_xcb_keysyms +# include <xcb/xcb.h> +# include <xcb/xcb_keysyms.h> + +static void test_xcb_keysyms(void) +{ + int screen_nbr; + xcb_connection_t* connection = xcb_connect(NULL, &screen_nbr); + xcb_key_symbols_t* symbols = xcb_key_symbols_alloc(connection); + if (symbols != NULL) + xcb_key_symbols_free(symbols); + xcb_disconnect(connection); +} + +#endif + +#ifdef HAVE_X11_xcb_present +# include <xcb/present.h> +# include <xcb/xcb.h> + +static void test_xcb_present(void) +{ + int screen_nbr; + xcb_connection_t* connection = xcb_connect(NULL, &screen_nbr); + xcb_present_query_version_cookie_t cookie = + xcb_present_query_version(connection, 0, 0); + xcb_disconnect(connection); +} + +#endif + +#ifdef HAVE_X11_xcb_randr +# include <xcb/randr.h> +# include <xcb/xcb.h> static void test_xcb_randr(void) { @@ -364,10 +556,86 @@ static void test_xcb_randr(void) xcb_disconnect(connection); } -# endif +#endif + +#ifdef HAVE_X11_xcb_record +# include <xcb/record.h> +# include <xcb/xcb.h> + +static void test_xcb_record(void) +{ + int screen_nbr; + xcb_connection_t* connection = xcb_connect(NULL, &screen_nbr); + xcb_record_query_version_cookie_t cookie = + xcb_record_query_version(connection, 0, 0); + xcb_disconnect(connection); +} -# ifdef HAVE_xcb_shape -# include <xcb/shape.h> +#endif + +#ifdef HAVE_X11_xcb_render +# include <xcb/render.h> +# include <xcb/xcb.h> + +static void test_xcb_render(void) +{ + int screen_nbr; + xcb_connection_t* connection = xcb_connect(NULL, &screen_nbr); + xcb_render_query_version_cookie_t cookie = + xcb_render_query_version(connection, 0, 0); + xcb_disconnect(connection); +} + +#endif + +#ifdef HAVE_X11_xcb_render_util +# include <xcb/xcb.h> +# include <xcb/xcb_renderutil.h> + +static void test_xcb_render_util(void) +{ + int screen_nbr; + xcb_connection_t* connection = xcb_connect(NULL, &screen_nbr); + const xcb_render_query_version_reply_t* cookie = + xcb_render_util_query_version(connection); + xcb_disconnect(connection); +} + +#endif + +#ifdef HAVE_X11_xcb_res +# include <xcb/res.h> +# include <xcb/xcb.h> + +static void test_xcb_res(void) +{ + int screen_nbr; + xcb_connection_t* connection = xcb_connect(NULL, &screen_nbr); + xcb_res_query_version_cookie_t cookie = + xcb_res_query_version(connection, 0, 0); + xcb_disconnect(connection); +} + +#endif + +#ifdef HAVE_X11_xcb_screensaver +# include <xcb/screensaver.h> +# include <xcb/xcb.h> + +static void test_xcb_screensaver(void) +{ + int screen_nbr; + xcb_connection_t* connection = xcb_connect(NULL, &screen_nbr); + xcb_screensaver_query_version_cookie_t cookie = + xcb_screensaver_query_version(connection, 0, 0); + xcb_disconnect(connection); +} + +#endif + +#ifdef HAVE_X11_xcb_shape +# include <xcb/shape.h> +# include <xcb/xcb.h> static void test_xcb_shape(void) { @@ -378,10 +646,39 @@ static void test_xcb_shape(void) xcb_disconnect(connection); } -# endif +#endif + +#ifdef HAVE_X11_xcb_shm +# include <xcb/shm.h> +# include <xcb/xcb.h> + +static void test_xcb_shm(void) +{ + int screen_nbr; + xcb_connection_t* connection = xcb_connect(NULL, &screen_nbr); + xcb_shm_query_version_cookie_t cookie = xcb_shm_query_version(connection); + xcb_disconnect(connection); +} + +#endif + +#ifdef HAVE_X11_xcb_sync +# include <xcb/sync.h> +# include <xcb/xcb.h> + +static void test_xcb_sync(void) +{ + int screen_nbr; + xcb_connection_t* connection = xcb_connect(NULL, &screen_nbr); + xcb_sync_initialize_cookie_t cookie = xcb_sync_initialize(connection, 0, 0); + xcb_disconnect(connection); +} + +#endif -# ifdef HAVE_xcb_util -# include <xcb/xcb_aux.h> +#ifdef HAVE_X11_xcb_util +# include <xcb/xcb.h> +# include <xcb/xcb_aux.h> static void test_xcb_util(void) { @@ -391,10 +688,26 @@ static void test_xcb_util(void) xcb_disconnect(connection); } -# endif +#endif + +#ifdef HAVE_X11_xcb_xf86dri +# include <xcb/xcb.h> +# include <xcb/xf86dri.h> + +static void test_xcb_xf86dri(void) +{ + int screen_nbr; + xcb_connection_t* connection = xcb_connect(NULL, &screen_nbr); + xcb_xf86dri_query_version_cookie_t cookie = + xcb_xf86dri_query_version(connection); + xcb_disconnect(connection); +} + +#endif -# ifdef HAVE_xcb_xfixes -# include <xcb/xcb_xfixes.h> +#ifdef HAVE_X11_xcb_xfixes +# include <xcb/xcb.h> +# include <xcb/xfixes.h> static void test_xcb_xfixes(void) { @@ -404,10 +717,56 @@ static void test_xcb_xfixes(void) xcb_disconnect(connection); } -# endif +#endif + +#ifdef HAVE_X11_xcb_xinerama +# include <xcb/xcb.h> +# include <xcb/xinerama.h> + +static void test_xcb_xinerama(void) +{ + int screen_nbr; + xcb_connection_t* connection = xcb_connect(NULL, &screen_nbr); + xcb_xinerama_query_version_cookie_t cookie = + xcb_xinerama_query_version(connection, 0, 0); + xcb_disconnect(connection); +} + +#endif + +#ifdef HAVE_X11_xcb_xinput +# include <xcb/xcb.h> +# include <xcb/xinput.h> + +static void test_xcb_xinput(void) +{ + int screen_nbr; + xcb_connection_t* connection = xcb_connect(NULL, &screen_nbr); + xcb_input_xi_query_version_cookie_t cookie = + xcb_input_xi_query_version(connection, 0, 0); + xcb_disconnect(connection); +} + +#endif + +#ifdef HAVE_X11_xcb_xkb +# include <xcb/xcb.h> +# include <xcb/xkb.h> + +static void test_xcb_xkb(void) +{ + int screen_nbr; + xcb_connection_t* connection = xcb_connect(NULL, &screen_nbr); + xcb_xkb_use_extension_cookie_t cookie = + xcb_xkb_use_extension(connection, 0, 0); + xcb_disconnect(connection); +} + +#endif -# ifdef HAVE_xcb_xrm -# include <xcb/xcb_xrm.h> +#ifdef HAVE_X11_xcb_xrm +# include <xcb/xcb.h> +# include <xcb/xcb_xrm.h> static void test_xcb_xrm(void) { @@ -418,10 +777,11 @@ static void test_xcb_xrm(void) xcb_disconnect(connection); } -# endif +#endif -# ifdef HAVE_xcb_xtest -# include <xcb/xtest.h> +#ifdef HAVE_X11_xcb_xtest +# include <xcb/xcb.h> +# include <xcb/xtest.h> static void test_xcb_xtest(void) { @@ -431,22 +791,33 @@ static void test_xcb_xtest(void) xcb_disconnect(connection); } -# endif +#endif -# ifdef HAVE_xcb_keysyms -# include <xcb/xcb_keysyms.h> +#ifdef HAVE_X11_xcb_xvmc +# include <xcb/xcb.h> +# include <xcb/xvmc.h> -static void test_xcb_keysyms(void) +static void test_xcb_xvmc(void) { int screen_nbr; xcb_connection_t* connection = xcb_connect(NULL, &screen_nbr); - xcb_key_symbols_t* symbols = xcb_key_symbols_alloc(connection); - if (symbols != NULL) - xcb_key_symbols_free(symbols); + xcb_xvmc_query_version_cookie_t cookie = xcb_xvmc_query_version(connection); xcb_disconnect(connection); } -# endif +#endif + +#ifdef HAVE_X11_xcb_xv +# include <xcb/xcb.h> +# include <xcb/xv.h> + +static void test_xcb_xv(void) +{ + int screen_nbr; + xcb_connection_t* connection = xcb_connect(NULL, &screen_nbr); + xcb_xv_query_extension_cookie_t cookie = xcb_xv_query_extension(connection); + xcb_disconnect(connection); +} #endif @@ -537,28 +908,105 @@ int main(int argc, char* argv[]) #ifdef HAVE_X11_Xaw test_Xaw, #endif -#ifdef HAVE_xcb +#ifdef HAVE_X11_xcb test_xcb, #endif -#ifdef HAVE_xcb_cursor +#ifdef HAVE_X11_xcb_composite + test_xcb_composite, +#endif +#ifdef HAVE_X11_xcb_cursor test_xcb_cursor, #endif -#ifdef HAVE_xcb_randr +#ifdef HAVE_X11_xcb_damage + test_xcb_damage, +#endif +#ifdef HAVE_X11_xcb_dpms + test_xcb_dpms, +#endif +#ifdef HAVE_X11_xcb_dri2 + test_xcb_dri2, +#endif +#ifdef HAVE_X11_xcb_dri3 + test_xcb_dri3, +#endif +#ifdef HAVE_X11_xcb_errors + test_xcb_errors, +#endif +#ifdef HAVE_X11_xcb_ewmh + test_xcb_ewmh, +#endif +#ifdef HAVE_X11_xcb_glx + test_xcb_glx, +#endif +#ifdef HAVE_X11_xcb_icccm + test_xcb_icccm, +#endif +#ifdef HAVE_X11_xcb_image + test_xcb_image, +#endif +#ifdef HAVE_X11_xcb_keysyms + test_xcb_keysyms, +#endif +#ifdef HAVE_X11_xcb_present + test_xcb_present, +#endif +#ifdef HAVE_X11_xcb_randr test_xcb_randr, #endif -#ifdef HAVE_xcb_shape +#ifdef HAVE_X11_xcb_record + test_xcb_record, +#endif +#ifdef HAVE_X11_xcb_render + test_xcb_render, +#endif +#ifdef HAVE_X11_xcb_render_util + test_xcb_render_util, +#endif +#ifdef HAVE_X11_xcb_res + test_xcb_res, +#endif +#ifdef HAVE_X11_xcb_screensaver + test_xcb_screensaver, +#endif +#ifdef HAVE_X11_xcb_shape test_xcb_shape, #endif -#ifdef HAVE_xcb_util +#ifdef HAVE_X11_xcb_shm + test_xcb_shm, +#endif +#ifdef HAVE_X11_xcb_sync + test_xcb_sync, +#endif +#ifdef HAVE_X11_xcb_util test_xcb_util, #endif -#ifdef HAVE_xcb_xfixes +#ifdef HAVE_X11_xcb_xf86dri + test_xcb_xf86dri, +#endif +#ifdef HAVE_X11_xcb_xfixes test_xcb_xfixes, #endif -#ifdef HAVE_xcb_xrm +#ifdef HAVE_X11_xcb_xinerama + test_xcb_xinerama, +#endif +#ifdef HAVE_X11_xcb_xinput + test_xcb_xinput, +#endif +#ifdef HAVE_X11_xcb_xkb + test_xcb_xkb, +#endif +#ifdef HAVE_X11_xcb_xrm test_xcb_xrm, #endif - +#ifdef HAVE_X11_xcb_xtest + test_xcb_xtest, +#endif +#ifdef HAVE_X11_xcb_xvmc + test_xcb_xvmc, +#endif +#ifdef HAVE_X11_xcb_xv + test_xcb_xv, +#endif NULL, }; @@ -567,5 +1015,6 @@ int main(int argc, char* argv[]) // always 1 in the test harness which always returns the sentinel at the end // of the array. The array logic is there to ensure that the contents of // `fptrs` is not optimized out. +#pragma GCC diagnostic ignored "-Wpointer-to-int-cast" return (int)fptrs[(sizeof(fptrs) / sizeof(*fptrs)) - argc]; } diff --git a/Tests/RunCMake/RunCMake.cmake b/Tests/RunCMake/RunCMake.cmake index 5e91e99..18dde94 100644 --- a/Tests/RunCMake/RunCMake.cmake +++ b/Tests/RunCMake/RunCMake.cmake @@ -177,7 +177,7 @@ function(run_cmake test) "|Your license to use PGI[^\n]*expired" "|Please obtain a new version at" "|contact PGI Sales at" - "|icp?c: remark #10441: The Intel\\(R\\) C\\+\\+ Compiler Classic \\(ICC\\) is deprecated" + "|ic(p?c|l): remark #10441: The Intel\\(R\\) C\\+\\+ Compiler Classic \\(ICC\\) is deprecated" "|[^\n]*install_name_tool: warning: changes being made to the file will invalidate the code signature in:" "|[^\n]*xcodebuild[^\n]*DVTCoreDeviceEnabledState: DVTCoreDeviceEnabledState_Disabled set via user default" |