CMakeLists.txt revision e483c091
1# Copyright (c) 2017 - 2021 LiteSpeed Technologies Inc. See LICENSE. 2INCLUDE_DIRECTORIES(../src/liblsquic) 3 4ENABLE_TESTING() 5 6SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DLSQUIC_TEST=1") 7 8IF (MSVC) 9 SET(ADDL_SOURCES ../wincompat/getopt.c ../wincompat/getopt1.c) 10 SET(LIB_FLAGS "-FORCE:MULTIPLE") 11ELSE() 12 SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-unused-value") 13 IF (CMAKE_C_COMPILER_ID STREQUAL GNU) 14 SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-override-init") 15 ENDIF() 16 IF (CMAKE_C_COMPILER_ID STREQUAL Clang) 17 SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-initializer-overrides") 18 ENDIF() 19ENDIF() 20 21include_directories(../src/liblsquic/ls-qpack) 22INCLUDE_DIRECTORIES(../src/lshpack) 23 24SET(TESTS 25 ack 26 ackgen_gquic_be 27 ackparse_gquic_be 28 ackparse_ietf 29 alarmset 30 alt_svc_ver 31 arr 32 attq 33 blocked_gquic_be 34 bw_sampler 35 conn_close_gquic_be 36 crypto_gen 37 cubic 38 dec 39 di_nocopy 40 elision 41 engine_ctor 42 export_key 43 frame_chop 44 frame_reader 45 frame_writer 46 goaway_gquic_be 47 hkdf 48 hpi 49 lsquic_hash 50 packet_out 51 packet_resize 52 packno_len 53 parse_packet_in 54 purga 55 qlog 56 quic_be_floats 57 reg_pkt_headergen 58 rst_stream_gquic_be 59 rtt 60 send_headers 61 senhist 62 set 63 sfcw 64 shi 65 spi 66 stop_waiting_gquic_be 67 streamgen 68 streamparse 69 tokgen 70 trapa 71 varint 72 ver_nego 73 wuf_gquic_be 74) 75 76IF (CMAKE_SYSTEM_NAME STREQUAL "Linux") 77 # Linux has fmemopen 78 SET(TESTS ${TESTS} frame_rw) 79ENDIF() 80 81IF (NOT CMAKE_SYSTEM_NAME STREQUAL "Windows") 82 # No regexes on Windows 83 SET(TESTS ${TESTS} ack_merge) 84 # No open_memstream() on Windows 85 SET(TESTS ${TESTS} hcsi_reader) 86 # Takes forever on Windows, for whatever reason. Or maybe it's the 87 # MS C compilers. Something to investigate... later. 88 LIST(APPEND TESTS h3_framing) 89ENDIF() 90 91 92FOREACH(TEST_NAME ${TESTS}) 93 ADD_EXECUTABLE(test_${TEST_NAME} test_${TEST_NAME}.c ${ADDL_SOURCES}) 94 TARGET_LINK_LIBRARIES(test_${TEST_NAME} ${LIBS} ${LIB_FLAGS}) 95 ADD_TEST(${TEST_NAME} test_${TEST_NAME}) 96ENDFOREACH() 97 98ADD_EXECUTABLE(test_stream test_stream.c ${ADDL_SOURCES}) 99TARGET_LINK_LIBRARIES(test_stream ${LIBS} ${LIB_FLAGS}) 100ADD_TEST(stream test_stream) 101ADD_TEST(stream_hash test_stream -h) 102ADD_TEST(stream_A test_stream -A) 103ADD_TEST(stream_hash_A test_stream -A -h) 104 105IF(NOT MSVC) 106ADD_EXECUTABLE(graph_cubic graph_cubic.c ${ADDL_SOURCES}) 107TARGET_LINK_LIBRARIES(graph_cubic ${LIBS}) 108 109ADD_EXECUTABLE(mini_parse mini_parse.c ${ADDL_SOURCES}) 110TARGET_LINK_LIBRARIES(mini_parse ${LIBS}) 111ENDIF() 112 113ADD_EXECUTABLE(test_min_heap test_min_heap.c ../src/liblsquic/lsquic_min_heap.c) 114ADD_TEST(min_heap test_min_heap) 115 116SET(MALO_SRC test_malo.c ../src/liblsquic/lsquic_malo.c) 117IF(MSVC) 118 LIST(APPEND MALO_SRC ../wincompat/getopt.c) 119ENDIF() 120ADD_EXECUTABLE(test_malo_pooled ${MALO_SRC}) 121SET_TARGET_PROPERTIES(test_malo_pooled 122 PROPERTIES COMPILE_FLAGS "${CMAKE_C_FLAGS} -DLSQUIC_USE_POOLS=1") 123ADD_TEST(malo_pooled test_malo_pooled) 124 125ADD_EXECUTABLE(test_malo_nopool ${MALO_SRC}) 126SET_TARGET_PROPERTIES(test_malo_nopool 127 PROPERTIES COMPILE_FLAGS "${CMAKE_C_FLAGS} -DLSQUIC_USE_POOLS=0") 128ADD_TEST(malo_nopool test_malo_nopool) 129 130ADD_EXECUTABLE(test_minmax test_minmax.c ../src/liblsquic/lsquic_minmax.c) 131ADD_TEST(minmax test_minmax) 132 133ADD_EXECUTABLE(test_rechist test_rechist.c ../src/liblsquic/lsquic_rechist.c) 134ADD_TEST(rechist test_rechist) 135 136ADD_EXECUTABLE(test_trechist test_trechist.c ../src/liblsquic/lsquic_trechist.c) 137ADD_TEST(trechist test_trechist) 138