serf-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From br...@apache.org
Subject svn commit: r1834270 - in /serf/trunk: CMakeLists.txt test/CMakeLists.txt
Date Sun, 24 Jun 2018 21:46:52 GMT
Author: brane
Date: Sun Jun 24 21:46:52 2018
New Revision: 1834270

URL: http://svn.apache.org/viewvc?rev=1834270&view=rev
Log:
Add the Serf test suite to the CMake build.

* CMakeLists.txt: Enable testing. And APR's CFLAGS and extra libs
   to the build configuration.

* test/CMakeLists.txt: Build all test programs and add all of the
   serf_response tests to the suite.

Modified:
    serf/trunk/CMakeLists.txt
    serf/trunk/test/CMakeLists.txt

Modified: serf/trunk/CMakeLists.txt
URL: http://svn.apache.org/viewvc/serf/trunk/CMakeLists.txt?rev=1834270&r1=1834269&r2=1834270&view=diff
==============================================================================
--- serf/trunk/CMakeLists.txt (original)
+++ serf/trunk/CMakeLists.txt Sun Jun 24 21:46:52 2018
@@ -18,6 +18,7 @@
 # ===================================================================
 
 cmake_minimum_required(VERSION 3.0.2)
+enable_testing()
 
 set(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/build")
 include(SerfVersion)
@@ -123,10 +124,14 @@ set(DEPENDENCY_LIBRARIES
     ${OPENSSL_LIBRARIES}
     ${ZLIB_LIBRARIES}
     ${APR_LIBRARIES}
+    ${APR_EXTRALIBS}
     ${APRUTIL_LIBRARIES}
+    ${APRUTIL_EXTRALIBS}
 )
 list(REMOVE_DUPLICATES DEPENDENCY_LIBRARIES)
 
+set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${APR_CFLAGS}")
+
 include_directories(BEFORE SYSTEM ${DEPENDENCY_INCLUDES})
 include_directories(${CMAKE_SOURCE_DIR})
 add_library(SerfStatic STATIC ${SOURCES})
@@ -138,4 +143,5 @@ set_target_properties(SerfStatic SerfSha
                       VERSION ${SERF_VERSION}
                       SOVERSION ${SERF_SOVERSION})
 
+set(SERF_SOURCE_DIR ${CMAKE_SOURCE_DIR})
 add_subdirectory(test)

Modified: serf/trunk/test/CMakeLists.txt
URL: http://svn.apache.org/viewvc/serf/trunk/test/CMakeLists.txt?rev=1834270&r1=1834269&r2=1834270&view=diff
==============================================================================
--- serf/trunk/test/CMakeLists.txt (original)
+++ serf/trunk/test/CMakeLists.txt Sun Jun 24 21:46:52 2018
@@ -34,8 +34,35 @@ set(TEST_ALL_SOURCES
     "MockHTTPinC/MockHTTP_server.c"
 )
 
+set(SIMPLE_TEST_TARGETS
+    "serf_get"
+    "serf_response"
+    "serf_request"
+    "serf_spider"
+    "serf_httpd"
+    "serf_bwtp"
+)
+
 add_definitions("-DMOCKHTTP_OPENSSL")
+
+foreach(TEST_TARGET ${SIMPLE_TEST_TARGETS})
+  add_executable(${TEST_TARGET} "${TEST_TARGET}.c")
+  add_dependencies(${TEST_TARGET} SerfStatic)
+  target_link_libraries(${TEST_TARGET} SerfStatic ${DEPENDENCY_LIBRARIES})
+endforeach()
+
 add_executable(test_all ${TEST_ALL_SOURCES})
 add_dependencies(test_all SerfStatic)
 target_link_libraries(test_all SerfStatic ${DEPENDENCY_LIBRARIES})
+
+file(GLOB RESPONSE_TEST_CASES "${CMAKE_CURRENT_SOURCE_DIR}/testcases/*.response")
+foreach(TEST_CASE ${RESPONSE_TEST_CASES})
+  get_filename_component(TEST_CASE_NAME ${TEST_CASE} NAME)
+  add_test(NAME "${TEST_CASE_NAME}" COMMAND serf_response "${TEST_CASE}")
+  list(APPEND RESPONS_TESTS "${TEST_CASE_NAME}")
+endforeach()
+
 add_test(NAME test_all COMMAND test_all)
+
+set_tests_properties(${RESPONS_TESTS} test_all PROPERTIES
+                     ENVIRONMENT srcdir=${SERF_SOURCE_DIR})



Mime
View raw message