summaryrefslogtreecommitdiff
path: root/src/Run.hs
diff options
context:
space:
mode:
authorRoman Smrž <roman.smrz@seznam.cz>2025-06-21 13:58:46 +0200
committerRoman Smrž <roman.smrz@seznam.cz>2025-06-21 15:59:51 +0200
commit06df252ce401f7701f1d830d1867fedda1b36d05 (patch)
tree5e5a044a71a6fa8f151ce581afa1aae34cbaf4e9 /src/Run.hs
parentb7eb345a88df9ee87080fe776722f12e911b773f (diff)
Multiply-timeout command
Changelog: Added `multiply_timeout` command
Diffstat (limited to 'src/Run.hs')
-rw-r--r--src/Run.hs4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/Run.hs b/src/Run.hs
index 2d5029d..4d68fb6 100644
--- a/src/Run.hs
+++ b/src/Run.hs
@@ -59,6 +59,7 @@ runTest out opts gdefs test = do
failedVar <- newTVarIO Nothing
objIdVar <- newMVar 1
procVar <- newMVar []
+ timeoutVar <- newMVar $ optTimeout opts
mgdb <- if optGDB opts
then flip runReaderT out $ do
@@ -72,6 +73,7 @@ runTest out opts gdefs test = do
, teOptions = opts
, teNextObjId = objIdVar
, teProcesses = procVar
+ , teTimeout = timeoutVar
, teGDB = fst <$> mgdb
}
tstate = TestState
@@ -313,7 +315,7 @@ exprFailed desc sline pname exprVars = do
expect :: SourceLine -> Process -> Traced Regex -> [TypedVarName Text] -> ([ Text ] -> TestRun ()) -> TestRun ()
expect sline p (Traced trace re) tvars inner = do
- timeout <- asks $ optTimeout . teOptions . fst
+ timeout <- liftIO . readMVar =<< asks (teTimeout . fst)
delay <- liftIO $ registerDelay $ ceiling $ 1000000 * timeout
mbmatch <- atomicallyTest $ (Nothing <$ (check =<< readTVar delay)) <|> do
line <- readTVar (procOutput p)