remove withTmpFile
This commit is contained in:
parent
90960296b1
commit
e1fd5bb326
@ -108,32 +108,31 @@ testStressServerConnectOnly = do
|
|||||||
-- disconnectAgentClient smpAgent
|
-- disconnectAgentClient smpAgent
|
||||||
|
|
||||||
testStressServer :: IO ()
|
testStressServer :: IO ()
|
||||||
testStressServer =
|
testStressServer = do
|
||||||
withTmpFiles $ do
|
sentTVar <- newTVarIO (0 :: Int)
|
||||||
sentTVar <- newTVarIO (0 :: Int)
|
tcpConnectionsTVar <- newTVarIO (0 :: Int)
|
||||||
tcpConnectionsTVar <- newTVarIO (0 :: Int)
|
userConnectionsTVar <- newTVarIO (0 :: Int)
|
||||||
userConnectionsTVar <- newTVarIO (0 :: Int)
|
concurrentlyN_ $
|
||||||
concurrentlyN_ $
|
forever
|
||||||
forever
|
( do
|
||||||
( do
|
threadDelay 5000000
|
||||||
threadDelay 5000000
|
sent <- readTVarIO sentTVar
|
||||||
sent <- readTVarIO sentTVar
|
tcpConnections <- readTVarIO tcpConnectionsTVar
|
||||||
tcpConnections <- readTVarIO tcpConnectionsTVar
|
userConnections <- readTVarIO userConnectionsTVar
|
||||||
userConnections <- readTVarIO userConnectionsTVar
|
print $ "tcpConnections: " <> show tcpConnections <> " -- userConnections: " <> show userConnections <> " -- sent: " <> show sent
|
||||||
print $ "tcpConnections: " <> show tcpConnections <> " -- userConnections: " <> show userConnections <> " -- sent: " <> show sent
|
) :
|
||||||
) :
|
map
|
||||||
map
|
( \i ->
|
||||||
( \i ->
|
testChat2' (i * 2 -1, aliceProfile) (i * 2, bobProfile) $
|
||||||
testChat2' (i * 2 -1, aliceProfile) (i * 2, bobProfile) $
|
\alice bob -> do
|
||||||
\alice bob -> do
|
print $ show i <> " - tcpConnections +2"
|
||||||
print $ show i <> " - tcpConnections +2"
|
atomically $ modifyTVar tcpConnectionsTVar (+ 2)
|
||||||
atomically $ modifyTVar tcpConnectionsTVar (+ 2)
|
connectUsers alice bob
|
||||||
connectUsers alice bob
|
print $ show i <> " - userConnections +2"
|
||||||
print $ show i <> " - userConnections +2"
|
atomically $ modifyTVar userConnectionsTVar (+ 2)
|
||||||
atomically $ modifyTVar userConnectionsTVar (+ 2)
|
loop i alice bob sentTVar 1
|
||||||
loop i alice bob sentTVar 1
|
)
|
||||||
)
|
(take 25 ([1 ..] :: [Int]))
|
||||||
(take 25 ([1 ..] :: [Int]))
|
|
||||||
where
|
where
|
||||||
loop :: Int -> TestCC -> TestCC -> TVar Int -> Int -> IO ()
|
loop :: Int -> TestCC -> TestCC -> TVar Int -> Int -> IO ()
|
||||||
loop i alice bob sentTVar k = do
|
loop i alice bob sentTVar k = do
|
||||||
|
@ -131,8 +131,8 @@ readTerminalOutput t termQ = do
|
|||||||
withTmpFiles :: IO () -> IO ()
|
withTmpFiles :: IO () -> IO ()
|
||||||
withTmpFiles =
|
withTmpFiles =
|
||||||
bracket_
|
bracket_
|
||||||
(createDirectoryIfMissing False "tests/tmp")
|
(createDirectoryIfMissing False "tests")
|
||||||
(removeDirectoryRecursive "tests/tmp")
|
(removeDirectoryRecursive "test")
|
||||||
|
|
||||||
testChat2' :: (Int, Profile) -> (Int, Profile) -> (TestCC -> TestCC -> IO ()) -> IO ()
|
testChat2' :: (Int, Profile) -> (Int, Profile) -> (TestCC -> TestCC -> IO ()) -> IO ()
|
||||||
testChat2' (i1, p1) (i2, p2) test = do
|
testChat2' (i1, p1) (i2, p2) test = do
|
||||||
|
Loading…
Reference in New Issue
Block a user