From 1c5cc6281d1320b3ad3ee586368c0c1dacce0cbe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Roman=20Smr=C5=BE?= Date: Wed, 18 Aug 2021 22:00:27 +0200 Subject: Parser of test scripts --- src/Main.hs | 27 +++++---------------------- 1 file changed, 5 insertions(+), 22 deletions(-) (limited to 'src/Main.hs') 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 -- cgit v1.2.3