Skip to content

Commit

Permalink
Onboard Tests (#95)
Browse files Browse the repository at this point in the history
* Onboard Tests

* Don't split

* typo

* use 4433

* Set QUIC_OUTPUT_DIR

* Try to fix this stuff

* Fix

* Another fix

* Some more fixes

* Windows only
  • Loading branch information
nibanks authored Dec 27, 2022
1 parent c6c266b commit 42bf03a
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 10 deletions.
9 changes: 6 additions & 3 deletions .github/workflows/build.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,9 @@ if (!(Test-Path "./artifacts")) {
New-Item -Path "./artifacts" -ItemType Directory -Force | Out-Null
}

$Build = Resolve-Path ./build
$Artifacts = Resolve-Path ./artifacts

$Shared = "off"
if ($Link -ne "static") { $Shared = "on" }

Expand All @@ -65,7 +68,7 @@ if ($WithTests) { $Tests = "on" }

function Execute([String]$Name, [String]$Arguments) {
Write-Debug "$Name $Arguments"
$process = Start-Process $Name $Arguments -PassThru -NoNewWindow -WorkingDirectory "./build"
$process = Start-Process $Name $Arguments -PassThru -NoNewWindow -WorkingDirectory $Build
$handle = $process.Handle # Magic work around. Don't remove this line.
$process.WaitForExit();
if ($process.ExitCode -ne 0) {
Expand All @@ -77,13 +80,13 @@ if ($IsWindows) {

$_Arch = $Arch
if ($_Arch -eq "x86") { $_Arch = "Win32" }
Execute "cmake" "-G ""Visual Studio 17 2022"" -A $_Arch -DMSH3_OUTPUT_DIR=../../artifacts -DQUIC_TLS=$Tls -DQUIC_BUILD_SHARED=$Shared -DMSH3_SERVER_SUPPORT=$Server -DMSH3_TEST=$Tests -DMSH3_TOOL=$Tools -DMSH3_VER_BUILD_ID=$BuildId -DMSH3_VER_SUFFIX=$Suffix .."
Execute "cmake" "-G ""Visual Studio 17 2022"" -A $_Arch -DMSH3_OUTPUT_DIR=$Artifacts -DQUIC_TLS=$Tls -DQUIC_BUILD_SHARED=$Shared -DMSH3_SERVER_SUPPORT=$Server -DMSH3_TEST=$Tests -DMSH3_TOOL=$Tools -DMSH3_VER_BUILD_ID=$BuildId -DMSH3_VER_SUFFIX=$Suffix .."
Execute "cmake" "--build . --config $Config"

} else {

$BuildType = $Config
if ($BuildType -eq "Release") { $BuildType = "RelWithDebInfo" }
Execute "cmake" "-G ""Unix Makefiles"" -DCMAKE_BUILD_TYPE=$BuildType -DMSH3_OUTPUT_DIR=../../artifacts -DQUIC_TLS=$Tls -DQUIC_BUILD_SHARED=$Shared -DMSH3_SERVER_SUPPORT=$Server -DMSH3_TEST=$Tests -DMSH3_TOOL=$Tools .."
Execute "cmake" "-G ""Unix Makefiles"" -DCMAKE_BUILD_TYPE=$BuildType -DMSH3_OUTPUT_DIR=$Artifacts -DQUIC_TLS=$Tls -DQUIC_BUILD_SHARED=$Shared -DMSH3_SERVER_SUPPORT=$Server -DMSH3_TEST=$Tests -DMSH3_TOOL=$Tools .."
Execute "cmake" "--build ."
}
10 changes: 9 additions & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,10 +49,18 @@ jobs:
uses: actions/upload-artifact@83fd05a356d7e2593de66fc9913b3002723633cb
with:
name: bin-${{ matrix.os }}-${{ matrix.tls }}-${{ matrix.link }}-${{ matrix.mode }}-${{ matrix.config }}
path: artifacts/*
path: |
artifacts/*.dll
artifacts/*.exe
artifacts/*.so
artifacts/msh3app
artifacts/msh3test
- name: msh3app
run: |
./artifacts/msh3app outlook.office.com -v
./artifacts/msh3app www.cloudflare.com -v
./artifacts/msh3app www.google.com -v
./artifacts/msh3app nghttp2:4433 -v
- name: msh3test
if: matrix.mode == 'server'
run: ./artifacts/msh3test
18 changes: 15 additions & 3 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,18 +1,20 @@
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.

message(STATUS "msh3: Configuration start...")
project(msh3)

cmake_minimum_required(VERSION 3.16)

option(MSH3_SERVER_SUPPORT "Enable server support" OFF)
option(MSH3_TOOL "Build tool" OFF)
option(MSH3_TEST "Build tests" OFF)

set(MSH3_VER_BUILD_ID "0" CACHE STRING "The version build ID")
message(STATUS "Version Build ID: ${MSH3_VER_BUILD_ID}")
message(STATUS "msh3: Version Build ID: ${MSH3_VER_BUILD_ID}")

set(MSH3_VER_SUFFIX "-private" CACHE STRING "The version suffix")
message(STATUS "Version Suffix: ${MSH3_VER_SUFFIX}")
message(STATUS "msh3: Version Suffix: ${MSH3_VER_SUFFIX}")

# use, i.e. don't skip the full RPATH for the build tree
set(CMAKE_SKIP_BUILD_RPATH FALSE)
Expand All @@ -34,16 +36,26 @@ if (WIN32)
# TODO - Get these to work on Linux
list(APPEND MSH3_COMMON_DEFINES VER_BUILD_ID=${MSH3_VER_BUILD_ID})
list(APPEND MSH3_COMMON_DEFINES VER_SUFFIX=${MSH3_VER_SUFFIX})
if(HAS_SPECTRE)
list(APPEND QUIC_COMMON_FLAGS /Qspectre)
endif()
# Compile/link flags
set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} /GL /Zi")
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /GL /Zi")
set(CMAKE_SHARED_LINKER_FLAGS_RELEASE "${CMAKE_SHARED_LINKER_FLAGS_RELEASE} /LTCG /IGNORE:4075 /DEBUG /OPT:REF /OPT:ICF")
set(CMAKE_EXE_LINKER_FLAGS_RELEASE "${CMAKE_EXE_LINKER_FLAGS_RELEASE} /LTCG /IGNORE:4075 /DEBUG /OPT:REF /OPT:ICF")
else()
set(QUIC_COMMON_DEFINES _GNU_SOURCE)
endif()

if (MSH3_SERVER_SUPPORT)
message(STATUS "Configuring for server support")
message(STATUS "msh3: Configuring for server support")
list(APPEND MSH3_COMMON_DEFINES MSH3_SERVER_SUPPORT=1)
endif()

set(MSH3_OUTPUT_DIR ${CMAKE_CURRENT_BINARY_DIR}/bin CACHE STRING "Output directory for build artifacts")
message(STATUS "msh3: Output set to ${MSH3_OUTPUT_DIR}")
set(QUIC_OUTPUT_DIR ${MSH3_OUTPUT_DIR} CACHE STRING "Output directory for build artifacts")
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${MSH3_OUTPUT_DIR})
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${MSH3_OUTPUT_DIR})
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY_RELEASE ${MSH3_OUTPUT_DIR})
Expand Down
6 changes: 3 additions & 3 deletions test/msh3test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -149,14 +149,14 @@ int MSH3_CALL main(int , char**) {

MSH3_ADDR Address = {0};
#if _WIN32
Address.Ipv4.sin_port = _byteswap_ushort(443);
Address.Ipv4.sin_port = _byteswap_ushort(4433);
#else
Address.Ipv4.sin_port = __builtin_bswap16(443);
Address.Ipv4.sin_port = __builtin_bswap16(4433);
#endif
auto Listener = MsH3ListenerOpen(Api, &Address, &ListenerIf, Cert);
VERIFY(Listener);

auto Connection = MsH3ConnectionOpen(Api, &ClientConnIf, nullptr, "localhost", 443, true);
auto Connection = MsH3ConnectionOpen(Api, &ClientConnIf, nullptr, "localhost", 4433, true);
VERIFY(Connection);

auto Request = MsH3RequestOpen(Connection, &ClientRequestIf, nullptr, RequestHeaders, RequestHeadersCount, MSH3_REQUEST_FLAG_FIN);
Expand Down

0 comments on commit 42bf03a

Please sign in to comment.