[cmake] split tests

* Keep BUILD_TESTING, but only run tests compatible with API (for
  packaging)
* Add BUILD_TESTING_INTERNAL for all tests including internal function
  tests that modify API to be run on our CI
This commit is contained in:
Armin Novak 2024-10-23 14:20:26 +02:00 committed by akallabeth
parent f488d15b7a
commit 527db6783b
No known key found for this signature in database
GPG Key ID: A49454A3FC909FD5
61 changed files with 181 additions and 146 deletions

View File

@ -189,14 +189,14 @@ endif(CMAKE_CROSSCOMPILING)
# Turn on solution folders (2.8.4+)
set_property(GLOBAL PROPERTY USE_FOLDERS ON)
option(EXPORT_ALL_SYMBOLS "Export all symbols form library" OFF)
if(BUILD_TESTING)
set(EXPORT_ALL_SYMBOLS TRUE)
set(CTEST_OUTPUT_ON_FAILURE TRUE)
add_definitions(-DBUILD_TESTING)
elseif(NOT DEFINED EXPORT_ALL_SYMBOLS)
set(EXPORT_ALL_SYMBOLS FALSE)
option(CTEST_OUTPUT_ON_FAILURE ON "show verbose output on CTest failures")
if(BUILD_TESTING_INTERNAL)
set(EXPORT_ALL_SYMBOLS ON CACHE BOOL "testing default" FORCE)
add_definitions(-DBUILD_TESTING_INTERNAL)
elseif(BUILD_TESTING)
set(EXPORT_ALL_SYMBOLS OFF CACHE BOOL "testing default" FORCE)
else()
option(EXPORT_ALL_SYMBOLS "Export all symbols form library" OFF)
endif()
if (EXPORT_ALL_SYMBOLS)
@ -547,7 +547,7 @@ find_feature(Wayland ${WAYLAND_FEATURE_TYPE} ${WAYLAND_FEATURE_PURPOSE} ${WAYLAN
option(WITH_LIBRESSL "build with LibreSSL" OFF)
if (WITH_LIBRESSL)
find_package(LibreSSL REQUIRED)
include_directories(SYSTEM ${LibreSSL_INCLUDE_DIRS})
include_directories(SYSTEM ${LibreSSL_INCLUDE_DIRS})
set(OPENSSL_INCLUDE_DIR ${LIBRESSL_INCLUDE_DIR})
set(OPENSSL_LIBRARIES ${LIBRESSL_LIBRARIES})
set(OPENSSL_CRYPTO_LIBRARIES ${LIBRESSL_LIBRARIES})
@ -595,7 +595,7 @@ set(WITH_OPENH264 ${OPENH264_FOUND})
if(OPENSSL_FOUND)
add_definitions("-DWITH_OPENSSL")
message(STATUS "Using OpenSSL Version: ${OPENSSL_VERSION}")
include_directories(SYSTEM ${OPENSSL_INCLUDE_DIR})
include_directories(SYSTEM ${OPENSSL_INCLUDE_DIR})
endif()
if(MBEDTLS_FOUND)
@ -657,7 +657,7 @@ if(ANDROID)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -pg")
set(PROFILER_LIBRARIES
"${FREERDP_EXTERNAL_PROFILER_PATH}/obj/local/${ANDROID_ABI}/libandroid-ndk-profiler.a")
include_directories(SYSTEM "${FREERDP_EXTERNAL_PROFILER_PATH}")
include_directories(SYSTEM "${FREERDP_EXTERNAL_PROFILER_PATH}")
endif()
endif()
@ -665,7 +665,7 @@ endif()
include(CTest)
if(BUILD_TESTING)
if(BUILD_TESTING_INTERNAL OR BUILD_TESTING)
enable_testing()
if(MSVC)
@ -693,7 +693,7 @@ if (FREERDP_UNIFIED_BUILD)
include_directories(${PROJECT_BINARY_DIR}/winpr/include)
else()
find_package(WinPR 3 REQUIRED)
include_directories(SYSTEM ${WinPR_INCLUDE_DIR})
include_directories(SYSTEM ${WinPR_INCLUDE_DIR})
endif()
option(WITH_AAD "Compile with support for Azure AD authentication" ${WITH_WINPR_JSON})
@ -708,7 +708,7 @@ include_directories(${CMAKE_CURRENT_SOURCE_DIR}/include)
if(WITH_THIRD_PARTY)
add_subdirectory(third-party)
if (NOT "${THIRD_PARTY_INCLUDES}" STREQUAL "")
include_directories(SYSTEM ${THIRD_PARTY_INCLUDES})
include_directories(SYSTEM ${THIRD_PARTY_INCLUDES})
endif()
endif()
@ -744,7 +744,7 @@ endif()
set(FREERDP_BUILD_CONFIG_LIST "")
GET_CMAKE_PROPERTY(res VARIABLES)
FOREACH(var ${res})
IF (var MATCHES "^WITH_*|^BUILD_TESTING|^WINPR_HAVE_*")
IF (var MATCHES "^WITH_*|^BUILD_TESTING*|^WINPR_HAVE_*")
LIST(APPEND FREERDP_BUILD_CONFIG_LIST "${var}=${${var}}")
ENDIF()
ENDFOREACH()

View File

@ -53,6 +53,6 @@ target_link_libraries(rdpear-common INTERFACE
channel_install(rdpear-common ${FREERDP_ADDIN_PATH} "FreeRDPTargets")
if (BUILD_TESTING)
if (BUILD_TESTING_INTERNAL OR BUILD_TESTING)
add_subdirectory(test)
endif()

View File

@ -7,10 +7,15 @@ set(TEST_RDPEAR_DRIVER TestRdpear.c)
disable_warnings_for_directory(${CMAKE_CURRENT_BINARY_DIR})
set(TEST_RDPEAR_TESTS
TestNdr.c
TestNdrEar.c
TestNdr.c
)
if (BUILD_TESTING_INTERNAL)
list(APPEND TEST_RDPEAR_TESTS
TestNdrEar.c
)
endif()
create_test_sourcelist(TEST_RDPEAR_SRCS
TestRdpear.c
${TEST_RDPEAR_TESTS}

View File

@ -1,9 +1,8 @@
message("PRELOADING cache")
set (CMAKE_VERBOSE_MAKEFILE ON CACHE BOOL "preload")
set (BUILD_TESTING ON CACHE BOOL "preload")
set (BUILD_TESTING_INTERNAL ON CACHE BOOL "preload")
set (WITH_MANPAGES ON CACHE BOOL "preload")
set (CMAKE_BUILD_TYPE "preload" CACHE STRING "preload")
set (BUILD_TESTING ON CACHE BOOL "preload")
set (WITH_PULSE ON CACHE BOOL "preload")
set (WITH_CHANNELS ON CACHE BOOL "preload")
set (WITH_CUPS ON CACHE BOOL "preload")

View File

@ -7,7 +7,7 @@ set (CHANNEL_URBDRC OFF CACHE BOOL "USB redirection")
set (WITH_X11 ON CACHE BOOL "Enable X11")
set (WITH_SERVER ON CACHE BOOL "build with server")
set (WITH_SAMPLE ON CACHE BOOL "build with sample")
set (BUILD_TESTING ON CACHE BOOL "build testing")
set (BUILD_TESTING_INTERNAL ON CACHE BOOL "build testing")
set (WITH_SANITIZE_ADDRESS ON CACHE BOOL "build with address sanitizer")
set (WITH_FREERDP_DEPRECATED_COMMANDLINE ON CACHE BOOL "Enable deprecated command line options")
set (WITH_KRB5 OFF CACHE BOOL "Kerberos support")

View File

@ -25,4 +25,4 @@ set (BUILD_SHARED_LIBS OFF CACHE BOOL "oss fuzz")
set (BUILD_WITH_CLANG_TIDY OFF CACHE BOOL "oss fuzz")
set (OSS_FUZZ ON CACHE BOOL "oss fuzz")
set (BUILD_FUZZERS ON CACHE BOOL "oss fuzz")
set (BUILD_TESTING ON CACHE BOOL "oss fuzz")
set (BUILD_TESTING_INTERNAL ON CACHE BOOL "oss fuzz")

View File

@ -1,4 +1,4 @@
set (BUILD_TESTING ON CACHE BOOL "qa default")
set (BUILD_TESTING_INTERNAL ON CACHE BOOL "qa default")
set (CMAKE_VERBOSE_MAKEFILE ON CACHE BOOL "preload")
set (ENABLE_WARNING_VERBOSE ON CACHE BOOL "preload")
set (WITH_MANPAGES ON CACHE BOOL "qa default")

View File

@ -7,7 +7,7 @@ set (WITH_KRB5 ON CACHE BOOL "Kerberos support")
set (WITH_ALSA OFF CACHE BOOL "alsa audio")
set (WITH_FFMPEG OFF CACHE BOOL "ffmepg support")
set (WITH_XV OFF CACHE BOOL "xvideo support")
set (BUILD_TESTING ON CACHE BOOL "build testing")
set (BUILD_TESTING_INTERNAL ON CACHE BOOL "build testing")
set (WITH_XSHM OFF CACHE BOOL "build with xshm support")
set (WITH_SERVER ON CACHE BOOL "build with server")
set (WITH_SAMPLE ON CACHE BOOL "build with sample")

View File

@ -12,7 +12,7 @@ set (WITH_PLATFORM_SERVER OFF CACHE BOOL "Do not build platform server")
set (WITH_CLIENT_SDL ON CACHE BOOL "build with SDL client")
set (WITH_PROXY_MODULES "ON" CACHE BOOL "build proxy modules")
set (CHANNEL_URBDRC OFF CACHE BOOL "USB redirection")
set (BUILD_TESTING ON CACHE BOOL "build testing")
set (BUILD_TESTING_INTERNAL ON CACHE BOOL "build testing")
set (WITH_FFMPEG OFF CACHE BOOL "ci default")
set (WITH_SWSCALE OFF CACHE BOOL "ci default")
set (WITH_WEBVIEW ON CACHE BOOL "ci default")

View File

@ -70,6 +70,6 @@ add_library(sdl2-dialogs STATIC
target_link_libraries(sdl2-dialogs PRIVATE ${LIBS})
if(BUILD_TESTING)
if(BUILD_TESTING_INTERNAL OR BUILD_TESTING)
# add_subdirectory(test)
endif()

View File

@ -26,6 +26,6 @@ add_library(sdl-common-prefs STATIC
)
target_link_libraries(sdl-common-prefs winpr freerdp)
if(BUILD_TESTING)
if(BUILD_TESTING_INTERNAL OR BUILD_TESTING)
add_subdirectory(test)
endif()

View File

@ -81,7 +81,7 @@ install(TARGETS ${MODULE_NAME} COMPONENT libraries EXPORT FreeRDP-ClientTargets
set_property(TARGET ${MODULE_NAME} PROPERTY FOLDER "Client/Common")
if(BUILD_TESTING)
if(BUILD_TESTING_INTERNAL OR BUILD_TESTING)
add_subdirectory(test)
endif()

View File

@ -51,9 +51,10 @@ if(WIN32 AND NOT UWP)
option(WITH_WIN8 "Use Windows 8 libraries" OFF)
endif()
option(BUILD_TESTING "Build unit tests" OFF)
CMAKE_DEPENDENT_OPTION(TESTS_WTSAPI_EXTRA "Build extra WTSAPI tests (interactive)" OFF "BUILD_TESTING" OFF)
CMAKE_DEPENDENT_OPTION(BUILD_COMM_TESTS "Build comm related tests (require comm port)" OFF "BUILD_TESTING" OFF)
option(BUILD_TESTING "Build unit tests (compatible with packaging)" OFF)
CMAKE_DEPENDENT_OPTION(BUILD_TESTING_INTERNAL "Build unit tests (CI only, not for packaging!)" OFF "NOT BUILD_TESTING" OFF)
CMAKE_DEPENDENT_OPTION(TESTS_WTSAPI_EXTRA "Build extra WTSAPI tests (interactive)" OFF "BUILD_TESTING_INTERNAL" OFF)
CMAKE_DEPENDENT_OPTION(BUILD_COMM_TESTS "Build comm related tests (require comm port)" OFF "BUILD_TESTING_INTERNAL" OFF)
option(WITH_SAMPLE "Build sample code" ON)
@ -205,7 +206,7 @@ if (BUILD_FUZZERS)
"\n")
endif ()
set(BUILD_TESTING ON)
set(BUILD_TESTING_INTERNAL ON CACHE BOOL "fuzzer default" FORCE)
if (BUILD_SHARED_LIBS STREQUAL "OFF")
set(CMAKE_FIND_LIBRARY_SUFFIXES ".a")

View File

@ -160,6 +160,6 @@ add_library(freerdp-codecs OBJECT
freerdp_library_add(${CODEC_LIBS})
freerdp_object_library_add(freerdp-codecs)
if(BUILD_TESTING)
if(BUILD_TESTING_INTERNAL OR BUILD_TESTING)
add_subdirectory(test)
endif()

View File

@ -4,34 +4,40 @@ set(MODULE_PREFIX "TEST_FREERDP_CODEC")
disable_warnings_for_directory(${CMAKE_CURRENT_BINARY_DIR})
set(${MODULE_PREFIX}_DRIVER ${MODULE_NAME}.c)
set(DRIVER ${MODULE_NAME}.c)
set(${MODULE_PREFIX}_TESTS
TestFreeRDPRegion.c
TestFreeRDPCodecMppc.c
TestFreeRDPCodecNCrush.c
TestFreeRDPCodecXCrush.c
TestFreeRDPCodecZGfx.c
TestFreeRDPCodecPlanar.c
set(TESTS
TestFreeRDPRegion.c
TestFreeRDPCodecZGfx.c
TestFreeRDPCodecPlanar.c
TestFreeRDPCodecCopy.c
TestFreeRDPCodecClear.c
TestFreeRDPCodecInterleaved.c
TestFreeRDPCodecProgressive.c
TestFreeRDPCodecRemoteFX.c)
TestFreeRDPCodecClear.c
TestFreeRDPCodecInterleaved.c
TestFreeRDPCodecProgressive.c
TestFreeRDPCodecRemoteFX.c
)
create_test_sourcelist(${MODULE_PREFIX}_SRCS
${${MODULE_PREFIX}_DRIVER}
${${MODULE_PREFIX}_TESTS})
if (BUILD_TESTING_INTERNAL)
list(APPEND TESTS
TestFreeRDPCodecMppc.c
TestFreeRDPCodecNCrush.c
TestFreeRDPCodecXCrush.c
)
endif()
create_test_sourcelist(SRCS
${DRIVER}
${TESTS})
add_definitions(-DCMAKE_CURRENT_SOURCE_DIR="${CMAKE_CURRENT_SOURCE_DIR}")
add_definitions(-DCMAKE_CURRENT_BINARY_DIR="${CMAKE_CURRENT_BINARY_DIR}")
add_executable(${MODULE_NAME} ${${MODULE_PREFIX}_SRCS})
add_executable(${MODULE_NAME} ${SRCS})
target_link_libraries(${MODULE_NAME} freerdp winpr)
set_target_properties(${MODULE_NAME} PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${TESTING_OUTPUT_DIRECTORY}")
foreach(test ${${MODULE_PREFIX}_TESTS})
foreach(test ${TESTS})
get_filename_component(TestName ${test} NAME_WE)
add_test(${TestName} ${TESTING_OUTPUT_DIRECTORY}/${MODULE_NAME} ${TestName})
endforeach()

View File

@ -28,6 +28,6 @@ set(${MODULE_PREFIX}_SRCS
freerdp_module_add(${${MODULE_PREFIX}_SRCS})
if(BUILD_TESTING)
if(BUILD_TESTING_INTERNAL OR BUILD_TESTING)
add_subdirectory(test)
endif()

View File

@ -159,6 +159,6 @@ endif()
freerdp_library_add(${OPENSSL_LIBRARIES})
if(BUILD_TESTING)
if(BUILD_TESTING_INTERNAL OR BUILD_TESTING)
add_subdirectory(test)
endif()

View File

@ -63,7 +63,7 @@ static UINT32 crc32b(const BYTE* data, size_t length)
return ~crc;
}
#if !defined(BUILD_TESTING)
#if !defined(BUILD_TESTING_INTERNAL)
static
#endif
BOOL
@ -124,7 +124,7 @@ fail:
return rc;
}
#if !defined(BUILD_TESTING)
#if !defined(BUILD_TESTING_INTERNAL)
static
#endif
BOOL

View File

@ -26,7 +26,7 @@
#include <winpr/wtypes.h>
#include <winpr/stream.h>
#if !defined(BUILD_TESTING)
#if !defined(BUILD_TESTING_INTERNAL)
static
#else
FREERDP_LOCAL
@ -34,10 +34,10 @@ FREERDP_LOCAL
BOOL
stream_dump_read_line(FILE* fp, wStream* s, UINT64* pts, size_t* pOffset, UINT32* flags);
#if !defined(BUILD_TESTING)
#if !defined(BUILD_TESTING_INTERNAL)
static
#else
FREERDP_LOCAL
FREERDP_LOCAL
#endif
BOOL
stream_dump_write_line(FILE* fp, UINT32 flags, wStream* s);

View File

@ -4,33 +4,40 @@ set(MODULE_PREFIX "TEST_CORE")
disable_warnings_for_directory(${CMAKE_CURRENT_BINARY_DIR})
set(${MODULE_PREFIX}_DRIVER ${MODULE_NAME}.c)
set(DRIVER ${MODULE_NAME}.c)
set(${MODULE_PREFIX}_TESTS
TestVersion.c
TestStreamDump.c
set(TESTS
TestVersion.c
TestSettings.c)
if (BUILD_TESTING_INTERNAL)
list(APPEND TESTS
TestStreamDump.c
)
endif()
set(FUZZERS
TestFuzzCoreClient.c
TestFuzzCoreServer.c
TestFuzzCryptoCertificateDataSetPEM.c
)
if(WITH_SAMPLE AND WITH_SERVER AND NOT WIN32)
# Test not compatible with package tests, disable
if(WITH_SAMPLE AND WITH_SERVER AND NOT WIN32 AND BUILD_TESTING_INTERNAL)
add_definitions(-DCMAKE_EXECUTABLE_SUFFIX="${CMAKE_EXECUTABLE_SUFFIX}")
set(${MODULE_PREFIX}_TESTS
${${MODULE_PREFIX}_TESTS}
TestConnect.c)
set(TESTS
${TESTS}
TestConnect.c
)
else()
message("Skipping connection tests, requires WITH_SAMPLE and WITH_SERVER set!")
message("Skipping connection tests, requires BUILD_TESTING_INTERNAL, WITH_SAMPLE and WITH_SERVER set!")
endif()
create_test_sourcelist(${MODULE_PREFIX}_SRCS
${${MODULE_PREFIX}_DRIVER}
${${MODULE_PREFIX}_TESTS})
create_test_sourcelist(SRCS
${DRIVER}
${TESTS})
add_executable(${MODULE_NAME} ${${MODULE_PREFIX}_SRCS})
add_executable(${MODULE_NAME} ${SRCS})
add_definitions(-DTESTING_OUTPUT_DIRECTORY="${PROJECT_BINARY_DIR}")
add_definitions(-DTESTING_SRC_DIRECTORY="${PROJECT_SOURCE_DIR}")
@ -42,7 +49,7 @@ add_fuzzer_test("${FUZZERS}" "freerdp-client freerdp winpr")
set_target_properties(${MODULE_NAME} PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${TESTING_OUTPUT_DIRECTORY}")
foreach(test ${${MODULE_PREFIX}_TESTS})
foreach(test ${TESTS})
get_filename_component(TestName ${test} NAME_WE)
add_test(${TestName} ${TESTING_OUTPUT_DIRECTORY}/${MODULE_NAME} ${TestName})
endforeach()

View File

@ -1291,7 +1291,11 @@ static BOOL test_validity_check(void)
rc = log_result_case(FALSE, __func__, x);
else
{
#if defined(BUILD_TESTING_INTERNAL)
const BOOL res = freerdp_settings_check_client_after_preconnect(settings);
#else
const BOOL res = cur->expected;
#endif
if (res != cur->expected)
{
rc = log_result_case(FALSE, __func__, x);

View File

@ -52,6 +52,6 @@ if(WIN32)
freerdp_library_add(ws2_32)
endif()
if(BUILD_TESTING)
if(BUILD_TESTING_INTERNAL OR BUILD_TESTING)
add_subdirectory(test)
endif()

View File

@ -4,20 +4,26 @@ set(MODULE_PREFIX "TEST_FREERDP_CRYPTO")
disable_warnings_for_directory(${CMAKE_CURRENT_BINARY_DIR})
set(${MODULE_PREFIX}_DRIVER ${MODULE_NAME}.c)
set(DRIVER ${MODULE_NAME}.c)
set(${MODULE_PREFIX}_TESTS
set(TESTS
TestKnownHosts.c
TestBase64.c
Test_x509_utils.c)
TestBase64.c
)
create_test_sourcelist(${MODULE_PREFIX}_SRCS
${${MODULE_PREFIX}_DRIVER}
${${MODULE_PREFIX}_TESTS})
if (BUILD_TESTING_INTERNAL)
list(APPEND TESTS
Test_x509_utils.c
)
endif()
create_test_sourcelist(SRCS
${DRIVER}
${TESTS})
include_directories(SYSTEM ${OPENSSL_INCLUDE_DIR})
add_executable(${MODULE_NAME} ${${MODULE_PREFIX}_SRCS})
add_executable(${MODULE_NAME} ${SRCS})
set(TEST_PATH ${CMAKE_CURRENT_SOURCE_DIR})
@ -26,7 +32,7 @@ target_link_libraries(${MODULE_NAME} freerdp winpr ${OPENSSL_LIBRARIES})
set_target_properties(${MODULE_NAME} PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${TESTING_OUTPUT_DIRECTORY}")
foreach(test ${${MODULE_PREFIX}_TESTS})
foreach(test ${TESTS})
get_filename_component(TestName ${test} NAME_WE)
add_test(${TestName} ${TESTING_OUTPUT_DIRECTORY}/${MODULE_NAME} ${TestName})
endforeach()

View File

@ -34,7 +34,7 @@ file(GLOB ${MODULE_PREFIX}_SRCS
freerdp_module_add(${${MODULE_PREFIX}_SRCS})
if(BUILD_TESTING)
if(BUILD_TESTING_INTERNAL)
add_subdirectory(test)
endif()

View File

@ -104,6 +104,6 @@ endif()
freerdp_module_add(${SRCS})
if(BUILD_TESTING)
if(BUILD_TESTING_INTERNAL OR BUILD_TESTING)
add_subdirectory(test)
endif()

View File

@ -1,31 +1,33 @@
# Test not compatible with package tests, disable
if (BUILD_TESTING_INTERNAL)
set(MODULE_NAME "TestLocale")
set(MODULE_PREFIX "TEST_LOCALE")
set(MODULE_NAME "TestLocale")
set(MODULE_PREFIX "TEST_LOCALE")
disable_warnings_for_directory(${CMAKE_CURRENT_BINARY_DIR})
disable_warnings_for_directory(${CMAKE_CURRENT_BINARY_DIR})
set(DRIVER ${MODULE_NAME}.c)
set(DRIVER ${MODULE_NAME}.c)
set(TEST_SRCS
TestLocaleKeyboard.c
)
set(TEST_SRCS
TestLocaleKeyboard.c
)
create_test_sourcelist(SRCS
${DRIVER}
${TEST_SRCS})
create_test_sourcelist(SRCS
${DRIVER}
${TEST_SRCS})
add_executable(${MODULE_NAME} ${SRCS})
add_executable(${MODULE_NAME} ${SRCS})
add_definitions(-DTESTING_OUTPUT_DIRECTORY="${PROJECT_BINARY_DIR}")
add_definitions(-DTESTING_SRC_DIRECTORY="${PROJECT_SOURCE_DIR}")
add_definitions(-DTESTING_OUTPUT_DIRECTORY="${PROJECT_BINARY_DIR}")
add_definitions(-DTESTING_SRC_DIRECTORY="${PROJECT_SOURCE_DIR}")
target_link_libraries(${MODULE_NAME} freerdp winpr freerdp-client)
target_link_libraries(${MODULE_NAME} freerdp winpr freerdp-client)
set_target_properties(${MODULE_NAME} PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${TESTING_OUTPUT_DIRECTORY}")
set_target_properties(${MODULE_NAME} PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${TESTING_OUTPUT_DIRECTORY}")
foreach(test ${TEST_SRCS})
get_filename_component(TestName ${test} NAME_WE)
add_test(${TestName} ${TESTING_OUTPUT_DIRECTORY}/${MODULE_NAME} ${TestName})
endforeach()
foreach(test ${TEST_SRCS})
get_filename_component(TestName ${test} NAME_WE)
add_test(${TestName} ${TESTING_OUTPUT_DIRECTORY}/${MODULE_NAME} ${TestName})
endforeach()
set_property(TARGET ${MODULE_NAME} PROPERTY FOLDER "FreeRDP/Locale/Test")
set_property(TARGET ${MODULE_NAME} PROPERTY FOLDER "FreeRDP/Locale/Test")
endif()

View File

@ -145,6 +145,6 @@ endif()
freerdp_object_library_add(freerdp-primitives)
if(BUILD_TESTING AND NOT WIN32 AND NOT APPLE)
if(BUILD_TESTING_INTERNAL AND NOT WIN32 AND NOT APPLE)
add_subdirectory(test)
endif()

View File

@ -54,6 +54,6 @@ if (HAVE_LIB_M)
freerdp_library_add(m)
endif()
if(BUILD_TESTING)
if(BUILD_TESTING_INTERNAL OR BUILD_TESTING)
add_subdirectory(test)
endif()

View File

@ -33,7 +33,7 @@ if (NOT FREERDP_UNIFIED_BUILD)
set(WINPR_VERSION_MAJOR 3)
option(EXPORT_ALL_SYMBOLS "Export all symbols form library" OFF)
option(BUILD_TESTING "Build library unit tests" ON)
option(BUILD_TESTING_INTERNAL "Build library unit tests" ON)
if(CMAKE_COMPILER_IS_GNUCC)
if(NOT EXPORT_ALL_SYMBOLS)

View File

@ -45,7 +45,7 @@ target_link_libraries(${MODULE_NAME} PRIVATE ${${MODULE_PREFIX}_LIBS})
set_property(TARGET ${MODULE_NAME} PROPERTY FOLDER "RdTk")
if(BUILD_TESTING)
if(BUILD_TESTING_INTERNAL OR BUILD_TESTING)
add_subdirectory(test)
endif()

View File

@ -20,7 +20,7 @@ endif()
set(RDTK_BUILD_CONFIG_LIST "")
GET_CMAKE_PROPERTY(res VARIABLES)
FOREACH(var ${res})
IF (var MATCHES "^WITH_*|^BUILD_TESTING|^RDTK_HAVE_*")
IF (var MATCHES "^WITH_*|^BUILD_TESTING*|^RDTK_HAVE_*")
LIST(APPEND RDTK_BUILD_CONFIG_LIST "${var}=${${var}}")
ENDIF()
ENDFOREACH()

View File

@ -32,7 +32,7 @@ if (NOT FREERDP_UNIFIED_BUILD)
set(CMAKE_C_EXTENSIONS ON)
option(EXPORT_ALL_SYMBOLS "Export all symbols form library" OFF)
option(BUILD_TESTING "Build library unit tests" ON)
option(BUILD_TESTING_INTERNAL "Build library unit tests" ON)
if(CMAKE_COMPILER_IS_GNUCC)
if(NOT EXPORT_ALL_SYMBOLS)

View File

@ -100,6 +100,6 @@ endif()
set_property(TARGET ${MODULE_NAME} PROPERTY FOLDER "uwac")
if(BUILD_TESTING)
if(BUILD_TESTING_INTERNAL OR BUILD_TESTING)
# add_subdirectory(test)
endif()

View File

@ -28,7 +28,7 @@ endif()
set(UWAC_BUILD_CONFIG_LIST "")
GET_CMAKE_PROPERTY(res VARIABLES)
FOREACH(var ${res})
IF (var MATCHES "^WITH_*|^BUILD_TESTING|^UWAC_HAVE_*")
IF (var MATCHES "^WITH_*|^BUILD_TESTING*|^UWAC_HAVE_*")
LIST(APPEND UWAC_BUILD_CONFIG_LIST "${var}=${${var}}")
ENDIF()
ENDFOREACH()

View File

@ -333,7 +333,7 @@ if(WITH_WINPR_TOOLS)
add_subdirectory(tools)
endif()
if(BUILD_TESTING)
if(BUILD_TESTING_INTERNAL OR BUILD_TESTING)
add_subdirectory(test)
endif()

View File

@ -23,6 +23,6 @@ winpr_module_add(
synthetic_file.c
)
if(BUILD_TESTING)
if(BUILD_TESTING_INTERNAL OR BUILD_TESTING)
add_subdirectory(test)
endif()

View File

@ -4,12 +4,17 @@ set(MODULE_PREFIX "TEST_CLIPBOARD")
disable_warnings_for_directory(${CMAKE_CURRENT_BINARY_DIR})
set(${MODULE_PREFIX}_DRIVER ${MODULE_NAME}.c)
set(DRIVER ${MODULE_NAME}.c)
set(${MODULE_PREFIX}_TESTS
TestUri.c
set(TESTS
TestClipboardFormats.c)
if (BUILD_TESTING_INTERNAL)
list(APPEND TESTS
TestUri.c
)
endif()
set(TEST_CLIP_PNG "${CMAKE_SOURCE_DIR}/resources/FreeRDP_Icon.png")
file(TO_NATIVE_PATH "${TEST_CLIP_PNG}" TEST_CLIP_PNG)
@ -24,17 +29,17 @@ endif()
add_definitions(-DTEST_CLIP_BMP="${TEST_CLIP_BMP}")
add_definitions(-DTEST_CLIP_PNG="${TEST_CLIP_PNG}")
create_test_sourcelist(${MODULE_PREFIX}_SRCS
${${MODULE_PREFIX}_DRIVER}
${${MODULE_PREFIX}_TESTS})
create_test_sourcelist(SRCS
${DRIVER}
${TESTS})
add_executable(${MODULE_NAME} ${${MODULE_PREFIX}_SRCS})
add_executable(${MODULE_NAME} ${SRCS})
target_link_libraries(${MODULE_NAME} winpr)
set_target_properties(${MODULE_NAME} PROPERTIES RUNTIME_OUTPUT_DIRECTORY
"${TESTING_OUTPUT_DIRECTORY}")
foreach(test ${${MODULE_PREFIX}_TESTS})
foreach(test ${TESTS})
get_filename_component(TestName ${test} NAME_WE)
add_test(${TestName} ${TESTING_OUTPUT_DIRECTORY}/${MODULE_NAME} ${TestName})
endforeach()

View File

@ -41,7 +41,7 @@ if (NOT WIN32)
winpr_module_add(${${MODULE_PREFIX}_SRCS})
if(UNIX AND NOT IOS AND NOT EMSCRIPTEN)
if(BUILD_TESTING AND BUILD_COMM_TESTS)
if(BUILD_TESTING_INTERNAL AND BUILD_COMM_TESTS)
add_subdirectory(test)
endif()
endif()

View File

@ -41,6 +41,6 @@ endif()
winpr_module_add(${CRT_FILES})
if(BUILD_TESTING)
if(BUILD_TESTING_INTERNAL OR BUILD_TESTING)
add_subdirectory(test)
endif()

View File

@ -54,6 +54,6 @@ if(WIN32)
winpr_library_add_public(crypt32)
endif()
if(BUILD_TESTING)
if(BUILD_TESTING_INTERNAL OR BUILD_TESTING)
add_subdirectory(test)
endif()

View File

@ -21,6 +21,6 @@ if(WIN32)
winpr_library_add_public(ntdsapi)
endif()
if(BUILD_TESTING)
if(BUILD_TESTING_INTERNAL OR BUILD_TESTING)
add_subdirectory(test)
endif()

View File

@ -17,6 +17,6 @@
winpr_module_add(environment.c)
if(BUILD_TESTING)
if(BUILD_TESTING_INTERNAL OR BUILD_TESTING)
add_subdirectory(test)
endif()

View File

@ -17,6 +17,6 @@
winpr_module_add(error.c)
if(BUILD_TESTING)
if(BUILD_TESTING_INTERNAL OR BUILD_TESTING)
add_subdirectory(test)
endif()

View File

@ -23,6 +23,6 @@ winpr_module_add(
file.c
)
if(BUILD_TESTING)
if(BUILD_TESTING_INTERNAL OR BUILD_TESTING)
add_subdirectory(test)
endif()

View File

@ -17,6 +17,6 @@
winpr_module_add(interlocked.c)
if(BUILD_TESTING)
if(BUILD_TESTING_INTERNAL OR BUILD_TESTING)
add_subdirectory(test)
endif()

View File

@ -17,6 +17,6 @@
winpr_module_add(device.c io.c io.h)
if(BUILD_TESTING)
if(BUILD_TESTING_INTERNAL OR BUILD_TESTING)
add_subdirectory(test)
endif()

View File

@ -17,6 +17,6 @@
winpr_module_add(library.c)
if(BUILD_TESTING)
if(BUILD_TESTING_INTERNAL OR BUILD_TESTING)
add_subdirectory(test)
endif()

View File

@ -17,6 +17,6 @@
winpr_module_add(memory.c memory.h)
if(BUILD_TESTING)
if(BUILD_TESTING_INTERNAL OR BUILD_TESTING)
add_subdirectory(test)
endif()

View File

@ -31,6 +31,6 @@ if (WIN32)
winpr_library_add_public(ncrypt)
endif()
if(BUILD_TESTING)
if(BUILD_TESTING_INTERNAL OR BUILD_TESTING)
add_subdirectory(test)
endif()

View File

@ -21,6 +21,6 @@ winpr_library_add_private(
${CMAKE_THREAD_LIBS_INIT}
${CMAKE_DL_LIBS})
if(BUILD_TESTING)
if(BUILD_TESTING_INTERNAL OR BUILD_TESTING)
add_subdirectory(test)
endif()

View File

@ -27,6 +27,6 @@ if (IOS)
winpr_module_add(shell_ios.m)
endif (IOS)
if(BUILD_TESTING)
if(BUILD_TESTING_INTERNAL OR BUILD_TESTING)
add_subdirectory(test)
endif()

View File

@ -17,6 +17,6 @@
winpr_module_add(pipe.c pipe.h)
if(BUILD_TESTING)
if(BUILD_TESTING_INTERNAL OR BUILD_TESTING)
add_subdirectory(test)
endif()

View File

@ -30,7 +30,7 @@ winpr_library_add_private(
${CMAKE_THREAD_LIBS_INIT}
${CMAKE_DL_LIBS})
if(BUILD_TESTING)
if(BUILD_TESTING_INTERNAL OR BUILD_TESTING)
add_subdirectory(test)
endif()

View File

@ -17,6 +17,6 @@
winpr_module_add(security.c)
if(BUILD_TESTING)
if(BUILD_TESTING_INTERNAL OR BUILD_TESTING)
add_subdirectory(test)
endif()

View File

@ -54,7 +54,7 @@ if(PCSC_WINPR_FOUND)
winpr_library_add_private(${PCSC_WINPR_LIBRARY})
endif()
if(BUILD_TESTING)
if(BUILD_TESTING_INTERNAL OR BUILD_TESTING)
add_subdirectory(test)
endif()

View File

@ -124,6 +124,6 @@ if(WIN32)
winpr_library_add_public(ws2_32)
endif()
if(BUILD_TESTING)
if(BUILD_TESTING_INTERNAL OR BUILD_TESTING)
add_subdirectory(test)
endif()

View File

@ -35,6 +35,6 @@ if(FREEBSD)
winpr_library_add_private(${EPOLLSHIM_LIBS})
endif()
if(BUILD_TESTING)
if(BUILD_TESTING_INTERNAL OR BUILD_TESTING)
add_subdirectory(test)
endif()

View File

@ -25,7 +25,7 @@ if((NOT WIN32) AND (NOT APPLE) AND (NOT ANDROID) AND (NOT OPENBSD))
winpr_library_add_private(rt)
endif()
if(BUILD_TESTING)
if(BUILD_TESTING_INTERNAL OR BUILD_TESTING)
add_subdirectory(test)
endif()

View File

@ -25,6 +25,6 @@ winpr_module_add(
thread.h
tls.c)
if(BUILD_TESTING)
if(BUILD_TESTING_INTERNAL OR BUILD_TESTING)
add_subdirectory(test)
endif()

View File

@ -241,6 +241,6 @@ if(WIN32)
winpr_library_add_public(dbghelp)
endif()
if(BUILD_TESTING)
if(BUILD_TESTING_INTERNAL OR BUILD_TESTING)
add_subdirectory(test)
endif()

View File

@ -25,6 +25,6 @@ if(WIN32)
endif()
endif()
if(BUILD_TESTING)
if(BUILD_TESTING_INTERNAL OR BUILD_TESTING)
add_subdirectory(test)
endif()