2022-05-06 16:49:46 +00:00
# Copyright (c) 2017 - 2022 LiteSpeed Technologies Inc. See LICENSE.
2020-05-17 16:42:32 +00:00
INCLUDE_DIRECTORIES ( ../src/liblsquic )
2018-03-30 14:57:17 +00:00
2019-01-30 20:28:35 +00:00
ENABLE_TESTING ( )
2018-03-30 18:05:18 +00:00
2019-09-11 15:27:58 +00:00
SET ( CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DLSQUIC_TEST=1" )
2019-01-30 20:28:35 +00:00
IF ( MSVC )
SET ( LIB_FLAGS "-FORCE:MULTIPLE" )
2018-03-12 22:25:01 +00:00
ELSE ( )
2019-01-30 20:28:35 +00:00
SET ( CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-unused-value" )
2019-09-11 15:27:58 +00:00
IF ( CMAKE_C_COMPILER_ID STREQUAL GNU )
SET ( CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-override-init" )
ENDIF ( )
IF ( CMAKE_C_COMPILER_ID STREQUAL Clang )
SET ( CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-initializer-overrides" )
ENDIF ( )
2018-03-12 22:25:01 +00:00
ENDIF ( )
2020-05-17 16:42:32 +00:00
include_directories ( ../src/liblsquic/ls-qpack )
INCLUDE_DIRECTORIES ( ../src/lshpack )
2019-09-11 15:27:58 +00:00
2019-01-30 20:28:35 +00:00
SET ( TESTS
2019-09-11 15:27:58 +00:00
a c k
2019-01-30 20:28:35 +00:00
a c k g e n _ g q u i c _ b e
a c k p a r s e _ g q u i c _ b e
2019-11-11 19:05:54 +00:00
a c k p a r s e _ i e t f
2019-01-30 20:28:35 +00:00
a l a r m s e t
2019-09-11 15:27:58 +00:00
a l t _ s v c _ v e r
2019-01-30 20:28:35 +00:00
a r r
a t t q
b l o c k e d _ g q u i c _ b e
2019-09-11 15:27:58 +00:00
b w _ s a m p l e r
2019-01-30 20:28:35 +00:00
c o n n _ c l o s e _ g q u i c _ b e
2019-09-11 15:27:58 +00:00
c r y p t o _ g e n
2019-01-30 20:28:35 +00:00
c u b i c
d e c
d i _ n o c o p y
e l i s i o n
e n g i n e _ c t o r
e x p o r t _ k e y
f r a m e _ c h o p
f r a m e _ r e a d e r
f r a m e _ w r i t e r
g o a w a y _ g q u i c _ b e
h k d f
2020-10-07 13:41:26 +00:00
h p i
2019-01-30 20:28:35 +00:00
l s q u i c _ h a s h
p a c k e t _ o u t
2020-07-29 15:33:52 +00:00
p a c k e t _ r e s i z e
2019-01-30 20:28:35 +00:00
p a c k n o _ l e n
p a r s e _ p a c k e t _ i n
2019-09-11 15:27:58 +00:00
p u r g a
q l o g
2019-01-30 20:28:35 +00:00
q u i c _ b e _ f l o a t s
r e g _ p k t _ h e a d e r g e n
r s t _ s t r e a m _ g q u i c _ b e
r t t
2019-09-11 15:27:58 +00:00
s e n d _ h e a d e r s
2019-01-30 20:28:35 +00:00
s e n h i s t
s e t
s f c w
2019-09-11 15:27:58 +00:00
s h i
2019-01-30 20:28:35 +00:00
s p i
s t o p _ w a i t i n g _ g q u i c _ b e
s t r e a m g e n
s t r e a m p a r s e
2020-05-06 13:35:33 +00:00
t o k g e n
2019-09-11 15:27:58 +00:00
t r a p a
v a r i n t
2019-01-30 20:28:35 +00:00
v e r _ n e g o
w u f _ g q u i c _ b e
)
IF ( CMAKE_SYSTEM_NAME STREQUAL "Linux" )
# Linux has fmemopen
SET ( TESTS ${ TESTS } frame_rw )
ENDIF ( )
2018-03-30 14:57:17 +00:00
2019-12-30 16:29:05 +00:00
IF ( NOT CMAKE_SYSTEM_NAME STREQUAL "Windows" )
# No regexes on Windows
SET ( TESTS ${ TESTS } ack_merge )
2020-06-03 04:13:30 +00:00
# No open_memstream() on Windows
SET ( TESTS ${ TESTS } hcsi_reader )
2021-02-12 14:02:52 +00:00
# Takes forever on Windows, for whatever reason. Or maybe it's the
# MS C compilers. Something to investigate... later.
LIST ( APPEND TESTS h3_framing )
2019-12-30 16:29:05 +00:00
ENDIF ( )
2019-02-04 13:59:11 +00:00
2019-01-30 20:28:35 +00:00
FOREACH ( TEST_NAME ${ TESTS } )
ADD_EXECUTABLE ( test_ ${ TEST_NAME } test_ ${ TEST_NAME } .c ${ ADDL_SOURCES } )
2021-12-15 16:38:20 +00:00
IF ( NOT MSVC )
TARGET_LINK_LIBRARIES ( test_ ${ TEST_NAME } ${ LIBS } ${ LIB_FLAGS } )
ELSE ( )
TARGET_LINK_LIBRARIES ( test_ ${ TEST_NAME } ${ LIBS } ${ GETOPT_LIB } ${ LIB_FLAGS } )
# copy any dependencies local to the tests
#IF (${CMAKE_VERSION} VERSION_LESS "3.21.0")
ADD_CUSTOM_COMMAND ( TARGET test_ ${ TEST_NAME } POST_BUILD
C O M M A N D $ { C M A K E _ C O M M A N D } - E c o p y \ " $ E N V { V C P K G _ R O O T } / i n s t a l l e d / x 6 4 - w i n d o w s $ < $ < C O N F I G : D e b u g > : / d e b u g > / b i n / g e t o p t . d l l \ " \ " $ < T A R G E T _ F I L E _ D I R : t e s t _ $ { T E S T _ N A M E } > \ "
C O M M A N D _ E X P A N D _ L I S T S
)
#ELSE()
# ADD_CUSTOM_COMMAND(TARGET test_${TEST_NAME} POST_BUILD
# COMMAND if not \"\"=="$<TARGET_RUNTIME_DLLS:test_${TEST_NAME}>" ${CMAKE_COMMAND} -E copy $<TARGET_RUNTIME_DLLS:test_${TEST_NAME}> $<TARGET_FILE_DIR:test_${TEST_NAME}>
# COMMAND_EXPAND_LISTS
# )
#ENDIF()
ENDIF ( )
2019-01-30 20:28:35 +00:00
ADD_TEST ( ${ TEST_NAME } test_ ${ TEST_NAME } )
ENDFOREACH ( )
ADD_EXECUTABLE ( test_stream test_stream.c ${ ADDL_SOURCES } )
TARGET_LINK_LIBRARIES ( test_stream ${ LIBS } ${ LIB_FLAGS } )
2021-12-15 16:38:20 +00:00
IF ( MSVC )
TARGET_LINK_LIBRARIES ( test_stream ${ GETOPT_LIB } )
ENDIF ( )
2019-01-30 20:28:35 +00:00
ADD_TEST ( stream test_stream )
ADD_TEST ( stream_hash test_stream -h )
ADD_TEST ( stream_A test_stream -A )
ADD_TEST ( stream_hash_A test_stream -A -h )
2020-06-03 04:13:30 +00:00
IF ( NOT MSVC )
2019-01-30 20:28:35 +00:00
ADD_EXECUTABLE ( graph_cubic graph_cubic.c ${ ADDL_SOURCES } )
TARGET_LINK_LIBRARIES ( graph_cubic ${ LIBS } )
2019-02-04 13:59:11 +00:00
2019-09-11 15:27:58 +00:00
ADD_EXECUTABLE ( mini_parse mini_parse.c ${ ADDL_SOURCES } )
TARGET_LINK_LIBRARIES ( mini_parse ${ LIBS } )
2020-06-03 04:13:30 +00:00
ENDIF ( )
2019-09-11 15:27:58 +00:00
2020-05-17 16:42:32 +00:00
ADD_EXECUTABLE ( test_min_heap test_min_heap.c ../src/liblsquic/lsquic_min_heap.c )
2019-12-11 14:38:58 +00:00
ADD_TEST ( min_heap test_min_heap )
2020-06-03 04:13:30 +00:00
SET ( MALO_SRC test_malo.c ../src/liblsquic/lsquic_malo.c )
2021-12-15 16:38:20 +00:00
ADD_EXECUTABLE ( test_malo_pooled ${ MALO_SRC } )
2020-06-03 04:13:30 +00:00
IF ( MSVC )
2021-12-15 16:38:20 +00:00
TARGET_LINK_LIBRARIES ( test_malo_pooled ${ GETOPT_LIB } )
2020-06-03 04:13:30 +00:00
ENDIF ( )
2019-09-11 15:27:58 +00:00
SET_TARGET_PROPERTIES ( test_malo_pooled
P R O P E R T I E S C O M P I L E _ F L A G S " $ { C M A K E _ C _ F L A G S } - D L S Q U I C _ U S E _ P O O L S = 1 " )
ADD_TEST ( malo_pooled test_malo_pooled )
2020-06-03 04:13:30 +00:00
ADD_EXECUTABLE ( test_malo_nopool ${ MALO_SRC } )
2021-12-15 16:38:20 +00:00
IF ( MSVC )
TARGET_LINK_LIBRARIES ( test_malo_nopool ${ GETOPT_LIB } )
ENDIF ( )
2019-09-11 15:27:58 +00:00
SET_TARGET_PROPERTIES ( test_malo_nopool
P R O P E R T I E S C O M P I L E _ F L A G S " $ { C M A K E _ C _ F L A G S } - D L S Q U I C _ U S E _ P O O L S = 0 " )
ADD_TEST ( malo_nopool test_malo_nopool )
2020-05-17 16:42:32 +00:00
ADD_EXECUTABLE ( test_minmax test_minmax.c ../src/liblsquic/lsquic_minmax.c )
2021-12-15 16:38:20 +00:00
IF ( MSVC )
TARGET_LINK_LIBRARIES ( test_minmax ${ GETOPT_LIB } )
ENDIF ( )
2019-09-11 15:27:58 +00:00
ADD_TEST ( minmax test_minmax )
2020-09-29 12:56:43 +00:00
ADD_EXECUTABLE ( test_rechist test_rechist.c ../src/liblsquic/lsquic_rechist.c )
ADD_TEST ( rechist test_rechist )
2020-10-07 13:41:26 +00:00
ADD_EXECUTABLE ( test_trechist test_trechist.c ../src/liblsquic/lsquic_trechist.c )
ADD_TEST ( trechist test_trechist )