diff options
author | Roman Smrž <roman.smrz@seznam.cz> | 2025-09-14 21:02:50 +0200 |
---|---|---|
committer | Roman Smrž <roman.smrz@seznam.cz> | 2025-09-15 21:11:01 +0200 |
commit | ed6d95dde5f12727cfa06b851c70b07cb415e9d6 (patch) | |
tree | 57056b70fc9930db23f29597004dd35fbb70fafc /src/Run | |
parent | 8e3d03e55793b49dc6844b23877c84d111e8d7d1 (diff) |
Support zero timeout
Changelog: Support zero as a timeout multiplyer
Diffstat (limited to 'src/Run')
-rw-r--r-- | src/Run/Monad.hs | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/src/Run/Monad.hs b/src/Run/Monad.hs index f681e99..c742987 100644 --- a/src/Run/Monad.hs +++ b/src/Run/Monad.hs @@ -8,6 +8,8 @@ module Run.Monad ( finally, forkTest, forkTestUsing, + + getCurrentTimeout, ) where import Control.Concurrent @@ -43,7 +45,7 @@ data TestEnv = TestEnv , teOptions :: TestOptions , teNextObjId :: MVar Int , teProcesses :: MVar [ Process ] - , teTimeout :: MVar Scientific + , teTimeout :: MVar ( Scientific, Integer ) -- ( positive timeout, number of zero multiplications ) , teGDB :: Maybe (MVar GDB) } @@ -130,3 +132,9 @@ forkTestUsing fork act = do case res of Left e -> atomically $ writeTVar (teFailed $ fst tenv) (Just e) Right () -> return () + +getCurrentTimeout :: TestRun Scientific +getCurrentTimeout = do + ( timeout, zeros ) <- liftIO . readMVar =<< asks (teTimeout . fst) + return $ if zeros > 0 then 0 + else timeout |