Skip to content

Commit a66b72b

Browse files
committed
Add hook to print memory info before/after tests.
1 parent 812c47d commit a66b72b

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

rules_haskell_tests/tests/RunTests.hs

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ import IntegrationTesting
2323

2424
main :: IO ()
2525
main = hspec $ do
26-
afterAll_ shutdownBazel $ do
26+
afterAll_ shutdownBazel $ after_ printMemoryHook $ do
2727
it "bazel test" $ do
2828
assertSuccess (bazel ["test", "//..."])
2929

@@ -179,6 +179,14 @@ shutdownBazel = do
179179
printMemory "AFTER"
180180
pure ()
181181

182+
-- | Print memory information before and after each test
183+
printMemoryHook :: IO () -> IO ()
184+
printMemoryHook action = bracket
185+
(printMemory "BEFORE")
186+
(printMemory "AFTER")
187+
(const action)
188+
189+
182190
-- | Print information about the current memory state to debug intermittent failures
183191
-- Related to https://github.com/tweag/rules_haskell/issues/2089
184192
printMemory :: String -> IO ()

0 commit comments

Comments
 (0)