From f0ba8d8d7711ff8ef60f4f3e529c18a435d5e92d Mon Sep 17 00:00:00 2001 From: Mrmaxmeier Date: Wed, 3 Dec 2025 16:45:39 +0100 Subject: [PATCH] haskellPackages.threads: add workaround for flaky test --- .../haskell-modules/configuration-nix.nix | 3 +++ .../patches/threads-flaky-test.patch | 13 +++++++++++++ 2 files changed, 16 insertions(+) create mode 100644 pkgs/development/haskell-modules/patches/threads-flaky-test.patch diff --git a/pkgs/development/haskell-modules/configuration-nix.nix b/pkgs/development/haskell-modules/configuration-nix.nix index 24d363c906f0..2921711e97c9 100644 --- a/pkgs/development/haskell-modules/configuration-nix.nix +++ b/pkgs/development/haskell-modules/configuration-nix.nix @@ -2129,4 +2129,7 @@ builtins.intersectAttrs super { cpython = doJailbreak super.cpython; botan-bindings = super.botan-bindings.override { botan = pkgs.botan3; }; + + # Workaround for flaky test: https://github.com/basvandijk/threads/issues/10 + threads = appendPatch ./patches/threads-flaky-test.patch super.threads; } diff --git a/pkgs/development/haskell-modules/patches/threads-flaky-test.patch b/pkgs/development/haskell-modules/patches/threads-flaky-test.patch new file mode 100644 index 000000000000..afbdf0dc4c76 --- /dev/null +++ b/pkgs/development/haskell-modules/patches/threads-flaky-test.patch @@ -0,0 +1,13 @@ +diff --git a/test/test.hs b/test/test.hs +index 0251552..dc799a7 100644 +--- a/test/test.hs ++++ b/test/test.hs +@@ -214,7 +214,7 @@ wrap :: (ThreadGroup -> Fork a) -> (Fork a -> IO b) -> IO b + wrap doFork test = ThreadGroup.new >>= test . doFork + + test_group_single_wait :: (ThreadGroup -> Fork ()) -> Assertion +-test_group_single_wait doFork = assert $ fmap isJustTrue $ timeout (10 * a_moment) $ do ++test_group_single_wait doFork = assert $ fmap isJustTrue $ timeout (100 * a_moment) $ do + tg <- ThreadGroup.new + r <- newIORef False + _ <- doFork tg $ do