Commit 5c40f695 authored by Valentin Reis's avatar Valentin Reis
Browse files

style refactor

parent 1dbf6426
Pipeline #5472 passed with stage
in 4 minutes and 17 seconds
......@@ -87,34 +87,15 @@ doSpec spec stackArgs = do
printSuccess "Test Successful.\n"
configureTest :: TestType -> TestSpec
configureTest DaemonOnly = TestSpec
{ stackArgsUpdate = \sa -> sa { daemon = daemonBehavior }
, description = "Set up and launch the daemon in synchronous mode."
, isTest = NotTest
}
configureTest DaemonAndApp = TestSpec
{ stackArgsUpdate = \sa ->
sa { daemon = daemonBehavior, cmdrun = runBehavior }
, description = "Set up and start daemon, run a command in a container."
, isTest = NotTest
}
configureTest CsvLogs = TestSpec
{ stackArgsUpdate = \sa -> sa
{ manifestName = "perfwrap.json"
, daemon = daemonBehavior
, cmdrun = runBehavior
, cmdlistenperformance = JustRun (StdOutLog "performance.csv")
(StdErrLog "performance.log")
, cmdlistenpower = JustRun (StdOutLog "power.csv") (StdErrLog "power.log")
, cmdlistenprogress = JustRun (StdOutLog "progress.csv")
(StdErrLog "progress.log")
}
, description = "Set up and start daemon, run a command in a container and"
<> "log performance+power+progress."
, isTest = NotTest
}
configureTest TestHello = TestSpec
{ stackArgsUpdate = \sa -> sa
{ stackArgsUpdate = updater
, description = " Setup stack and check that a hello world app sends"
<> "message back to cmd's stdout."
, isTest = IsTest
}
where
msg = "someComplexTextMessage12349"
updater sa = sa
{ app = AppName "echo"
, args = [AppArg msg]
, daemon = daemonBehavior
......@@ -125,13 +106,14 @@ configureTest TestHello = TestSpec
(StdOutLog "monitored-cmdrun-out.log")
(StdErrLog "monitored-cmdrun-err.log")
}
, description = " Setup stack and check that a hello world app sends"
<> "message back to cmd's stdout."
, isTest = IsTest
}
where msg = "someComplexTextMessage12349"
configureTest TestListen = TestSpec
{ stackArgsUpdate = \sa -> sa
{ stackArgsUpdate = updater
, description = " Setup stack, run command and check that cmd listen receives"
<> "at least the container_exit message from the daemon."
, isTest = IsTest
}
where
updater sa = sa
{ app = AppName "sleep"
, args = [AppArg "1"]
, daemon = daemonBehavior
......@@ -141,12 +123,14 @@ configureTest TestListen = TestSpec
(TextBehaviorStderr ExpectClean)
)
}
, description = " Setup stack, run command and check that cmd listen receives"
<> "at least the container_exit message from the daemon."
, isTest = IsTest
}
configureTest TestPerfwrapper = TestSpec
{ stackArgsUpdate = \sa -> sa
{ stackArgsUpdate = updater
, description = " Setup stack and check that argo-perf-wrapper sends"
<> "at least one *performance* message to cmd listen through the"
, isTest = IsTest
}
where
updater sa = sa
{ manifestName = "perfwrap.json"
, app = AppName "sleep"
, args = [AppArg "15"]
......@@ -158,12 +142,14 @@ configureTest TestPerfwrapper = TestSpec
(TextBehaviorStderr ExpectClean)
)
}
, description = " Setup stack and check that argo-perf-wrapper sends"
<> "at least one *performance* message to cmd listen through the"
configureTest TestPower = TestSpec
{ stackArgsUpdate = updater
, description = " Setup stack and check that the daemon sends"
<> "at least one *power* message to cmd listen."
, isTest = IsTest
}
configureTest TestPower = TestSpec
{ stackArgsUpdate = \sa -> sa
where
updater sa = sa
{ app = AppName "sleep"
, args = [AppArg "15"]
, daemon = daemonBehavior
......@@ -173,12 +159,14 @@ configureTest TestPower = TestSpec
(TextBehaviorStderr ExpectClean)
)
}
, description = " Setup stack and check that the daemon sends"
<> "at least one *power* message to cmd listen."
configureTest TestSTREAM = TestSpec
{ stackArgsUpdate = updater
, description = " Setup stack, run STREAM and check that it sends"
<> "at least one progress message to the daemon."
, isTest = IsTest
}
configureTest TestSTREAM = TestSpec
{ stackArgsUpdate = \sa -> sa
where
updater sa = sa
{ app = AppName "stream_c"
, args = []
, daemon = daemonBehavior
......@@ -189,123 +177,96 @@ configureTest TestSTREAM = TestSpec
(TextBehaviorStderr ExpectClean)
)
}
, description = " Setup stack, run STREAM and check that it sends"
<> "at least one progress message to the daemon."
, isTest = IsTest
configureTest DaemonOnly = TestSpec
{ stackArgsUpdate = updater
, description = "Set up and launch the daemon in synchronous mode."
, isTest = NotTest
}
configureTest RunOpenMC = TestSpec
{ stackArgsUpdate = \sa -> sa
{ preludeCommand = PreludeCommand "cp -r $OPENMC_PWD/* ."
, app = AppName "mpiexec"
, args = let tc = coerce (hwThreadCount sa) :: Int
in [AppArg "-n", AppArg $ repr tc, AppArg "openmc"]
, manifestName = "parallel.json"
, daemon = daemonBehavior
, cmdrun = runBehavior
, cmdlistenperformance = JustRun (StdOutLog "performance.csv")
(StdErrLog "performance.log")
, cmdlistenpower = JustRun (StdOutLog "power.csv") (StdErrLog "power.log")
, cmdlistenprogress = JustRun (StdOutLog "progress.csv")
(StdErrLog "progress.log")
}
, description = "Run OpenMC in the argo stack."
where updater sa = sa { daemon = daemonBehavior }
configureTest DaemonAndApp = TestSpec
{ stackArgsUpdate = updater
, description = "Set up and start daemon, run a command in a container."
, isTest = NotTest
}
configureTest RunQMCPack = TestSpec
{ stackArgsUpdate = \sa -> sa
{ app = AppName "mpirun"
where updater sa = sa { daemon = daemonBehavior, cmdrun = runBehavior }
configureTest CsvLogs =
mkRun id "get all logs from a command running in the stack"
configureTest RunOpenMC = mkRun updater "run OpenMC in the Argo stack."
where
updater sa = sa
{ preludeCommand = PreludeCommand "cp -r $OPENMC_PWD/* ."
, app = AppName "mpiexec"
, args = let tc = coerce (hwThreadCount sa) :: Int
in fmap AppArg ["-n", repr tc, "openmc"]
}
configureTest RunQMCPack = mkRun updater "run QMCPack in the Argo stack."
where
updater sa = sa
{ app = AppName "mpirun"
, args = let tc = coerce (hwThreadCount sa) :: Int
(ShareDir dirn) = shareDir sa
Right inpath = toText (dirn </> "simple-H2O.xml")
in [ AppArg "-n"
, AppArg $ repr tc
, AppArg "qmcpack"
, AppArg inpath
]
, manifestName = "parallel.json"
, daemon = daemonBehavior
, cmdrun = runBehavior
, cmdlistenperformance = JustRun (StdOutLog "performance.csv")
(StdErrLog "performance.log")
, cmdlistenpower = JustRun (StdOutLog "power.csv") (StdErrLog "power.log")
, cmdlistenprogress = JustRun (StdOutLog "progress.csv")
(StdErrLog "progress.log")
in fmap AppArg ["-n", repr tc, "qmcpack", inpath]
}
, description = "Run QMCPACK in the argo stack."
, isTest = NotTest
}
configureTest RunAMG = TestSpec
{ stackArgsUpdate = \sa -> sa
{ app = AppName "mpiexec"
, args = let tc = coerce (hwThreadCount sa) :: Int
in [ AppArg "-n"
, AppArg $ repr tc
, AppArg "amg"
, AppArg "-problem"
, AppArg "2"
, AppArg "-n"
, AppArg "3"
, AppArg "3"
, AppArg "3"
, AppArg "-P"
, AppArg "8"
, AppArg $ repr $ quot tc 8
, AppArg "1"
]
, manifestName = "parallel.json"
, daemon = daemonBehavior
, cmdrun = runBehavior
, cmdlistenperformance = JustRun (StdOutLog "performance.csv")
(StdErrLog "performance.log")
, cmdlistenpower = JustRun (StdOutLog "power.csv") (StdErrLog "power.log")
, cmdlistenprogress = JustRun (StdOutLog "progress.csv")
(StdErrLog "progress.log")
configureTest RunAMG = mkRun updater "run AMG in the Argo stack."
where
updater sa = sa
{ app = AppName "mpiexec"
, args = let tc = coerce (hwThreadCount sa) :: Int
in fmap
AppArg
[ "-n"
, repr tc
, "amg"
, "-problem"
, "2"
, "-n"
, "3"
, "3"
, "3"
, "-P"
, "8"
, repr $ quot tc 8
, "1"
]
}
, description = "Run AMG in the argo stack."
, isTest = NotTest
}
configureTest RunSTREAM = runAppSpec (AppName "stream_c") []
configureTest RunLAMMPS = TestSpec
{ stackArgsUpdate = \sa -> sa
{ app = AppName "mpirun"
configureTest RunSTREAM = mkRun updater "run STREAM in the Argo stack."
where updater sa = sa { app = AppName "stream_c" }
configureTest RunLAMMPS = mkRun updater "run LAMMPS in the argo stack."
where
updater sa = sa
{ app = AppName "mpirun"
, args = let (ShareDir dirn) = shareDir sa
Right inpath = toText (dirn </> "modified.lj")
in [ AppArg "-n"
, AppArg $ repr (coerce (hwThreadCount sa) :: Int)
, AppArg "lmp_mpi"
, AppArg "-i"
, AppArg inpath
]
, manifestName = "parallel.json"
, daemon = daemonBehavior
, cmdrun = runBehavior
, cmdlistenperformance = JustRun (StdOutLog "performance.csv")
(StdErrLog "performance.log")
, cmdlistenpower = JustRun (StdOutLog "power.csv") (StdErrLog "power.log")
, cmdlistenprogress = JustRun (StdOutLog "progress.csv")
(StdErrLog "progress.log")
in fmap
AppArg
[ "-n"
, repr (coerce (hwThreadCount sa) :: Int)
, "lmp_mpi"
, "-i"
, inpath
]
}
, description = "Run LAMMPS in the argo stack."
, isTest = NotTest
}
runAppSpec :: AppName -> [AppArg] -> TestSpec
runAppSpec appName appArgs = TestSpec
{ stackArgsUpdate = \sa -> sa
{ app = appName
, args = appArgs
, manifestName = "parallel.json"
, daemon = daemonBehavior
, cmdrun = runBehavior
, cmdlistenperformance = JustRun (StdOutLog "performance.csv")
(StdErrLog "performance.log")
, cmdlistenpower = JustRun (StdOutLog "power.csv") (StdErrLog "power.log")
, cmdlistenprogress = JustRun (StdOutLog "progress.csv")
(StdErrLog "progress.log")
}
, description = "Set up and start daemon, run app in a container."
, isTest = NotTest
mkRun :: (StackArgs -> StackArgs) -> Text -> TestSpec
mkRun stackArgsUpdate description = TestSpec
{ stackArgsUpdate = stackArgsUpdate . runAppSA
, ..
}
where
isTest = NotTest
runAppSA sa = sa { manifestName = "parallel.json"
, daemon = daemonBehavior
, cmdrun = runBehavior
, cmdlistenperformance = csvBehavior "performance"
, cmdlistenpower = csvBehavior "power"
, cmdlistenprogress = csvBehavior "progress"
}
csvBehavior :: Text -> ProcessBehavior
csvBehavior identifier = JustRun (StdOutLog $identifier <> ".csv")
(StdErrLog $ identifier <> "progress.log")
daemonBehavior :: ProcessBehavior
daemonBehavior =
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment