From 54d127112539906df42e3fa799ccb7e970ac4f06 Mon Sep 17 00:00:00 2001 From: Emily Date: Thu, 14 Nov 2024 02:11:05 +0000 Subject: [PATCH] mvfst: enable tests (cherry picked from commit ea635930e783661d12ffd5a589981c89ee84b646) (cherry picked from commit 1c62b5c4a67aa745e153988a206377f7607dd9ec) --- pkgs/by-name/mv/mvfst/package.nix | 42 +++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) diff --git a/pkgs/by-name/mv/mvfst/package.nix b/pkgs/by-name/mv/mvfst/package.nix index 73f06c4cd677..8bbc024263e8 100644 --- a/pkgs/by-name/mv/mvfst/package.nix +++ b/pkgs/by-name/mv/mvfst/package.nix @@ -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";