summaryrefslogtreecommitdiff
path: root/src/Main.hs
diff options
context:
space:
mode:
authorRoman Smrž <roman.smrz@seznam.cz>2021-08-18 22:00:27 +0200
committerRoman Smrž <roman.smrz@seznam.cz>2021-08-18 22:00:27 +0200
commit1c5cc6281d1320b3ad3ee586368c0c1dacce0cbe (patch)
tree648e82b91b902b855f23fea22992a3a66ab9be9f /src/Main.hs
parentf0d6957a0b1cbc0bf35d2d82225c4221f9c50927 (diff)
Parser of test scripts
Diffstat (limited to 'src/Main.hs')
-rw-r--r--src/Main.hs27
1 files changed, 5 insertions, 22 deletions
diff --git a/src/Main.hs b/src/Main.hs
index ca501bf..2c16a16 100644
--- a/src/Main.hs
+++ b/src/Main.hs
@@ -21,6 +21,7 @@ import System.IO
import System.IO.Error
import System.Process
+import Parser
import Test
data Network = Network
@@ -193,25 +194,7 @@ runTest tool test = do
main :: IO ()
main = do
- [tool] <- getArgs
-
- let pat1 = "peer [0-9]+ 192.168.0.11:29665"
- let pat2 = "peer [0-9]+ 192.168.0.12:29665"
- Right re1 <- return $ compile defaultCompOpt defaultExecOpt ("^" ++ pat1 ++ "$")
- Right re2 <- return $ compile defaultCompOpt defaultExecOpt ("^" ++ pat2 ++ "$")
-
- runTest tool Test
- { testName = T.pack "Test"
- , testSteps =
- [ Spawn (ProcName (T.pack "p1")) (NodeName (T.pack "n1"))
- , Spawn (ProcName (T.pack "p2")) (NodeName (T.pack "n2"))
- , Send (ProcName (T.pack "p1")) (T.pack "create-identity Device1")
- , Send (ProcName (T.pack "p2")) (T.pack "create-identity Device2")
- , Send (ProcName (T.pack "p1")) (T.pack "start-server")
- , Send (ProcName (T.pack "p2")) (T.pack "start-server")
- , Expect (ProcName (T.pack "p1")) re1
- , Expect (ProcName (T.pack "p1")) re2
- , Expect (ProcName (T.pack "p2")) re2
- , Expect (ProcName (T.pack "p2")) re1
- ]
- }
+ tool <- getEnv "EREBOS_TEST_TOOL"
+ files <- getArgs
+
+ forM_ files $ mapM_ (runTest tool) <=< parseTestFile