Rename test/unittests to tests/ and test/ to bin/

This commit is contained in:
Dmitri Tikhonov 2020-05-17 12:42:32 -04:00
parent ecfd688117
commit 9a690580c9
92 changed files with 38 additions and 39 deletions

View file

@ -4,6 +4,10 @@ cmake_minimum_required(VERSION 2.8)
PROJECT(lsquic C) PROJECT(lsquic C)
OPTION(LSQUIC_FIU "Use Fault Injection in Userspace (FIU)" OFF)
OPTION(LSQUIC_BIN "Compile example binaries that use the library" ON)
OPTION(LSQUIC_TESTS "Compile library unit tests" ON)
IF (CMAKE_SYSTEM_NAME STREQUAL "Linux") IF (CMAKE_SYSTEM_NAME STREQUAL "Linux")
# If using older glibc, need to link with -lrt. See clock_getres(2). # If using older glibc, need to link with -lrt. See clock_getres(2).
EXECUTE_PROCESS( EXECUTE_PROCESS(
@ -25,8 +29,6 @@ ENDIF()
MESSAGE(STATUS "Build type: ${CMAKE_BUILD_TYPE}") MESSAGE(STATUS "Build type: ${CMAKE_BUILD_TYPE}")
OPTION(LSQUIC_FIU "Use Fault Injection in Userspace (FIU)" OFF)
IF (NOT "$ENV{EXTRA_CFLAGS}" MATCHES "-DLSQUIC_DEBUG_NEXT_ADV_TICK") IF (NOT "$ENV{EXTRA_CFLAGS}" MATCHES "-DLSQUIC_DEBUG_NEXT_ADV_TICK")
SET(MY_CMAKE_FLAGS "-DLSQUIC_DEBUG_NEXT_ADV_TICK=1") SET(MY_CMAKE_FLAGS "-DLSQUIC_DEBUG_NEXT_ADV_TICK=1")
ENDIF() ENDIF()
@ -171,7 +173,6 @@ IF(CMAKE_SYSTEM_NAME STREQUAL "FreeBSD" OR CMAKE_SYSTEM_NAME STREQUAL "Darwin")
link_directories( /usr/local/lib ) link_directories( /usr/local/lib )
ENDIF() ENDIF()
IF (NOT TESTS STREQUAL "NO")
# Find zlib and libevent header files and library files # Find zlib and libevent header files and library files
# TODO: libevent is not strictly necessary to build the library. # TODO: libevent is not strictly necessary to build the library.
FIND_PATH(ZLIB_INCLUDE_DIR NAMES zlib.h) FIND_PATH(ZLIB_INCLUDE_DIR NAMES zlib.h)
@ -193,6 +194,8 @@ IF(ZLIB_LIB)
ELSE() ELSE()
MESSAGE(STATUS "zlib not found") MESSAGE(STATUS "zlib not found")
ENDIF() ENDIF()
IF (LSQUIC_BIN)
FIND_PATH(EVENT_INCLUDE_DIR NAMES event2/event.h) FIND_PATH(EVENT_INCLUDE_DIR NAMES event2/event.h)
IF (EVENT_INCLUDE_DIR) IF (EVENT_INCLUDE_DIR)
INCLUDE_DIRECTORIES(${EVENT_INCLUDE_DIR}) INCLUDE_DIRECTORIES(${EVENT_INCLUDE_DIR})
@ -213,11 +216,11 @@ ELSE()
MESSAGE(STATUS "libevent not found") MESSAGE(STATUS "libevent not found")
ENDIF() ENDIF()
add_executable(http_server test/http_server.c test/prog.c test/test_common.c test/test_cert.c) add_executable(http_server bin/http_server.c bin/prog.c bin/test_common.c bin/test_cert.c)
add_executable(md5_server test/md5_server.c test/prog.c test/test_common.c test/test_cert.c) add_executable(md5_server bin/md5_server.c bin/prog.c bin/test_common.c bin/test_cert.c)
add_executable(md5_client test/md5_client.c test/prog.c test/test_common.c test/test_cert.c) add_executable(md5_client bin/md5_client.c bin/prog.c bin/test_common.c bin/test_cert.c)
add_executable(echo_server test/echo_server.c test/prog.c test/test_common.c test/test_cert.c) add_executable(echo_server bin/echo_server.c bin/prog.c bin/test_common.c bin/test_cert.c)
add_executable(echo_client test/echo_client.c test/prog.c test/test_common.c test/test_cert.c) add_executable(echo_client bin/echo_client.c bin/prog.c bin/test_common.c bin/test_cert.c)
SET(LIBS lsquic ${EVENT_LIB} ${BORINGSSL_LIB_ssl} ${BORINGSSL_LIB_crypto} ${ZLIB_LIB} ${LIBS}) SET(LIBS lsquic ${EVENT_LIB} ${BORINGSSL_LIB_ssl} ${BORINGSSL_LIB_crypto} ${ZLIB_LIB} ${LIBS})
@ -225,10 +228,10 @@ SET(LIBS lsquic ${EVENT_LIB} ${BORINGSSL_LIB_ssl} ${BORINGSSL_LIB_crypto} ${ZLIB
IF (NOT MSVC) IF (NOT MSVC)
add_executable(http_client add_executable(http_client
test/http_client.c bin/http_client.c
test/prog.c bin/prog.c
test/test_common.c bin/test_common.c
test/test_cert.c bin/test_cert.c
) )
LIST(APPEND LIBS pthread m) LIST(APPEND LIBS pthread m)
@ -236,9 +239,9 @@ LIST(APPEND LIBS pthread m)
ELSE() ELSE()
add_executable(http_client add_executable(http_client
test/http_client.c bin/http_client.c
test/prog.c bin/prog.c
test/test_common.c bin/test_common.c
wincompat/getopt.c wincompat/getopt.c
wincompat/getopt1.c wincompat/getopt1.c
) )
@ -253,16 +256,17 @@ TARGET_LINK_LIBRARIES(md5_client ${LIBS})
TARGET_LINK_LIBRARIES(echo_server ${LIBS}) TARGET_LINK_LIBRARIES(echo_server ${LIBS})
TARGET_LINK_LIBRARIES(echo_client ${LIBS}) TARGET_LINK_LIBRARIES(echo_client ${LIBS})
add_subdirectory(test) add_subdirectory(bin)
ENDIF() # TESTS ENDIF() # LSQUIC_BIN
add_subdirectory(src) add_subdirectory(src)
IF(CMAKE_BUILD_TYPE STREQUAL "Debug" AND NOT TESTS STREQUAL "NO") IF(LSQUIC_TESTS AND CMAKE_BUILD_TYPE STREQUAL "Debug")
# Our test framework relies on assertions, only compile if assertions are # Our test framework relies on assertions, only compile if assertions are
# enabled. # enabled.
# #
enable_testing() enable_testing()
add_subdirectory(tests)
ENDIF() ENDIF()

View file

@ -9,6 +9,7 @@ to the LiteSpeed Client Library:
- Zhang Chi -- libevent build fix on Darwin - Zhang Chi -- libevent build fix on Darwin
- Omar Roth -- Alpine Linux build and Crystal language bindings - Omar Roth -- Alpine Linux build and Crystal language bindings
- initlife (?) -- XCode build - initlife (?) -- XCode build
- Rahul Jadhav -- Android support
Thank you! Thank you!

View file

@ -10,14 +10,14 @@ framework and share many options.
Echo client and server Echo client and server
---------------------- ----------------------
Echo client and server (see test/echo_{client,server}.c) are for simple Echo client and server (see bin/echo_{client,server}.c) are for simple
line-based request and reply communication. Only one stream per connection line-based request and reply communication. Only one stream per connection
is supported for simplicity. The client reads input from stdin. is supported for simplicity. The client reads input from stdin.
MD5 client and server MD5 client and server
--------------------- ---------------------
See test/md5_{client,server}.c See bin/md5_{client,server}.c
MD5 server accepts connections, computes MD5 sum of streams' (one or more) MD5 server accepts connections, computes MD5 sum of streams' (one or more)
payload, and sends back the checksum. MD5 client sends one or more file payload, and sends back the checksum. MD5 client sends one or more file
@ -27,7 +27,7 @@ exercise different aspects of LSQUIC.
HTTP client and server HTTP client and server
---------------------- ----------------------
See test/http_{client,server}.c See bin/http_{client,server}.c
This pair of programs is to demonstrate how to use HTTP features of QUIC. This pair of programs is to demonstrate how to use HTTP features of QUIC.
HTTP server is interoperable with proto-quic's quic_client. HTTP server is interoperable with proto-quic's quic_client.

View file

@ -135,6 +135,8 @@ The library has been tested on the following platforms:
- i386 - i386
- MacOS - MacOS
- x86_64 - x86_64
- Android
- ARM
- Windows (this needs updating for the server part, now broken) - Windows (this needs updating for the server part, now broken)
- x86_64 - x86_64

View file

@ -24,11 +24,3 @@ INCLUDE(CheckIncludeFiles)
CHECK_INCLUDE_FILES(regex.h HAVE_REGEX) CHECK_INCLUDE_FILES(regex.h HAVE_REGEX)
CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/test_config.h.in ${CMAKE_CURRENT_SOURCE_DIR}/test_config.h) CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/test_config.h.in ${CMAKE_CURRENT_SOURCE_DIR}/test_config.h)
IF(CMAKE_BUILD_TYPE STREQUAL "Debug")
# Our test framework relies on assertions, only compile if assertions are
# enabled.
#
add_subdirectory(unittests)
enable_testing()
ENDIF()

View file

@ -4,8 +4,8 @@ Getting Started
Supported Platforms Supported Platforms
------------------- -------------------
LSQUIC compiles and runs on Linux, FreeBSD, and Mac OS. It has been LSQUIC compiles and runs on Linux, FreeBSD, Mac OS, and Android. It has been
tested on i386, x86_64, as well as Raspberry Pi. tested on i386, x86_64, and ARM (Raspberry Pi and Android).
Windows support is on the TODO list. Windows support is on the TODO list.

View file

@ -1,12 +1,12 @@
# Copyright (c) 2017 - 2020 LiteSpeed Technologies Inc. See LICENSE. # Copyright (c) 2017 - 2020 LiteSpeed Technologies Inc. See LICENSE.
INCLUDE_DIRECTORIES(../../src/liblsquic) INCLUDE_DIRECTORIES(../src/liblsquic)
ENABLE_TESTING() ENABLE_TESTING()
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DLSQUIC_TEST=1") SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DLSQUIC_TEST=1")
IF (MSVC) IF (MSVC)
SET(ADDL_SOURCES ../../wincompat/getopt.c ../../wincompat/getopt1.c) SET(ADDL_SOURCES ../wincompat/getopt.c ../wincompat/getopt1.c)
SET(LIB_FLAGS "-FORCE:MULTIPLE") SET(LIB_FLAGS "-FORCE:MULTIPLE")
ELSE() ELSE()
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-unused-value") SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-unused-value")
@ -18,8 +18,8 @@ ELSE()
ENDIF() ENDIF()
ENDIF() ENDIF()
include_directories(../../src/liblsquic/ls-qpack) include_directories(../src/liblsquic/ls-qpack)
INCLUDE_DIRECTORIES(../../src/lshpack) INCLUDE_DIRECTORIES(../src/lshpack)
SET(TESTS SET(TESTS
ack ack
@ -104,18 +104,18 @@ TARGET_LINK_LIBRARIES(graph_cubic ${LIBS})
ADD_EXECUTABLE(mini_parse mini_parse.c ${ADDL_SOURCES}) ADD_EXECUTABLE(mini_parse mini_parse.c ${ADDL_SOURCES})
TARGET_LINK_LIBRARIES(mini_parse ${LIBS}) TARGET_LINK_LIBRARIES(mini_parse ${LIBS})
ADD_EXECUTABLE(test_min_heap test_min_heap.c ../../src/liblsquic/lsquic_min_heap.c) ADD_EXECUTABLE(test_min_heap test_min_heap.c ../src/liblsquic/lsquic_min_heap.c)
ADD_TEST(min_heap test_min_heap) ADD_TEST(min_heap test_min_heap)
ADD_EXECUTABLE(test_malo_pooled test_malo.c ../../src/liblsquic/lsquic_malo.c) ADD_EXECUTABLE(test_malo_pooled test_malo.c ../src/liblsquic/lsquic_malo.c)
SET_TARGET_PROPERTIES(test_malo_pooled SET_TARGET_PROPERTIES(test_malo_pooled
PROPERTIES COMPILE_FLAGS "${CMAKE_C_FLAGS} -DLSQUIC_USE_POOLS=1") PROPERTIES COMPILE_FLAGS "${CMAKE_C_FLAGS} -DLSQUIC_USE_POOLS=1")
ADD_TEST(malo_pooled test_malo_pooled) ADD_TEST(malo_pooled test_malo_pooled)
ADD_EXECUTABLE(test_malo_nopool test_malo.c ../../src/liblsquic/lsquic_malo.c) ADD_EXECUTABLE(test_malo_nopool test_malo.c ../src/liblsquic/lsquic_malo.c)
SET_TARGET_PROPERTIES(test_malo_nopool SET_TARGET_PROPERTIES(test_malo_nopool
PROPERTIES COMPILE_FLAGS "${CMAKE_C_FLAGS} -DLSQUIC_USE_POOLS=0") PROPERTIES COMPILE_FLAGS "${CMAKE_C_FLAGS} -DLSQUIC_USE_POOLS=0")
ADD_TEST(malo_nopool test_malo_nopool) ADD_TEST(malo_nopool test_malo_nopool)
ADD_EXECUTABLE(test_minmax test_minmax.c ../../src/liblsquic/lsquic_minmax.c) ADD_EXECUTABLE(test_minmax test_minmax.c ../src/liblsquic/lsquic_minmax.c)
ADD_TEST(minmax test_minmax) ADD_TEST(minmax test_minmax)