all-tests.dh 6.82 KB
Newer Older
1
  λ(dataDir : Text)
Valentin Reis's avatar
Valentin Reis committed
2 3
→ λ(manifestDir : Text)
→ λ(isTest : Bool)
Valentin Reis's avatar
Valentin Reis committed
4
→ let assetDir = dataDir ++ "assets/"
Valentin Reis's avatar
Valentin Reis committed
5 6 7 8 9 10 11
  
  let types = ./resources/types.dh
  
  let argotypes = ./argo/types.dh
  
  let argo = ./argo/package.dh
  
12
  let message = "HelloWorld"
Valentin Reis's avatar
Valentin Reis committed
13
  
14
  let cn = "testContainer"
Valentin Reis's avatar
Valentin Reis committed
15
  
Valentin Reis's avatar
Valentin Reis committed
16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41
  let idCmd = let id = λ(a : Type) → λ(x : a) → x in id types.Cmd
  
  let makeExtended =
          λ(daemonArg : argotypes.MkDaemon)
        → λ(daemonOverrides : types.Cmd → types.Cmd)
        → λ(runArg : argotypes.MkRun)
        → λ(runOverrides : types.Cmd → types.Cmd)
        → λ(extraCmds : List types.Cmd)
        →   { cmds =
                  [ daemonOverrides (argo.nrmd.mk daemonArg)
                  , runOverrides (argo.run.mk runArg)
                  ]
                # extraCmds
            , verbose =
                True
            , cleaning =
                True
            , workdir =
                "./_output"
            , pre =
                [] : List Text
            , post =
                [] : List Text
            }
          : types.Config
  
Valentin Reis's avatar
Valentin Reis committed
42 43 44 45 46 47
  let manifests =
        { basic =
            manifestDir ++ "basic.yml"
        , perf =
            manifestDir ++ "perfwrap.yml"
        }
Valentin Reis's avatar
Valentin Reis committed
48
  
Valentin Reis's avatar
Valentin Reis committed
49 50 51 52 53
  let ifTest =
          λ(t : Type)
        → λ(default : t)
        → λ(value : t)
        → if isTest then value else default
Valentin Reis's avatar
Valentin Reis committed
54
  
Valentin Reis's avatar
Valentin Reis committed
55
  let ifTestList = ifTest (List Text) ([] : List Text)
Valentin Reis's avatar
Valentin Reis committed
56
  
Valentin Reis's avatar
Valentin Reis committed
57 58 59 60 61
  let ifTestTimeout =
        ifTest
        (Optional Natural)
        ([] : Optional Natural)
        ([ 600 ] : Optional Natural)
Valentin Reis's avatar
Valentin Reis committed
62
  
Valentin Reis's avatar
Valentin Reis committed
63 64 65 66
  let withDaemon =
          λ(runArg : argotypes.MkRun)
        → λ(runOverrides : types.Cmd → types.Cmd)
        → λ(extraCmds : List types.Cmd)
Valentin Reis's avatar
Valentin Reis committed
67
        → makeExtended
Valentin Reis's avatar
Valentin Reis committed
68 69 70 71 72
          (   argo.nrmd.defarg
            ⫽ { daemonavoids =
                  ifTestList [ "Traceback", "ValueError" ]
              , powercap =
                  < NoCap = {=} | Cap : Text > : argotypes.Powercap
73 74
              }
          )
Valentin Reis's avatar
Valentin Reis committed
75 76 77 78
          idCmd
          (   runArg
            ⫽ { cmdavoids = runArg.cmdavoids # ifTestList [ "Traceback" ] }
          )
Valentin Reis's avatar
Valentin Reis committed
79 80 81 82 83 84 85 86
          (λ(c : types.Cmd) → runOverrides (c ⫽ { timeout = ifTestTimeout }))
          extraCmds
  
  let withDaemonNoExtras =
          λ(runArg : argotypes.MkRun)
        → λ(runOverrides : types.Cmd → types.Cmd)
        → withDaemon runArg runOverrides ([] : List types.Cmd)
  
Valentin Reis's avatar
Valentin Reis committed
87
  let withDaemonExtraProgresstest =
Valentin Reis's avatar
Valentin Reis committed
88 89 90 91 92 93
          λ(runArg : argotypes.MkRun)
        → λ(runOverrides : types.Cmd → types.Cmd)
        → withDaemon
          runArg
          runOverrides
          [ argo.listen.mk
Valentin Reis's avatar
Valentin Reis committed
94
            (argo.listen.defarg cn ⫽ { filter = "progress", doFilter = True })
Valentin Reis's avatar
Valentin Reis committed
95 96 97 98 99 100 101
          ]
  
  let basicRun = λ(name : Text) → argo.run.defarg name manifests.basic cn
  
  let perfRun = λ(name : Text) → argo.run.defarg name manifests.perf cn
  
  in  { run =
Valentin Reis's avatar
Valentin Reis committed
102
          withDaemonNoExtras (basicRun "true") idCmd
103
      , pwd =
Valentin Reis's avatar
Valentin Reis committed
104 105 106 107 108
          let somedir = "toto"
          
          in  withDaemonNoExtras
              (basicRun "pwd" ⫽ { cmdwants = [ somedir ] : List Text })
              (λ(x : types.Cmd) → x ⫽ { otherwd = [ somedir ] : Optional Text })
Valentin Reis's avatar
Valentin Reis committed
109
      , exitcode =
Valentin Reis's avatar
Valentin Reis committed
110 111 112
          withDaemonNoExtras
          (basicRun "false")
          (λ(x : types.Cmd) → x ⫽ { exitcode = [ +1 ] : Optional Integer })
113
      , hello =
Valentin Reis's avatar
Valentin Reis committed
114 115 116
          withDaemonNoExtras
          (   basicRun "echo"
            ⫽ { args = [ message ], cmdwants = [ message ] : List Text }
117
          )
Valentin Reis's avatar
Valentin Reis committed
118
          idCmd
119
      , listen =
Valentin Reis's avatar
Valentin Reis committed
120 121
          withDaemon
          (basicRun "sleep" ⫽ { args = [ "1" ] })
Valentin Reis's avatar
Valentin Reis committed
122
          idCmd
Valentin Reis's avatar
Valentin Reis committed
123
          [ argo.listen.mk (argo.listen.defarg cn ⫽ { doFilter = False }) ]
124
      , power =
Valentin Reis's avatar
Valentin Reis committed
125 126
          withDaemon
          (basicRun "sleep" ⫽ { args = [ "15" ] })
Valentin Reis's avatar
Valentin Reis committed
127
          idCmd
Valentin Reis's avatar
Valentin Reis committed
128 129 130
          [ argo.listen.mk
            (argo.listen.defarg cn ⫽ { filter = "power", doFilter = True })
          ]
131
      , performance =
Valentin Reis's avatar
Valentin Reis committed
132 133 134 135 136 137 138 139
          withDaemon
          (perfRun "sleep" ⫽ { args = [ "15" ] })
          idCmd
          [ argo.listen.mk
            (   argo.listen.defarg cn
              ⫽ { filter = "performance", doFilter = True }
            )
          ]
140
      , qmcpack =
Valentin Reis's avatar
Valentin Reis committed
141 142
          withDaemonExtraProgresstest
          (   basicRun "mpiexec"
Valentin Reis's avatar
Valentin Reis committed
143 144
            ⫽ { args =
                  [ if isTest then "2" else "24"
145
                  , "qmcpack"
Valentin Reis's avatar
Valentin Reis committed
146
                  , assetDir ++ "/simple-H2O.xml"
147
                  ]
Valentin Reis's avatar
Valentin Reis committed
148 149 150 151
              , cmdavoids =
                  [ "Error", "error", "ERROR" ]
              }
          )
Valentin Reis's avatar
Valentin Reis committed
152
          idCmd
153
      , lammps =
Valentin Reis's avatar
Valentin Reis committed
154 155
          withDaemonExtraProgresstest
          (   basicRun "mpiexec"
Valentin Reis's avatar
Valentin Reis committed
156
            ⫽ { args =
157 158 159 160 161 162
                  [ "-n"
                  , if isTest then "2" else "24"
                  , "-bind-to"
                  , "core"
                  , "lmp_mpi"
                  , "-i"
Valentin Reis's avatar
Valentin Reis committed
163
                  , assetDir ++ "/modified.lj"
164
                  ]
Valentin Reis's avatar
Valentin Reis committed
165 166 167 168
              , cmdavoids =
                  [ "Error", "error", "ERROR" ]
              }
          )
Valentin Reis's avatar
Valentin Reis committed
169
          idCmd
170
      , openmc =
Valentin Reis's avatar
Valentin Reis committed
171 172
            withDaemonExtraProgresstest
            (   basicRun "mpiexec"
Valentin Reis's avatar
Valentin Reis committed
173
              ⫽ { args =
174
                    [ "-n", if isTest then "2" else "24", "openmc" ]
Valentin Reis's avatar
Valentin Reis committed
175 176 177 178
                , cmdavoids =
                    [ "Error", "error", "ERROR" ]
                , passvars =
                    [ "OPENMC_CROSS_SECTIONS" ]
179 180
                }
            )
Valentin Reis's avatar
Valentin Reis committed
181 182 183 184
            idCmd
          ⫽ { pre =
                [ "cp --no-preserve=mode -r " ++ assetDir ++ "openmc/* ." ]
            }
185
      , amg =
Valentin Reis's avatar
Valentin Reis committed
186 187
          withDaemonExtraProgresstest
          (   basicRun "mpiexec"
Valentin Reis's avatar
Valentin Reis committed
188
            ⫽ { args =
189 190 191 192 193 194 195 196 197 198 199 200 201 202
                  [ "-n"
                  , if isTest then "2" else "24"
                  , "amg"
                  , "-problem"
                  , "2"
                  , "-n"
                  , "90"
                  , "90"
                  , "90"
                  , "-P"
                  , "2"
                  , if isTest then "1" else "12"
                  , "1"
                  ]
Valentin Reis's avatar
Valentin Reis committed
203 204 205 206 207 208 209
              , cmdavoids =
                  [ "Error", "error", "ERROR" ]
              }
          )
          (   λ(x : types.Cmd)
            → x ⫽ { vars = [ { varname = "OMP_NUM_THREADS", value = "1" } ] }
          )
210
      , stream =
Valentin Reis's avatar
Valentin Reis committed
211 212
          withDaemonExtraProgresstest
          (   basicRun "stream_c"
Valentin Reis's avatar
Valentin Reis committed
213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230
            ⫽ { args =
                  [] : List Text
              , cmdavoids =
                  [ "Error", "error", "ERROR" ]
              }
          )
          (   λ(x : types.Cmd)
            →   x
              ⫽ { vars =
                    [ { varname =
                          "OMP_NUM_THREADS"
                      , value =
                          if isTest then "2" else "24"
                      }
                    , { varname = "OMP_PLACES", value = "cores" }
                    ]
                }
          )
231
      }