Skip to content

Commit

Permalink
Rename Args to TestContext
Browse files Browse the repository at this point in the history
  • Loading branch information
martijnbastiaan committed Feb 19, 2025
1 parent e5ece96 commit 6783596
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions clash-vexriscv-sim/tests/Tests/JtagChain.hs
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ getSimulateExecPath = cabalListBin "clash-vexriscv-sim:clash-vexriscv-chain-bin"
getProjectRoot :: IO FilePath
getProjectRoot = findParentContaining cabalProject

data Args = Args
data TestContext = TestContext
{ vexRiscvProc :: CreateProcess
, openOcdProc :: CreateProcess
, gdbProcA :: CreateProcess
Expand All @@ -42,8 +42,8 @@ data Args = Args
, logPathB :: FilePath
}

createArgs :: IO Args
createArgs = do
createTestContext :: IO TestContext
createTestContext = do
simulateExecPath <- getSimulateExecPath
projectRoot <- getProjectRoot
gdb <- getGdb
Expand Down Expand Up @@ -90,7 +90,7 @@ createArgs = do
ensureExists logPathB

pure $
Args
TestContext
{ vexRiscvProc
, openOcdProc
, gdbProcA
Expand All @@ -114,7 +114,7 @@ testBoth debug = do
waitForLine :: (HasCallStack) => Bool -> Handle -> String -> Assertion
waitForLine = waitForLineOrTimeout 120_000_000

Args{vexRiscvProc, openOcdProc, gdbProcA, gdbProcB, logPathA, logPathB} <- createArgs
TestContext{vexRiscvProc, openOcdProc, gdbProcA, gdbProcB, logPathA, logPathB} <- createTestContext

withStreamingFiles (logPathA :> logPathB :> Nil) $ \(vecToTuple -> (logA, logB)) -> do
withCreateProcess vexRiscvProc $ \_ (fromJust -> simStdOut) _ _ -> do
Expand Down Expand Up @@ -165,7 +165,7 @@ testInResetA ::
Bool ->
Assertion
testInResetA debug = do
Args{vexRiscvProc, openOcdProc, gdbProcB, logPathB} <- createArgs
TestContext{vexRiscvProc, openOcdProc, gdbProcB, logPathB} <- createTestContext

let
-- Timeout after 240 seconds. These tests are extremely slow, because a lot
Expand Down Expand Up @@ -208,7 +208,7 @@ testResetDeassertion ::
Bool ->
Assertion
testResetDeassertion debug = do
Args{vexRiscvProc, openOcdProc, gdbProcB, gdbProcA, logPathA, logPathB} <- createArgs
TestContext{vexRiscvProc, openOcdProc, gdbProcB, gdbProcA, logPathA, logPathB} <- createTestContext

let
-- Timeout after 120 seconds. Warning: removing the type signature breaks
Expand Down Expand Up @@ -256,7 +256,7 @@ testResetAssertion ::
Bool ->
Assertion
testResetAssertion debug = do
Args{vexRiscvProc, openOcdProc, gdbProcA, gdbProcB, logPathA, logPathB} <- createArgs
TestContext{vexRiscvProc, openOcdProc, gdbProcA, gdbProcB, logPathA, logPathB} <- createTestContext

let
-- Timeout after 120 seconds. Warning: removing the type signature breaks
Expand Down

0 comments on commit 6783596

Please sign in to comment.