error: Exclude High-Level KDB test on Xcode 10.1
@@ -6,6 +6,50 @@ add_toolheaders (HDR_FILES)
include (LibAddTest)
+# This function checks information about the currently selected version of Xcode.
+#
+# The function exports the variables described below.
+#
+# - XCODE_INSTALLED: This variable specifies, if the current system uses Xcode or not.
+# - XCODE_VERSION: This variable stores the version string of the selected Xcode version. If Xcode is not installed, then it stores the
+# value `0`.
+#
+function (check_xcode)
+ set (XCODE_INSTALLED OFF PARENT_SCOPE)
+ set (XCODE_VERSION 0 PARENT_SCOPE)
+
+ if (NOT APPLE)
+ return ()
+ endif (NOT APPLE)
+
+ execute_process (COMMAND xcode-select --print-path
+ RESULT_VARIABLE XCODE_SELECT_UNSUCCESSFULL
+ OUTPUT_VARIABLE XCODE_PATH
+ OUTPUT_STRIP_TRAILING_WHITESPACE)
+
+ if (XCODE_SELECT_UNSUCCESSFULL)
+ return ()
+ endif (XCODE_SELECT_UNSUCCESSFULL)
+
+ execute_process (COMMAND "${XCODE_PATH}/usr/bin/xcodebuild" -version
+ RESULT_VARIABLE XCODE_BUILD_UNSUCCESSFULL
+ OUTPUT_VARIABLE XCODE_VERSION_STRING
+ OUTPUT_STRIP_TRAILING_WHITESPACE)
+
+ if (XCODE_BUILD_UNSUCCESSFULL)
+ return ()
+ endif (XCODE_BUILD_UNSUCCESSFULL)
+
+ string (REGEX
+ REPLACE ".*Xcode[ ]*([0-9]+(\\.[0-9]+)?(\\.[0-9]+)?).*"
+ "\\1"
+ XCODE_VERSION_STRING
+ ${XCODE_VERSION_STRING})
+
+ set (XCODE_INSTALLED ON PARENT_SCOPE)
+ set (XCODE_VERSION "${XCODE_VERSION_STRING}" PARENT_SCOPE)
+endfunction (check_xcode)
+
function (add_kdb_test suffix)
set (multiValueArgs "REQUIRED_PLUGINS;LINK_ELEKTRA")
cmake_parse_arguments (ARG "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN})
@@ -30,12 +74,11 @@ add_kdb_test (nested REQUIRED_PLUGINS error)
add_kdb_test (simple REQUIRED_PLUGINS error)
add_kdb_test (ensure REQUIRED_PLUGINS tracer list spec)
-if (NOT
- (APPLE
- AND XCODE
- AND XCODE_VERSION
- VERSION_EQUAL
- 10.1))
+check_xcode ()
+if ("${XCODE_VERSION}" VERSION_EQUAL 10.1)
+ # See: https://issues.libelektra.org/2686
+ message (STATUS "Exclude KDB high-level test because it fails with a segmentation fault (Xcode ${XCODE_VERSION})")
+else ("${XCODE_VERSION}" VERSION_EQUAL 10.1)
set_source_files_properties (testkdb_highlevel PROPERTIES COMPILE_FLAGS -Wno-sign-promo)
add_kdb_test (highlevel LINK_ELEKTRA elektra-highlevel REQUIRED_PLUGINS error)
-endif ()
+endif ("${XCODE_VERSION}" VERSION_EQUAL 10.1)
