diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 3e075e0f..e2c86c32 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -68,14 +68,17 @@ jobs: otp: - 24.3.4 - 25.3.2 + openssl: + - openssl3 + - openssl rebar3: - 3.20.0 build_type: - RelWithDebInfo - Debug logging: - - true - - false + - ON + - OFF arch: - x86_64 steps: @@ -88,16 +91,20 @@ jobs: otp-version: ${{ matrix.otp }} rebar3-version: ${{ matrix.rebar3 }} - name: release build with debug log off + env: + CMAKE_BUILD_TYPE: ${{ matrix.build_type }} + QUIC_TLS: ${{ matrix.openssl }} + QUIC_ENABLE_LOGGING: ${{ matrix.logging }} run: | echo "github ref: ${{ github.event.ref }}" echo "github ref: ${{ github.ref }}" sudo sysctl -w kernel.core_pattern=core ulimit -c unlimited - export CMAKE_BUILD_TYPE=${{ matrix.build_type }} - - if ${{ matrix.logging }}"" == "true" ; then - export QUIC_ENABLE_LOGGING=ON - + export CMAKE_BUILD_TYPE + export QUIC_TLS + export QUIC_ENABLE_LOGGING + if [ "${QUIC_ENABLE_LOGGING}" == "ON" ] ; then + export QUIC_LOGGING_TYPE=lttng sudo apt-add-repository ppa:lttng/stable-2.13 sudo apt-get update sudo apt-get install -y lttng-tools babeltrace liblttng-ust-dev lttng-modules-dkms- diff --git a/CMakeLists.txt b/CMakeLists.txt index e9c5d4c0..5e534ba0 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -21,12 +21,23 @@ else() set(CMAKE_BUILD_TYPE "RelWithDebInfo") endif() +if (DEFINED ENV{QUICER_USE_OPENSSL3}) + message(STATUS "Use openssl3") + set(QUIC_TLS "openssl3") +endif() + if (DEFINED ENV{QUIC_ENABLE_LOGGING}) set(QUIC_ENABLE_LOGGING $ENV{QUIC_ENABLE_LOGGING}) + set(QUIC_LOGGING_TYPE lttng) else() set(QUIC_ENABLE_LOGGING "OFF") endif() +if (DEFINED ENV{QUIC_LOGGING_TYPE}) + set(QUIC_ENABLE_LOGGING "ON") + set(QUIC_LOGGING_TYPE $ENV{QUIC_LOGGING_TYPE}) +endif() + if (DEFINED ENV{QUICER_USE_LTTNG} AND DEFINED ENV{QUICER_USE_SNK}) message(FATAL_ERROR "QUICER_USE_LTTNG and QUICER_USE_SNK cannot be defined at same time") endif() @@ -91,8 +102,8 @@ add_subdirectory(msquic) add_library(quicer_static STATIC ${SOURCES}) target_include_directories(quicer_static PRIVATE ${Erlang_OTP_ROOT_DIR}/usr/include/ msquic/src/inc/) if (CMAKE_SYSTEM_NAME MATCHES Linux) - # note, the value of ${ATOMIC} will be set by msquic - target_link_libraries(quicer_static PRIVATE core platform inc warnings logging ${ATOMIC} "-Wl,--no-gc-sections") + # note, the value of ${ATOMIC} and %{NUMA} will be set by msquic + target_link_libraries(quicer_static PRIVATE core platform inc warnings logging ${ATOMIC} ${NUMA} "-Wl,--no-gc-sections") elseif (CMAKE_SYSTEM_NAME MATCHES Darwin) target_link_libraries(quicer_static PRIVATE core platform inc warnings "-Wl,-undefined,dynamic_lookup -Wl,-dead_strip") endif() @@ -125,7 +136,7 @@ set_target_properties(quicer_nif LIBRARY_OUTPUT_DIRECTORY ${PROJECT_SOURCE_DIR}/priv/ ) -if (QUIC_ENABLE_LOGGING) +if (QUIC_ENABLE_LOGGING STREQUAL "ON" AND QUIC_LOGGING_TYPE STREQUAL "lttng") set_target_properties(msquic.lttng PROPERTIES LIBRARY_OUTPUT_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/priv) set_target_properties(msquic.lttng PROPERTIES LIBRARY_OUTPUT_DIRECTORY_DEBUG ${CMAKE_CURRENT_SOURCE_DIR}/priv) endif() diff --git a/Makefile b/Makefile index c381d312..9d495b85 100644 --- a/Makefile +++ b/Makefile @@ -8,7 +8,7 @@ default: build-nif .PHONY: build-nif build-nif: - ./build.sh 'v2.1.8' + ./build.sh 'v2.2.2' compile: $(REBAR) compile diff --git a/test/quicer_listener_SUITE.erl b/test/quicer_listener_SUITE.erl index c4ef6695..ce4f3e5d 100644 --- a/test/quicer_listener_SUITE.erl +++ b/test/quicer_listener_SUITE.erl @@ -199,7 +199,7 @@ tc_open_listener(Config) -> {ok, {_, Port}} = quicer:sockname(L), {error, eaddrinuse} = gen_udp:open(Port), ok = quicer:close_listener(L), - {ok, P} = gen_udp:open(Port), + {ok, P} = snabbkaffe:retry(100, 10, fun()-> {ok, _} = gen_udp:open(Port) end), ok = gen_udp:close(P), ok. @@ -224,7 +224,7 @@ tc_open_listener_with_new_reg(Config) -> %% Then Listener is created successfully and port is occupied {error, eaddrinuse} = gen_udp:open(Port), ok = quicer:close_listener(L), - {ok, P} = gen_udp:open(Port), + {ok, P} = snabbkaffe:retry(100, 10, fun()-> {ok, _} = gen_udp:open(Port) end), ok = gen_udp:close(P), ok = quicer:shutdown_registration(Reg), ok. @@ -251,22 +251,24 @@ tc_open_listener_with_wrong_cert_password(Config) -> , quicer:listen(Port, default_listen_opts(PasswordCerts ++ Config))). tc_open_listener_bind(Config) -> - ListenOn = "127.0.0.1:4567", + Port = select_port(), + ListenOn = "127.0.0.1"++":"++integer_to_list(Port), {ok, L} = quicer:listen(ListenOn, default_listen_opts(Config)), {ok, {_, _}} = quicer:sockname(L), - {error,eaddrinuse} = gen_udp:open(4567), + {error, eaddrinuse} = gen_udp:open(Port), ok = quicer:close_listener(L), - {ok, P} = gen_udp:open(4567), + {ok, P} = snabbkaffe:retry(100, 10, fun() -> {ok, _} = gen_udp:open(Port) end), ok = gen_udp:close(P), ok. tc_open_listener_bind_v6(Config) -> - ListenOn = "[::1]:4567", + Port = select_port(), + ListenOn = "[::1]"++":"++integer_to_list(Port), {ok, L} = quicer:listen(ListenOn, default_listen_opts(Config)), {ok, {_, _}} = quicer:sockname(L), - {error,eaddrinuse} = gen_udp:open(4567, [{ip, {0, 0, 0, 0, 0, 0, 0, 1}}]), + {error, eaddrinuse} = gen_udp:open(Port, [{ip, {0, 0, 0, 0, 0, 0, 0, 1}}]), ok = quicer:close_listener(L), - {ok, P} = gen_udp:open(4567, [{ip, {0, 0, 0, 0, 0, 0, 0, 1}}]), + {ok, P} = snabbkaffe:retry(100, 10, fun() -> {ok, _} = gen_udp:open(Port, [{ip, {0, 0, 0, 0, 0, 0, 0, 1}}]) end), ok = gen_udp:close(P), ok. @@ -325,7 +327,7 @@ tc_stop_start_listener(Config) -> LConf = default_listen_opts(Config), {ok, L} = quicer:listen(Port, LConf), ok = quicer:stop_listener(L), - ok = quicer:start_listener(L, Port, LConf), + ok = snabbkaffe:retry(100, 10, fun() -> ok = quicer:start_listener(L, Port, LConf) end), ok = quicer:close_listener(L). tc_stop_close_listener(Config) -> @@ -465,7 +467,9 @@ tc_listener_stopped_when_owner_die(Config) -> ok = quicer:close_listener(L1). select_port() -> - select_free_port(quic). + Port = select_free_port(quic), + timer:sleep(100), + Port. %%%_* Emacs ==================================================================== %%% Local Variables: diff --git a/test/quicer_snb_SUITE.erl b/test/quicer_snb_SUITE.erl index bbd60bfd..f6e3fcea 100644 --- a/test/quicer_snb_SUITE.erl +++ b/test/quicer_snb_SUITE.erl @@ -1701,16 +1701,22 @@ tc_conn_stop_notify_acceptor(Config) -> ct:pal("Listener Options: ~p", [Options]), ?check_trace(#{timetrap => 10000}, begin - {ok, Listener} = quicer:listen(Port, ListenerOpts), + Parent = self(), {SPid, Ref} = spawn_monitor(fun() -> + {ok, Listener} = quicer:listen(Port, ListenerOpts), + Parent ! {self(), ready}, {ok, Conn} = quicer:accept(Listener, []), Acceptors = lists:map(fun(_) -> spawn(quicer, accept_stream, [Conn, []]) end, lists:seq(1, 100)), {ok, Conn} = quicer:handshake(Conn), - {error, closed} = quicer:accept_stream(Conn, []), + case quicer:accept_stream(Conn, []) of + {error, closed} -> ok; + {ok, _Stream} -> ok + end, exit({normal, Acceptors}) end), + receive {SPid, ready} -> ok end, {ok, Conn} = quicer:connect("localhost", Port, default_conn_opts(), infinity), quicer:shutdown_connection(Conn),