mirror of
https://gitea.invidious.io/iv-org/litespeed-quic.git
synced 2024-08-15 00:53:43 +00:00
Resuscitate Windows build (#61)
This commit is contained in:
parent
12693a011b
commit
2d296031db
16 changed files with 148 additions and 478 deletions
|
@ -75,6 +75,7 @@ ENDIF()
|
|||
|
||||
#MSVC
|
||||
ELSE()
|
||||
SET(MY_CMAKE_FLAGS "${MY_CMAKE_FLAGS} /wd4214") # nonstandard extension used: bit field types other than int
|
||||
SET(MY_CMAKE_FLAGS "${MY_CMAKE_FLAGS} -W4 -WX -Zi -DWIN32_LEAN_AND_MEAN -DNOMINMAX -D_CRT_SECURE_NO_WARNINGS -I${CMAKE_CURRENT_SOURCE_DIR}/wincompat")
|
||||
IF(CMAKE_BUILD_TYPE STREQUAL "Debug")
|
||||
SET(MY_CMAKE_FLAGS "${MY_CMAKE_FLAGS} -Od")
|
||||
|
@ -87,12 +88,6 @@ ELSE()
|
|||
#SET(MY_CMAKE_FLAGS "${MY_CMAKE_FLAGS} -DLSQUIC_LOWEST_LOG_LEVEL=LSQ_LOG_INFO")
|
||||
ENDIF()
|
||||
|
||||
SET (BORINGSSL_INCLUDE ${CMAKE_CURRENT_SOURCE_DIR}/../boringssl/include)
|
||||
SET (VCPKG_INCLUDE ${CMAKE_CURRENT_SOURCE_DIR}/../vcpkg/installed/x64-windows-static/include )
|
||||
set (BORINGSSL_BASE_LIB_DIR ${CMAKE_CURRENT_SOURCE_DIR}/../boringssl)
|
||||
|
||||
SET (VCPKG_BASE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/../vcpkg/installed/x64-windows-static)
|
||||
|
||||
ENDIF() #MSVC
|
||||
|
||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${MY_CMAKE_FLAGS} $ENV{EXTRA_CFLAGS}")
|
||||
|
@ -107,7 +102,7 @@ IF(NOT DEFINED BORINGSSL_LIB)
|
|||
ENDIF()
|
||||
|
||||
|
||||
include_directories(${BORINGSSL_INCLUDE} ${VCPKG_INCLUDE} )
|
||||
include_directories(${BORINGSSL_INCLUDE} ${VCPKG_INCLUDE})
|
||||
link_directories( ${BORINGSSL_LIB} )
|
||||
|
||||
SET(CMAKE_INCLUDE_CURRENT_DIR ON)
|
||||
|
@ -138,17 +133,12 @@ add_executable(http_client
|
|||
)
|
||||
|
||||
target_link_libraries(http_client
|
||||
debug $(SolutionDir)src/liblsquic/debug/lsquic.lib
|
||||
debug ${VCPKG_BASE_DIR}/debug/lib/event.lib
|
||||
debug ${VCPKG_BASE_DIR}/debug/lib/zlibd.lib
|
||||
debug ${BORINGSSL_BASE_LIB_DIR}/ssl/debug/ssl.lib
|
||||
debug ${BORINGSSL_BASE_LIB_DIR}/crypto/debug/crypto.lib
|
||||
lsquic
|
||||
${VCPKG_LIB}/event.lib
|
||||
${VCPKG_LIB}/zlib.lib
|
||||
${BORINGSSL_LIB}/ssl.lib
|
||||
${BORINGSSL_LIB}/crypto.lib
|
||||
ws2_32
|
||||
optimized $(SolutionDir)src/liblsquic/release/lsquic.lib
|
||||
optimized ${VCPKG_BASE_DIR}/lib/event.lib
|
||||
optimized ${VCPKG_BASE_DIR}/lib/zlib.lib
|
||||
optimized ${BORINGSSL_BASE_LIB_DIR}/ssl/release/ssl.lib
|
||||
optimized ${BORINGSSL_BASE_LIB_DIR}/crypto/release/crypto.lib
|
||||
${LIBS} )
|
||||
|
||||
ENDIF()
|
||||
|
|
|
@ -13,6 +13,7 @@
|
|||
#define bswap_32 OSSwapInt32
|
||||
#define bswap_64 OSSwapInt64
|
||||
#elif defined(WIN32)
|
||||
#include <stdlib.h>
|
||||
#define bswap_16 _byteswap_ushort
|
||||
#define bswap_32 _byteswap_ulong
|
||||
#define bswap_64 _byteswap_uint64
|
||||
|
|
|
@ -286,7 +286,7 @@ block_write (struct data_block *block, unsigned block_off,
|
|||
set = block_off >> 6;
|
||||
bit = block_off & 0x3F;
|
||||
|
||||
assert(set <= N_DB_SETS);
|
||||
assert(set < N_DB_SETS);
|
||||
|
||||
if (bit)
|
||||
{
|
||||
|
|
|
@ -2486,6 +2486,7 @@ static void
|
|||
create_delayed_streams (struct full_conn *conn)
|
||||
{
|
||||
unsigned stream_count, avail, i;
|
||||
struct lsquic_stream **new_streams;
|
||||
|
||||
stream_count = count_streams(conn, 0);
|
||||
|
||||
|
@ -2496,7 +2497,7 @@ create_delayed_streams (struct full_conn *conn)
|
|||
if (conn->fc_n_delayed_streams < avail)
|
||||
avail = conn->fc_n_delayed_streams;
|
||||
|
||||
struct lsquic_stream *new_streams[ avail ];
|
||||
new_streams = malloc(sizeof(new_streams[0]) * avail);
|
||||
|
||||
LSQ_DEBUG("creating delayed streams");
|
||||
for (i = 0; i < avail; ++i)
|
||||
|
@ -2509,7 +2510,7 @@ create_delayed_streams (struct full_conn *conn)
|
|||
{
|
||||
ABORT_ERROR("%s: cannot create new stream: %s", __func__,
|
||||
strerror(errno));
|
||||
return;
|
||||
goto cleanup;
|
||||
}
|
||||
}
|
||||
LSQ_DEBUG("created %u delayed stream%.*s", avail, avail != 1, "s");
|
||||
|
@ -2519,6 +2520,8 @@ create_delayed_streams (struct full_conn *conn)
|
|||
|
||||
for (i = 0; i < avail; ++i)
|
||||
lsquic_stream_call_on_new(new_streams[i]);
|
||||
cleanup:
|
||||
free(new_streams);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -92,7 +92,7 @@ hwc_uh_write (struct header_writer_ctx *hwc, const void *buf, size_t sz)
|
|||
else
|
||||
hwc->headers_sz = hwc->w_off + sz;
|
||||
h1h_buf = realloc(hwc->hwc_h1h.h1h_buf, hwc->headers_sz);
|
||||
if (!buf)
|
||||
if (!h1h_buf)
|
||||
return -1;
|
||||
hwc->hwc_h1h.h1h_buf = h1h_buf;
|
||||
}
|
||||
|
|
|
@ -50,6 +50,7 @@
|
|||
#include <sys/queue.h>
|
||||
#ifdef WIN32
|
||||
#include <vc_compat.h>
|
||||
#include <intrin.h>
|
||||
#endif
|
||||
|
||||
#include "fiu-local.h"
|
||||
|
@ -262,7 +263,14 @@ size_in_bits (size_t sz)
|
|||
#if __GNUC__
|
||||
unsigned clz = __builtin_clz(sz - 1);
|
||||
return 32 - clz;
|
||||
#elif defined(WIN32)
|
||||
unsigned char s;
|
||||
unsigned long idx;
|
||||
s = _BitScanReverse(&idx, sz);
|
||||
assert(s);
|
||||
return (unsigned) idx + 1;
|
||||
#else
|
||||
#error This function contains a bug!
|
||||
unsigned clz;
|
||||
size_t y;
|
||||
|
||||
|
|
|
@ -131,7 +131,7 @@ find_and_set_lowest_priority (struct stream_prio_iter *iter)
|
|||
#endif
|
||||
|
||||
SPI_DEBUG("%s: prio %u -> %u", __func__, iter->spi_cur_prio, prio);
|
||||
iter->spi_cur_prio = prio;
|
||||
iter->spi_cur_prio = (unsigned char) prio;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -184,7 +184,7 @@ find_and_set_next_priority (struct stream_prio_iter *iter)
|
|||
#endif
|
||||
|
||||
SPI_DEBUG("%s: prio %u -> %u", __func__, iter->spi_cur_prio, prio);
|
||||
iter->spi_cur_prio = prio;
|
||||
iter->spi_cur_prio = (unsigned char) prio;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
@ -31,7 +31,11 @@ extern "C" {
|
|||
#endif
|
||||
|
||||
#include <stdint.h>
|
||||
#ifndef WIN32
|
||||
#include <sys/uio.h>
|
||||
#else
|
||||
#include "vc_compat.h"
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Strings up to 65535 characters in length are supported.
|
||||
|
|
|
@ -33,12 +33,9 @@
|
|||
#include <event2/event.h>
|
||||
#include <math.h>
|
||||
|
||||
|
||||
#ifndef WIN32
|
||||
#include <openssl/bio.h>
|
||||
#include <openssl/pem.h>
|
||||
#include <openssl/x509.h>
|
||||
#endif
|
||||
|
||||
#include "lsquic.h"
|
||||
#include "test_common.h"
|
||||
|
@ -131,6 +128,23 @@ calc_sample_stats (const struct sample_stats *stats,
|
|||
}
|
||||
|
||||
|
||||
#ifdef WIN32
|
||||
static char *
|
||||
strndup(const char *s, size_t n)
|
||||
{
|
||||
char *copy;
|
||||
|
||||
copy = malloc(n + 1);
|
||||
if (copy)
|
||||
{
|
||||
memcpy(copy, s, n);
|
||||
copy[n] = '\0';
|
||||
}
|
||||
|
||||
return copy;
|
||||
}
|
||||
#endif
|
||||
|
||||
struct lsquic_conn_ctx;
|
||||
|
||||
struct path_elem {
|
||||
|
|
|
@ -901,7 +901,8 @@ send_packets_one_by_one (const struct lsquic_out_spec *specs, unsigned count)
|
|||
}
|
||||
#endif
|
||||
|
||||
for (n = 0; n < count; ++n)
|
||||
n = 0;
|
||||
do
|
||||
{
|
||||
sport = specs[n].peer_ctx;
|
||||
#ifndef WIN32
|
||||
|
@ -951,7 +952,9 @@ send_packets_one_by_one (const struct lsquic_out_spec *specs, unsigned count)
|
|||
#endif
|
||||
break;
|
||||
}
|
||||
++n;
|
||||
}
|
||||
while (n < count);
|
||||
|
||||
if (n < count)
|
||||
prog_sport_cant_send(sport->sp_prog, sport->fd);
|
||||
|
|
|
@ -1,453 +1,93 @@
|
|||
# Copyright (c) 2017 - 2019 LiteSpeed Technologies Inc. See LICENSE.
|
||||
include_directories( BEFORE ../../ssl/include )
|
||||
include_directories( ../../include )
|
||||
include_directories( ../../src/liblsquic )
|
||||
include_directories( ../../src/liblsquic/ls-hpack/include )
|
||||
|
||||
enable_testing()
|
||||
INCLUDE_DIRECTORIES(../../src/liblsquic)
|
||||
|
||||
IF (NOT MSVC)
|
||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-unused-value")
|
||||
ENABLE_TESTING()
|
||||
|
||||
|
||||
add_executable(test_rechist test_rechist.c)
|
||||
target_link_libraries(test_rechist lsquic pthread libssl.a libcrypto.a z m ${LIBS})
|
||||
add_test(rechist test_rechist)
|
||||
|
||||
add_executable(test_senhist test_senhist.c)
|
||||
target_link_libraries(test_senhist lsquic pthread libssl.a libcrypto.a z m ${LIBS})
|
||||
add_test(senhist test_senhist)
|
||||
|
||||
add_executable(test_rtt test_rtt.c)
|
||||
target_link_libraries(test_rtt lsquic m ${LIBS})
|
||||
add_test(rtt test_rtt)
|
||||
|
||||
add_executable(test_set test_set.c)
|
||||
target_link_libraries(test_set lsquic m ${LIBS})
|
||||
add_test(set test_set)
|
||||
|
||||
|
||||
add_executable(test_engine_ctor test_engine_ctor.c)
|
||||
target_link_libraries(test_engine_ctor lsquic pthread libssl.a libcrypto.a z m ${LIBS})
|
||||
add_test(engine_ctor test_engine_ctor)
|
||||
|
||||
|
||||
add_executable(test_stream test_stream.c)
|
||||
target_link_libraries(test_stream lsquic pthread libssl.a libcrypto.a z m ${LIBS})
|
||||
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)
|
||||
|
||||
add_executable(test_spi test_spi.c)
|
||||
target_link_libraries(test_spi lsquic pthread libssl.a libcrypto.a z m ${LIBS})
|
||||
add_test(spi test_spi)
|
||||
|
||||
add_executable(test_malo test_malo.c)
|
||||
target_link_libraries(test_malo lsquic m ${LIBS})
|
||||
add_test(malo test_malo)
|
||||
|
||||
add_executable(test_conn_hash test_conn_hash.c)
|
||||
target_link_libraries(test_conn_hash lsquic m ${LIBS})
|
||||
add_test(conn_hash test_conn_hash)
|
||||
|
||||
add_executable(test_lsquic_hash test_lsquic_hash.c)
|
||||
target_link_libraries(test_lsquic_hash lsquic m ${LIBS})
|
||||
add_test(lsquic_hash test_lsquic_hash)
|
||||
|
||||
add_executable(test_blocked_gquic_le test_blocked_gquic_le.c)
|
||||
target_link_libraries(test_blocked_gquic_le lsquic pthread libssl.a libcrypto.a z m ${LIBS})
|
||||
add_test(blocked_gquic_le test_blocked_gquic_le)
|
||||
|
||||
add_executable(test_blocked_gquic_be test_blocked_gquic_be.c)
|
||||
target_link_libraries(test_blocked_gquic_be lsquic pthread libssl.a libcrypto.a z m ${LIBS})
|
||||
add_test(blocked_gquic_be test_blocked_gquic_be)
|
||||
|
||||
add_executable(test_rst_stream_gquic_le test_rst_stream_gquic_le.c)
|
||||
target_link_libraries(test_rst_stream_gquic_le lsquic pthread libssl.a libcrypto.a z m ${LIBS})
|
||||
add_test(rst_stream_gquic_le test_rst_stream_gquic_le)
|
||||
|
||||
add_executable(test_rst_stream_gquic_be test_rst_stream_gquic_be.c)
|
||||
target_link_libraries(test_rst_stream_gquic_be lsquic pthread libssl.a libcrypto.a z m ${LIBS})
|
||||
add_test(rst_stream_gquic_be test_rst_stream_gquic_be)
|
||||
|
||||
add_executable(test_conn_close_gquic_le test_conn_close_gquic_le.c)
|
||||
target_link_libraries(test_conn_close_gquic_le lsquic pthread libssl.a libcrypto.a z m ${LIBS})
|
||||
add_test(conn_close_gquic_le test_conn_close_gquic_le)
|
||||
|
||||
add_executable(test_conn_close_gquic_be test_conn_close_gquic_be.c)
|
||||
target_link_libraries(test_conn_close_gquic_be lsquic pthread libssl.a libcrypto.a z m ${LIBS})
|
||||
add_test(conn_close_gquic_be test_conn_close_gquic_be)
|
||||
|
||||
add_executable(test_goaway_gquic_le test_goaway_gquic_le.c)
|
||||
target_link_libraries(test_goaway_gquic_le lsquic pthread libssl.a libcrypto.a z m ${LIBS})
|
||||
add_test(goaway_gquic_le test_goaway_gquic_le)
|
||||
|
||||
add_executable(test_goaway_gquic_be test_goaway_gquic_be.c)
|
||||
target_link_libraries(test_goaway_gquic_be lsquic pthread libssl.a libcrypto.a z m ${LIBS})
|
||||
add_test(goaway_gquic_be test_goaway_gquic_be)
|
||||
|
||||
add_executable(test_wuf_gquic_le test_wuf_gquic_le.c)
|
||||
target_link_libraries(test_wuf_gquic_le lsquic pthread libssl.a libcrypto.a z m ${LIBS})
|
||||
add_test(wuf_gquic_le test_wuf_gquic_le)
|
||||
|
||||
add_executable(test_wuf_gquic_be test_wuf_gquic_be.c)
|
||||
target_link_libraries(test_wuf_gquic_be lsquic pthread libssl.a libcrypto.a z m ${LIBS})
|
||||
add_test(wuf_gquic_be test_wuf_gquic_be)
|
||||
|
||||
add_executable(test_ackparse_gquic_le test_ackparse_gquic_le.c)
|
||||
target_link_libraries(test_ackparse_gquic_le lsquic pthread libssl.a libcrypto.a z m ${LIBS})
|
||||
add_test(ackparse_gquic_le test_ackparse_gquic_le)
|
||||
|
||||
add_executable(test_ackparse_gquic_be test_ackparse_gquic_be.c)
|
||||
target_link_libraries(test_ackparse_gquic_be lsquic pthread libssl.a libcrypto.a z m ${LIBS})
|
||||
add_test(ackparse_gquic_be test_ackparse_gquic_be)
|
||||
|
||||
add_executable(test_ackgen_gquic_le test_ackgen_gquic_le.c)
|
||||
target_link_libraries(test_ackgen_gquic_le lsquic pthread libssl.a libcrypto.a z m ${LIBS})
|
||||
add_test(ackgen_gquic_le test_ackgen_gquic_le)
|
||||
|
||||
add_executable(test_ackgen_gquic_be test_ackgen_gquic_be.c)
|
||||
target_link_libraries(test_ackgen_gquic_be lsquic pthread libssl.a libcrypto.a z m ${LIBS})
|
||||
add_test(ackgen_gquic_be test_ackgen_gquic_be)
|
||||
|
||||
add_executable(test_sfcw test_sfcw.c)
|
||||
target_link_libraries(test_sfcw lsquic pthread libssl.a libcrypto.a z m ${LIBS})
|
||||
add_test(sfcw test_sfcw)
|
||||
|
||||
add_executable(test_alarmset test_alarmset.c)
|
||||
target_link_libraries(test_alarmset lsquic m ${LIBS})
|
||||
add_test(alarmset test_alarmset)
|
||||
|
||||
add_executable(graph_cubic graph_cubic.c)
|
||||
target_link_libraries(graph_cubic lsquic m ${LIBS})
|
||||
|
||||
|
||||
add_executable(test_streamparse test_streamparse.c)
|
||||
target_link_libraries(test_streamparse lsquic pthread libssl.a libcrypto.a z m ${LIBS})
|
||||
add_test(streamparse test_streamparse)
|
||||
|
||||
add_executable(test_packet_out test_packet_out.c)
|
||||
target_link_libraries(test_packet_out lsquic pthread libssl.a libcrypto.a z m ${LIBS})
|
||||
add_test(packet_out test_packet_out)
|
||||
|
||||
add_executable(test_reg_pkt_headergen test_reg_pkt_headergen.c)
|
||||
target_link_libraries(test_reg_pkt_headergen lsquic pthread libssl.a libcrypto.a z m ${LIBS})
|
||||
add_test(reg_pkt_headergen test_reg_pkt_headergen)
|
||||
|
||||
add_executable(test_ver_nego test_ver_nego.c)
|
||||
target_link_libraries(test_ver_nego lsquic pthread libssl.a libcrypto.a z m ${LIBS})
|
||||
add_test(ver_nego test_ver_nego)
|
||||
|
||||
add_executable(test_packno_len test_packno_len.c)
|
||||
target_link_libraries(test_packno_len lsquic pthread libssl.a libcrypto.a z m ${LIBS})
|
||||
add_test(packno_len test_packno_len)
|
||||
|
||||
|
||||
add_executable(test_streamgen test_streamgen.c)
|
||||
target_link_libraries(test_streamgen lsquic pthread libssl.a libcrypto.a z m ${LIBS})
|
||||
add_test(streamgen test_streamgen)
|
||||
|
||||
add_executable(test_some_packets test_some_packets.c)
|
||||
target_link_libraries(test_some_packets lsquic pthread libssl.a libcrypto.a z m ${LIBS})
|
||||
add_test(some_packets test_some_packets)
|
||||
|
||||
|
||||
add_executable(test_elision test_elision.c)
|
||||
target_link_libraries(test_elision lsquic pthread libssl.a libcrypto.a z m ${LIBS})
|
||||
add_test(elision test_elision)
|
||||
|
||||
add_executable(test_stop_waiting_gquic_le test_stop_waiting_gquic_le.c)
|
||||
target_link_libraries(test_stop_waiting_gquic_le lsquic pthread libssl.a libcrypto.a z m ${LIBS})
|
||||
add_test(stop_waiting_gquic_le test_stop_waiting_gquic_le)
|
||||
|
||||
add_executable(test_stop_waiting_gquic_be test_stop_waiting_gquic_be.c)
|
||||
target_link_libraries(test_stop_waiting_gquic_be lsquic pthread libssl.a libcrypto.a z m ${LIBS})
|
||||
add_test(stop_waiting_gquic_be test_stop_waiting_gquic_be)
|
||||
|
||||
add_executable(test_parse_packet_in test_parse_packet_in.c)
|
||||
target_link_libraries(test_parse_packet_in lsquic pthread libssl.a libcrypto.a z m ${LIBS})
|
||||
add_test(parse_packet_in test_parse_packet_in)
|
||||
|
||||
add_executable(test_quic_le_floats test_quic_le_floats.c)
|
||||
target_link_libraries(test_quic_le_floats lsquic pthread libssl.a libcrypto.a z m ${LIBS})
|
||||
add_test(quic_le_floats test_quic_le_floats)
|
||||
|
||||
add_executable(test_quic_be_floats test_quic_be_floats.c)
|
||||
target_link_libraries(test_quic_be_floats lsquic pthread libssl.a libcrypto.a z m ${LIBS})
|
||||
add_test(quic_be_floats test_quic_be_floats)
|
||||
|
||||
add_executable(test_export_key test_export_key.c)
|
||||
target_link_libraries(test_export_key lsquic pthread libssl.a libcrypto.a z m ${LIBS})
|
||||
add_test(export_key test_export_key)
|
||||
|
||||
add_executable(test_frame_reader test_frame_reader.c)
|
||||
target_link_libraries(test_frame_reader lsquic pthread libssl.a libcrypto.a z m ${LIBS})
|
||||
add_test(frame_reader test_frame_reader)
|
||||
|
||||
add_executable(test_frame_writer test_frame_writer.c)
|
||||
target_link_libraries(test_frame_writer lsquic pthread libssl.a libcrypto.a z m ${LIBS})
|
||||
add_test(frame_writer test_frame_writer)
|
||||
|
||||
add_executable(test_frame_chop test_frame_chop.c)
|
||||
target_link_libraries(test_frame_chop lsquic pthread libssl.a libcrypto.a z m ${LIBS})
|
||||
add_test(frame_chop test_frame_chop)
|
||||
|
||||
IF (NOT ${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
|
||||
add_executable(test_frame_rw test_frame_rw.c)
|
||||
target_link_libraries(test_frame_rw lsquic pthread libssl.a libcrypto.a z m ${LIBS})
|
||||
add_test(frame_rw test_frame_rw)
|
||||
ENDIF()
|
||||
|
||||
add_executable(test_hkdf test_hkdf.c)
|
||||
target_link_libraries(test_hkdf lsquic pthread libssl.a libcrypto.a m ${LIBS})
|
||||
add_test(hkdf test_hkdf)
|
||||
|
||||
|
||||
|
||||
add_executable(test_attq test_attq.c)
|
||||
target_link_libraries(test_attq lsquic pthread libssl.a libcrypto.a m ${LIBS})
|
||||
add_test(attq test_attq)
|
||||
|
||||
add_executable(test_arr test_arr.c)
|
||||
target_link_libraries(test_arr lsquic pthread libssl.a libcrypto.a m ${LIBS})
|
||||
add_test(arr test_arr)
|
||||
|
||||
add_executable(test_buf test_buf.c)
|
||||
target_link_libraries(test_buf lsquic pthread libssl.a libcrypto.a m ${LIBS})
|
||||
add_test(buf test_buf)
|
||||
|
||||
add_executable(test_cubic test_cubic.c)
|
||||
target_link_libraries(test_cubic lsquic pthread libssl.a libcrypto.a m ${LIBS})
|
||||
add_test(cubic test_cubic)
|
||||
|
||||
add_executable(test_di_nocopy test_di_nocopy.c)
|
||||
target_link_libraries(test_di_nocopy lsquic pthread libssl.a libcrypto.a m ${LIBS})
|
||||
add_test(di_nocopy test_di_nocopy)
|
||||
|
||||
add_executable(test_dec test_dec.c)
|
||||
target_link_libraries(test_dec libssl.a libcrypto.a z m pthread ${LIBS})
|
||||
|
||||
|
||||
#MSVC
|
||||
IF (MSVC)
|
||||
SET(LIBS
|
||||
lsquic
|
||||
${VCPKG_LIB}/event.lib
|
||||
${VCPKG_LIB}/zlib.lib
|
||||
${BORINGSSL_LIB}/ssl.lib
|
||||
${BORINGSSL_LIB}/crypto.lib
|
||||
ws2_32)
|
||||
SET(ADDL_SOURCES ../../wincompat/getopt.c ../../wincompat/getopt1.c)
|
||||
SET(LIB_FLAGS "-FORCE:MULTIPLE")
|
||||
ELSE()
|
||||
|
||||
SET (UGH_LIB_LIST debug $(SolutionDir)src/liblsquic/debug/lsquic.lib debug ${VCPKG_BASE_DIR}/debug/lib/event.lib debug ${VCPKG_BASE_DIR}/debug/lib/zlibd.lib debug ${BORINGSSL_BASE_LIB_DIR}/ssl/debug/ssl.lib debug ${BORINGSSL_BASE_LIB_DIR}/crypto/debug/crypto.lib optimized $(SolutionDir)src/liblsquic/release/lsquic.lib optimized ${VCPKG_BASE_DIR}/lib/event.lib optimized ${VCPKG_BASE_DIR}/lib/zlib.lib optimized ${BORINGSSL_BASE_LIB_DIR}/ssl/Release/ssl.lib optimized ${BORINGSSL_BASE_LIB_DIR}/crypto/Release/crypto.lib)
|
||||
|
||||
set(MIN_LIBS_LIST ${LIBS} ws2_32)
|
||||
set(LIBS_LIST ${UGH_LIB_LIST} ${MIN_LIBS_LIST})
|
||||
|
||||
add_executable(test_rechist test_rechist.c)
|
||||
target_link_libraries(test_rechist lsquic ${LIBS_LIST})
|
||||
add_test(rechist test_rechist)
|
||||
|
||||
add_executable(test_senhist test_senhist.c)
|
||||
target_link_libraries(test_senhist lsquic ${LIBS_LIST})
|
||||
add_test(senhist test_senhist)
|
||||
|
||||
add_executable(test_rtt test_rtt.c)
|
||||
target_link_libraries(test_rtt lsquic ${MIN_LIBS_LIST})
|
||||
add_test(rtt test_rtt)
|
||||
|
||||
add_executable(test_set test_set.c)
|
||||
target_link_libraries(test_set lsquic ${MIN_LIBS_LIST})
|
||||
add_test(set test_set)
|
||||
|
||||
|
||||
add_executable(test_engine_ctor test_engine_ctor.c)
|
||||
target_link_libraries(test_engine_ctor lsquic ${LIBS_LIST})
|
||||
add_test(engine_ctor test_engine_ctor)
|
||||
|
||||
add_executable(test_stream test_stream.c ../../wincompat/getopt.c ../../wincompat/getopt1.c)
|
||||
target_link_libraries(test_stream lsquic ${LIBS_LIST} -FORCE:multiple)
|
||||
|
||||
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)
|
||||
|
||||
add_executable(test_spi test_spi.c)
|
||||
target_link_libraries(test_spi lsquic ${LIBS_LIST})
|
||||
add_test(spi test_spi)
|
||||
|
||||
add_executable(test_malo test_malo.c ../../wincompat/getopt.c ../../wincompat/getopt1.c)
|
||||
target_link_libraries(test_malo lsquic ${MIN_LIBS_LIST})
|
||||
add_test(malo test_malo)
|
||||
|
||||
add_executable(test_conn_hash test_conn_hash.c)
|
||||
target_link_libraries(test_conn_hash lsquic ${MIN_LIBS_LIST})
|
||||
add_test(conn_hash test_conn_hash)
|
||||
|
||||
add_executable(test_lsquic_hash test_lsquic_hash.c)
|
||||
target_link_libraries(test_lsquic_hash lsquic ${MIN_LIBS_LIST})
|
||||
add_test(lsquic_hash test_lsquic_hash)
|
||||
|
||||
add_executable(test_blocked_gquic_le test_blocked_gquic_le.c)
|
||||
target_link_libraries(test_blocked_gquic_le lsquic ${LIBS_LIST})
|
||||
add_test(blocked_gquic_le test_blocked_gquic_le)
|
||||
|
||||
add_executable(test_blocked_gquic_be test_blocked_gquic_be.c)
|
||||
target_link_libraries(test_blocked_gquic_be lsquic ${LIBS_LIST})
|
||||
add_test(blocked_gquic_be test_blocked_gquic_be)
|
||||
|
||||
add_executable(test_rst_stream_gquic_le test_rst_stream_gquic_le.c)
|
||||
target_link_libraries(test_rst_stream_gquic_le lsquic ${LIBS_LIST})
|
||||
add_test(rst_stream_gquic_le test_rst_stream_gquic_le)
|
||||
|
||||
add_executable(test_rst_stream_gquic_be test_rst_stream_gquic_be.c)
|
||||
target_link_libraries(test_rst_stream_gquic_be lsquic ${LIBS_LIST})
|
||||
add_test(rst_stream_gquic_be test_rst_stream_gquic_be)
|
||||
|
||||
add_executable(test_conn_close_gquic_le test_conn_close_gquic_le.c)
|
||||
target_link_libraries(test_conn_close_gquic_le lsquic ${LIBS_LIST})
|
||||
add_test(conn_close_gquic_le test_conn_close_gquic_le)
|
||||
|
||||
add_executable(test_conn_close_gquic_be test_conn_close_gquic_be.c)
|
||||
target_link_libraries(test_conn_close_gquic_be lsquic ${LIBS_LIST})
|
||||
add_test(conn_close_gquic_be test_conn_close_gquic_be)
|
||||
|
||||
add_executable(test_goaway_gquic_le test_goaway_gquic_le.c)
|
||||
target_link_libraries(test_goaway_gquic_le lsquic ${LIBS_LIST})
|
||||
add_test(goaway_gquic_le test_goaway_gquic_le)
|
||||
|
||||
add_executable(test_goaway_gquic_be test_goaway_gquic_be.c)
|
||||
target_link_libraries(test_goaway_gquic_be lsquic ${LIBS_LIST})
|
||||
add_test(goaway_gquic_be test_goaway_gquic_be)
|
||||
|
||||
add_executable(test_wuf_gquic_le test_wuf_gquic_le.c)
|
||||
target_link_libraries(test_wuf_gquic_le lsquic ${LIBS_LIST})
|
||||
add_test(wuf_gquic_le test_wuf_gquic_le)
|
||||
|
||||
add_executable(test_wuf_gquic_be test_wuf_gquic_be.c)
|
||||
target_link_libraries(test_wuf_gquic_be lsquic ${LIBS_LIST})
|
||||
add_test(wuf_gquic_be test_wuf_gquic_be)
|
||||
|
||||
add_executable(test_ackparse_gquic_le test_ackparse_gquic_le.c)
|
||||
target_link_libraries(test_ackparse_gquic_le lsquic ${LIBS_LIST})
|
||||
add_test(ackparse_gquic_le test_ackparse_gquic_le)
|
||||
|
||||
add_executable(test_ackparse_gquic_be test_ackparse_gquic_be.c)
|
||||
target_link_libraries(test_ackparse_gquic_be lsquic ${LIBS_LIST})
|
||||
add_test(ackparse_gquic_be test_ackparse_gquic_be)
|
||||
|
||||
add_executable(test_ackgen_gquic_le test_ackgen_gquic_le.c)
|
||||
target_link_libraries(test_ackgen_gquic_le lsquic ${LIBS_LIST})
|
||||
add_test(ackgen_gquic_le test_ackgen_gquic_le)
|
||||
|
||||
add_executable(test_ackgen_gquic_be test_ackgen_gquic_be.c)
|
||||
target_link_libraries(test_ackgen_gquic_be lsquic ${LIBS_LIST})
|
||||
add_test(ackgen_gquic_be test_ackgen_gquic_be)
|
||||
|
||||
add_executable(test_sfcw test_sfcw.c)
|
||||
target_link_libraries(test_sfcw lsquic ${LIBS_LIST})
|
||||
add_test(sfcw test_sfcw)
|
||||
|
||||
add_executable(test_alarmset test_alarmset.c)
|
||||
target_link_libraries(test_alarmset lsquic ${MIN_LIBS_LIST})
|
||||
add_test(alarmset test_alarmset)
|
||||
|
||||
add_executable(graph_cubic graph_cubic.c ../../wincompat/getopt.c ../../wincompat/getopt1.c)
|
||||
target_link_libraries(graph_cubic lsquic ${MIN_LIBS_LIST})
|
||||
|
||||
|
||||
add_executable(test_streamparse test_streamparse.c)
|
||||
target_link_libraries(test_streamparse lsquic ${LIBS_LIST})
|
||||
add_test(streamparse test_streamparse)
|
||||
|
||||
add_executable(test_packet_out test_packet_out.c)
|
||||
target_link_libraries(test_packet_out lsquic ${LIBS_LIST})
|
||||
add_test(packet_out test_packet_out)
|
||||
|
||||
add_executable(test_reg_pkt_headergen test_reg_pkt_headergen.c)
|
||||
target_link_libraries(test_reg_pkt_headergen lsquic ${LIBS_LIST})
|
||||
add_test(reg_pkt_headergen test_reg_pkt_headergen)
|
||||
|
||||
add_executable(test_ver_nego test_ver_nego.c)
|
||||
target_link_libraries(test_ver_nego lsquic ${LIBS_LIST})
|
||||
add_test(ver_nego test_ver_nego)
|
||||
|
||||
add_executable(test_packno_len test_packno_len.c)
|
||||
target_link_libraries(test_packno_len lsquic ${LIBS_LIST})
|
||||
add_test(packno_len test_packno_len)
|
||||
|
||||
|
||||
add_executable(test_streamgen test_streamgen.c)
|
||||
target_link_libraries(test_streamgen lsquic ${LIBS_LIST})
|
||||
add_test(streamgen test_streamgen)
|
||||
|
||||
add_executable(test_some_packets test_some_packets.c)
|
||||
target_link_libraries(test_some_packets lsquic ${LIBS_LIST})
|
||||
add_test(some_packets test_some_packets)
|
||||
|
||||
|
||||
add_executable(test_elision test_elision.c)
|
||||
target_link_libraries(test_elision lsquic ${LIBS_LIST} -FORCE:multiple)
|
||||
add_test(elision test_elision)
|
||||
|
||||
add_executable(test_stop_waiting_gquic_le test_stop_waiting_gquic_le.c)
|
||||
target_link_libraries(test_stop_waiting_gquic_le lsquic ${LIBS_LIST})
|
||||
add_test(stop_waiting_gquic_le test_stop_waiting_gquic_le)
|
||||
|
||||
add_executable(test_stop_waiting_gquic_be test_stop_waiting_gquic_be.c)
|
||||
target_link_libraries(test_stop_waiting_gquic_be lsquic ${LIBS_LIST})
|
||||
add_test(stop_waiting_gquic_be test_stop_waiting_gquic_be)
|
||||
|
||||
add_executable(test_parse_packet_in test_parse_packet_in.c)
|
||||
target_link_libraries(test_parse_packet_in lsquic ${LIBS_LIST})
|
||||
add_test(parse_packet_in test_parse_packet_in)
|
||||
|
||||
add_executable(test_quic_le_floats test_quic_le_floats.c)
|
||||
target_link_libraries(test_quic_le_floats lsquic ${LIBS_LIST})
|
||||
add_test(quic_le_floats test_quic_le_floats)
|
||||
|
||||
add_executable(test_quic_be_floats test_quic_be_floats.c)
|
||||
target_link_libraries(test_quic_be_floats lsquic ${LIBS_LIST})
|
||||
add_test(quic_be_floats test_quic_be_floats)
|
||||
|
||||
add_executable(test_export_key test_export_key.c)
|
||||
target_link_libraries(test_export_key lsquic ${LIBS_LIST})
|
||||
add_test(export_key test_export_key)
|
||||
|
||||
add_executable(test_frame_reader test_frame_reader.c ../../wincompat/getopt.c ../../wincompat/getopt1.c)
|
||||
target_link_libraries(test_frame_reader lsquic ${LIBS_LIST})
|
||||
add_test(frame_reader test_frame_reader)
|
||||
|
||||
add_executable(test_frame_writer test_frame_writer.c)
|
||||
target_link_libraries(test_frame_writer lsquic ${LIBS_LIST})
|
||||
add_test(frame_writer test_frame_writer)
|
||||
|
||||
add_executable(test_frame_chop test_frame_chop.c ../../wincompat/getopt.c ../../wincompat/getopt1.c)
|
||||
target_link_libraries(test_frame_chop lsquic ${LIBS_LIST})
|
||||
add_test(frame_chop test_frame_chop)
|
||||
|
||||
add_executable(test_hkdf test_hkdf.c)
|
||||
target_link_libraries(test_hkdf lsquic ${LIBS_LIST})
|
||||
add_test(hkdf test_hkdf)
|
||||
|
||||
|
||||
add_executable(test_attq test_attq.c)
|
||||
target_link_libraries(test_attq lsquic ${LIBS_LIST})
|
||||
add_test(attq test_attq)
|
||||
|
||||
add_executable(test_arr test_arr.c)
|
||||
target_link_libraries(test_arr lsquic ${LIBS_LIST})
|
||||
add_test(arr test_arr)
|
||||
|
||||
add_executable(test_buf test_buf.c)
|
||||
target_link_libraries(test_buf lsquic ${LIBS_LIST})
|
||||
add_test(buf test_buf)
|
||||
|
||||
add_executable(test_cubic test_cubic.c ../../wincompat/getopt.c ../../wincompat/getopt1.c)
|
||||
target_link_libraries(test_cubic lsquic ${LIBS_LIST})
|
||||
add_test(cubic test_cubic)
|
||||
|
||||
add_executable(test_di_nocopy test_di_nocopy.c)
|
||||
target_link_libraries(test_di_nocopy lsquic pthread libssl.a libcrypto.a m ${LIBS})
|
||||
add_test(di_nocopy test_di_nocopy)
|
||||
|
||||
add_executable(test_dec test_dec.c ../../wincompat/getopt.c ../../wincompat/getopt1.c)
|
||||
target_link_libraries(test_dec ${LIBS_LIST})
|
||||
|
||||
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-unused-value")
|
||||
SET(LIBS lsquic libcrypto.a libssl.a z m pthread)
|
||||
ENDIF()
|
||||
|
||||
SET(TESTS
|
||||
ackgen_gquic_be
|
||||
ackgen_gquic_le
|
||||
ackparse_gquic_be
|
||||
ackparse_gquic_le
|
||||
alarmset
|
||||
arr
|
||||
attq
|
||||
blocked_gquic_be
|
||||
blocked_gquic_le
|
||||
buf
|
||||
conn_close_gquic_be
|
||||
conn_close_gquic_le
|
||||
conn_hash
|
||||
cubic
|
||||
dec
|
||||
di_nocopy
|
||||
elision
|
||||
engine_ctor
|
||||
export_key
|
||||
frame_chop
|
||||
frame_reader
|
||||
frame_writer
|
||||
goaway_gquic_be
|
||||
goaway_gquic_le
|
||||
hkdf
|
||||
lsquic_hash
|
||||
malo
|
||||
packet_out
|
||||
packno_len
|
||||
parse_packet_in
|
||||
quic_be_floats
|
||||
quic_le_floats
|
||||
rechist
|
||||
reg_pkt_headergen
|
||||
rst_stream_gquic_be
|
||||
rst_stream_gquic_le
|
||||
rtt
|
||||
senhist
|
||||
set
|
||||
sfcw
|
||||
some_packets
|
||||
spi
|
||||
stop_waiting_gquic_be
|
||||
stop_waiting_gquic_le
|
||||
streamgen
|
||||
streamparse
|
||||
ver_nego
|
||||
wuf_gquic_be
|
||||
wuf_gquic_le
|
||||
)
|
||||
|
||||
IF (CMAKE_SYSTEM_NAME STREQUAL "Linux")
|
||||
# Linux has fmemopen
|
||||
SET(TESTS ${TESTS} frame_rw)
|
||||
ENDIF()
|
||||
|
||||
FOREACH(TEST_NAME ${TESTS})
|
||||
ADD_EXECUTABLE(test_${TEST_NAME} test_${TEST_NAME}.c ${ADDL_SOURCES})
|
||||
TARGET_LINK_LIBRARIES(test_${TEST_NAME} ${LIBS} ${LIB_FLAGS})
|
||||
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})
|
||||
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)
|
||||
|
||||
ADD_EXECUTABLE(graph_cubic graph_cubic.c ${ADDL_SOURCES})
|
||||
TARGET_LINK_LIBRARIES(graph_cubic ${LIBS})
|
||||
|
|
|
@ -59,6 +59,7 @@ main (int argc, char **argv)
|
|||
assert(!find_lsconn);
|
||||
s = conn_hash_add(&conn_hash, lconn);
|
||||
assert(0 == s);
|
||||
lconn->cn_flags = 1; /* In hash */
|
||||
}
|
||||
|
||||
assert(nelems == conn_hash_count(&conn_hash));
|
||||
|
@ -66,9 +67,11 @@ main (int argc, char **argv)
|
|||
for (lconn = lsquic_malo_first(malo); lconn;
|
||||
lconn = lsquic_malo_next(malo))
|
||||
{
|
||||
assert(lconn->cn_flags == 1);
|
||||
find_lsconn = conn_hash_find_by_cid(&conn_hash, lconn->cn_cid);
|
||||
assert(find_lsconn == lconn);
|
||||
conn_hash_remove(&conn_hash, lconn);
|
||||
lconn->cn_flags = 0;
|
||||
find_lsconn = conn_hash_find_by_cid(&conn_hash, lconn->cn_cid);
|
||||
assert(!find_lsconn);
|
||||
}
|
||||
|
|
|
@ -7,7 +7,11 @@
|
|||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <sys/queue.h>
|
||||
#ifdef WIN32
|
||||
#include "getopt.h"
|
||||
#else
|
||||
#include <unistd.h>
|
||||
#endif
|
||||
|
||||
#include "lsquic.h"
|
||||
#include "lsquic_int_types.h"
|
||||
|
|
|
@ -17,6 +17,8 @@
|
|||
#include <string.h>
|
||||
#ifndef WIN32
|
||||
#include <unistd.h>
|
||||
#else
|
||||
#include "getopt.h"
|
||||
#endif
|
||||
#include <sys/queue.h>
|
||||
|
||||
|
|
|
@ -1452,7 +1452,7 @@ test_reading_from_stream2 (void)
|
|||
stream_frame_t *frame;
|
||||
ssize_t nw;
|
||||
int s;
|
||||
const char data[10] = "1234567890";
|
||||
const char data[] = "1234567890";
|
||||
|
||||
init_test_objs(&tobjs, 0x4000, 0x4000, NULL);
|
||||
stream = new_stream(&tobjs, 123);
|
||||
|
@ -1477,7 +1477,7 @@ test_reading_from_stream2 (void)
|
|||
unsigned offset, length;
|
||||
for (offset = 0; offset < 7; ++offset)
|
||||
{
|
||||
for (length = 1; length <= sizeof(data) - offset; ++length)
|
||||
for (length = 1; length <= sizeof(data) - 1 - offset; ++length)
|
||||
{
|
||||
dup = (offset == 0 && length == 6)
|
||||
|| (offset == 6 && length == 4);
|
||||
|
@ -1813,7 +1813,7 @@ test_insert_edge_cases (void)
|
|||
s = lsquic_stream_frame_in(stream, frame);
|
||||
assert(("Duplicate frame", 0 == s));
|
||||
nread = lsquic_stream_read(stream, buf, sizeof(buf));
|
||||
assert(nread == -1 && errno == EAGAIN);
|
||||
assert(nread == -1 && errno == EWOULDBLOCK);
|
||||
frame = new_frame_in_ext(&tobjs, 6, 0, 1, &data[6]);
|
||||
s = lsquic_stream_frame_in(stream, frame);
|
||||
assert(("Frame OK", 0 == s));
|
||||
|
|
|
@ -11,7 +11,7 @@ struct iovec {
|
|||
|
||||
#define posix_memalign(p, a, s) (((*(p)) = _aligned_malloc((s), (a))), *(p) ?0 :errno)
|
||||
|
||||
#pragma warning(disable: 4018 4100 4127 4189 4200 4204 4214 4152 4221 4244 4245 4267 4334 4702 4706 4804 )
|
||||
#pragma warning(disable: 4018 4100 4127 4189 4200 4204 4152 4221 4244 4245 4267 4334 4702 4706 4804 )
|
||||
/*
|
||||
4018:signed/unsigned mismatch
|
||||
4100:unreferenced formal parameter,
|
||||
|
@ -20,7 +20,6 @@ struct iovec {
|
|||
4189:local variable is initialized but not referenced
|
||||
4200:zero-sized-array in struct,
|
||||
4204: nonstandard extension used: non-constant aggregate initializer,
|
||||
4214: nonstandard extension used: bit field types other than int
|
||||
4221: nonstandard extension used:xx cannot be initialized using address of automatic variable y,
|
||||
4244: '+=': conversion from 'int' to 'unsigned short', possible loss of data
|
||||
4245:'=': conversion from 'int' to 'unsigned int', signed/unsigned mismatch
|
||||
|
@ -31,4 +30,3 @@ struct iovec {
|
|||
4804: '-': unsafe use of type 'bool' in operation
|
||||
*/
|
||||
|
||||
|
||||
|
|
Loading…
Reference in a new issue