mvfst: enable tests

This commit is contained in:
Emily 2024-11-14 02:11:05 +00:00
parent e5709fe814
commit ea635930e7

View File

@ -14,6 +14,8 @@
darwinMinVersionHook,
fizz,
gtest,
}:
stdenv.mkDerivation (finalAttrs: {
@ -47,11 +49,17 @@ stdenv.mkDerivation (finalAttrs: {
fizz
];
checkInputs = [
gtest
];
cmakeFlags =
[
(lib.cmakeBool "BUILD_SHARED_LIBS" (!stdenv.hostPlatform.isStatic))
(lib.cmakeBool "CMAKE_INSTALL_RPATH_USE_LINK_PATH" true)
(lib.cmakeBool "BUILD_TESTS" finalAttrs.finalPackage.doCheck)
]
++ lib.optionals stdenv.hostPlatform.isDarwin [
# Homebrew sets this, and the shared library build fails without
@ -59,12 +67,46 @@ stdenv.mkDerivation (finalAttrs: {
(lib.cmakeFeature "CMAKE_SHARED_LINKER_FLAGS" "-Wl,-undefined,dynamic_lookup")
];
__darwinAllowLocalNetworking = true;
doCheck = true;
postPatch = ''
# Make sure the libraries the `tperf` binary uses are installed.
printf 'install(TARGETS mvfst_test_utils)\n' >> quic/common/test/CMakeLists.txt
printf 'install(TARGETS mvfst_dsr_backend)\n' >> quic/dsr/CMakeLists.txt
'';
checkPhase = ''
runHook preCheck
ctest -j $NIX_BUILD_CORES --output-on-failure ${
lib.optionalString stdenv.hostPlatform.isLinux (
lib.escapeShellArgs [
"--exclude-regex"
(lib.concatMapStringsSep "|" (test: "^${lib.escapeRegex test}$") [
"*/QuicClientTransportIntegrationTest.NetworkTest/*"
"*/QuicClientTransportIntegrationTest.FlowControlLimitedTest/*"
"*/QuicClientTransportIntegrationTest.NetworkTestConnected/*"
"*/QuicClientTransportIntegrationTest.SetTransportSettingsAfterStart/*"
"*/QuicClientTransportIntegrationTest.TestZeroRttSuccess/*"
"*/QuicClientTransportIntegrationTest.ZeroRttRetryPacketTest/*"
"*/QuicClientTransportIntegrationTest.NewTokenReceived/*"
"*/QuicClientTransportIntegrationTest.UseNewTokenThenReceiveRetryToken/*"
"*/QuicClientTransportIntegrationTest.TestZeroRttRejection/*"
"*/QuicClientTransportIntegrationTest.TestZeroRttNotAttempted/*"
"*/QuicClientTransportIntegrationTest.TestZeroRttInvalidAppParams/*"
"*/QuicClientTransportIntegrationTest.ChangeEventBase/*"
"*/QuicClientTransportIntegrationTest.ResetClient/*"
"*/QuicClientTransportIntegrationTest.TestStatelessResetToken/*"
])
]
)
}
runHook postCheck
'';
meta = {
description = "Implementation of the QUIC transport protocol";
homepage = "https://github.com/facebook/mvfst";