all-tests.dh 7.31 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 ++ "test_assets/"
Valentin Reis's avatar
Valentin Reis committed
5
  
Valentin Reis's avatar
Valentin Reis committed
6
  let types = ./dhrunlib/types.dh
Valentin Reis's avatar
Valentin Reis committed
7
  
Valentin Reis's avatar
Valentin Reis committed
8
  let argotypes = ./argolib/types.dh
Valentin Reis's avatar
Valentin Reis committed
9
  
Valentin Reis's avatar
Valentin Reis committed
10
  let argo = ./argolib/package.dh
Valentin Reis's avatar
Valentin Reis committed
11
  
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
  let manifests =
        { basic =
            manifestDir ++ "basic.yml"
        , perf =
            manifestDir ++ "perfwrap.yml"
47 48
        , singularity =
            manifestDir ++ "singularity.yml"
Valentin Reis's avatar
Valentin Reis committed
49
        }
Valentin Reis's avatar
Valentin Reis committed
50
  
Valentin Reis's avatar
Valentin Reis committed
51 52 53 54 55
  let ifTest =
          λ(t : Type)
        → λ(default : t)
        → λ(value : t)
        → if isTest then value else default
Valentin Reis's avatar
Valentin Reis committed
56
  
Valentin Reis's avatar
Valentin Reis committed
57
  let ifTestList = ifTest (List Text) ([] : List Text)
Valentin Reis's avatar
Valentin Reis committed
58
  
Valentin Reis's avatar
Valentin Reis committed
59
  let withDaemon =
60 61
          λ(daemonArg : argotypes.MkDaemon)
        → λ(runArg : argotypes.MkRun)
Valentin Reis's avatar
Valentin Reis committed
62 63
        → λ(runOverrides : types.Cmd → types.Cmd)
        → λ(extraCmds : List types.Cmd)
Valentin Reis's avatar
Valentin Reis committed
64
        → makeExtended
65
          (   daemonArg
Valentin Reis's avatar
Valentin Reis committed
66 67 68 69
            ⫽ { daemonavoids =
                  ifTestList [ "Traceback", "ValueError" ]
              , powercap =
                  < NoCap = {=} | Cap : Text > : argotypes.Powercap
70 71
              }
          )
Valentin Reis's avatar
Valentin Reis committed
72 73
          idCmd
          (   runArg
74 75 76 77 78 79 80 81 82 83 84 85 86 87
            ⫽ { cmdavoids =
                  runArg.cmdavoids # ifTestList [ "Traceback", "ValueError" ]
              }
          )
          (   λ(c : types.Cmd)
            → runOverrides
              (   c
                ⫽ { timeout =
                      ifTest
                      (Optional Natural)
                      ([] : Optional Natural)
                      ([ 600 ] : Optional Natural)
                  }
              )
Valentin Reis's avatar
Valentin Reis committed
88
          )
Valentin Reis's avatar
Valentin Reis committed
89 90 91 92 93
          extraCmds
  
  let withDaemonNoExtras =
          λ(runArg : argotypes.MkRun)
        → λ(runOverrides : types.Cmd → types.Cmd)
94
        → withDaemon argo.nrmd.defarg runArg runOverrides ([] : List types.Cmd)
Valentin Reis's avatar
Valentin Reis committed
95
  
96 97 98 99
  let withDaemonExtraListen =
          λ(filter : Text)
        → λ(doFilter : Bool)
        → λ(runArg : argotypes.MkRun)
Valentin Reis's avatar
Valentin Reis committed
100 101
        → λ(runOverrides : types.Cmd → types.Cmd)
        → withDaemon
102
          argo.nrmd.defarg
Valentin Reis's avatar
Valentin Reis committed
103 104 105
          runArg
          runOverrides
          [ argo.listen.mk
106
            (argo.listen.defarg cn ⫽ { filter = filter, doFilter = doFilter })
Valentin Reis's avatar
Valentin Reis committed
107 108
          ]
  
109 110 111 112 113 114
  let withDaemonExtraProgresstest = withDaemonExtraListen "performance" True
  
  let mkrun =
        λ(manifest : Text) → λ(name : Text) → argo.run.defarg name manifest cn
  
  let basicRun = mkrun manifests.basic
Valentin Reis's avatar
Valentin Reis committed
115
  
116 117 118
  let perfRun = mkrun manifests.perf
  
  let singularityRun = mkrun manifests.singularity
Valentin Reis's avatar
Valentin Reis committed
119 120
  
  in  { run =
Valentin Reis's avatar
Valentin Reis committed
121
          withDaemonNoExtras (basicRun "true") idCmd
122
      , pwd =
Valentin Reis's avatar
Valentin Reis committed
123 124 125 126 127
          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
128
      , exitcode =
Valentin Reis's avatar
Valentin Reis committed
129 130 131
          withDaemonNoExtras
          (basicRun "false")
          (λ(x : types.Cmd) → x ⫽ { exitcode = [ +1 ] : Optional Integer })
132
      , hello =
Valentin Reis's avatar
Valentin Reis committed
133 134 135
          withDaemonNoExtras
          (   basicRun "echo"
            ⫽ { args = [ message ], cmdwants = [ message ] : List Text }
136
          )
Valentin Reis's avatar
Valentin Reis committed
137
          idCmd
138
      , listen =
139 140 141
          withDaemonExtraListen
          ","
          False
Valentin Reis's avatar
Valentin Reis committed
142
          (basicRun "sleep" ⫽ { args = [ "1" ] })
Valentin Reis's avatar
Valentin Reis committed
143
          idCmd
144
      , power =
145 146 147
          withDaemonExtraListen
          "power"
          True
Valentin Reis's avatar
Valentin Reis committed
148
          (basicRun "sleep" ⫽ { args = [ "15" ] })
Valentin Reis's avatar
Valentin Reis committed
149
          idCmd
150
      , performance =
151 152 153
          withDaemonExtraListen
          "performance"
          True
Valentin Reis's avatar
Valentin Reis committed
154 155
          (perfRun "sleep" ⫽ { args = [ "15" ] })
          idCmd
156 157 158 159 160 161
      , run-singularity =
          withDaemon
          (argo.nrmd.defarg ⫽ { singularity = True })
          (singularityRun "true")
          idCmd
          ([] : List types.Cmd)
162
      , qmcpack =
Valentin Reis's avatar
Valentin Reis committed
163 164
          withDaemonExtraProgresstest
          (   basicRun "mpiexec"
Valentin Reis's avatar
Valentin Reis committed
165 166
            ⫽ { args =
                  [ if isTest then "2" else "24"
167
                  , "qmcpack"
Valentin Reis's avatar
Valentin Reis committed
168
                  , assetDir ++ "/simple-H2O.xml"
169
                  ]
Valentin Reis's avatar
Valentin Reis committed
170 171 172 173
              , cmdavoids =
                  [ "Error", "error", "ERROR" ]
              }
          )
Valentin Reis's avatar
Valentin Reis committed
174
          idCmd
175
      , lammps =
Valentin Reis's avatar
Valentin Reis committed
176 177
          withDaemonExtraProgresstest
          (   basicRun "mpiexec"
Valentin Reis's avatar
Valentin Reis committed
178
            ⫽ { args =
179 180 181 182 183 184
                  [ "-n"
                  , if isTest then "2" else "24"
                  , "-bind-to"
                  , "core"
                  , "lmp_mpi"
                  , "-i"
Valentin Reis's avatar
Valentin Reis committed
185
                  , assetDir ++ "/modified.lj"
186
                  ]
Valentin Reis's avatar
Valentin Reis committed
187 188 189 190
              , cmdavoids =
                  [ "Error", "error", "ERROR" ]
              }
          )
Valentin Reis's avatar
Valentin Reis committed
191
          idCmd
192
      , openmc =
Valentin Reis's avatar
Valentin Reis committed
193 194
            withDaemonExtraProgresstest
            (   basicRun "mpiexec"
Valentin Reis's avatar
Valentin Reis committed
195
              ⫽ { args =
196
                    [ "-n", if isTest then "2" else "24", "openmc" ]
Valentin Reis's avatar
Valentin Reis committed
197 198 199 200
                , cmdavoids =
                    [ "Error", "error", "ERROR" ]
                , passvars =
                    [ "OPENMC_CROSS_SECTIONS" ]
201 202
                }
            )
Valentin Reis's avatar
Valentin Reis committed
203 204 205 206
            idCmd
          ⫽ { pre =
                [ "cp --no-preserve=mode -r " ++ assetDir ++ "openmc/* ." ]
            }
207
      , amg =
Valentin Reis's avatar
Valentin Reis committed
208 209
          withDaemonExtraProgresstest
          (   basicRun "mpiexec"
Valentin Reis's avatar
Valentin Reis committed
210
            ⫽ { args =
211 212 213 214 215 216 217 218 219 220 221 222 223 224
                  [ "-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
225 226 227 228 229 230 231
              , cmdavoids =
                  [ "Error", "error", "ERROR" ]
              }
          )
          (   λ(x : types.Cmd)
            → x ⫽ { vars = [ { varname = "OMP_NUM_THREADS", value = "1" } ] }
          )
232
      , stream =
Valentin Reis's avatar
Valentin Reis committed
233 234
          withDaemonExtraProgresstest
          (   basicRun "stream_c"
Valentin Reis's avatar
Valentin Reis committed
235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252
            ⫽ { 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" }
                    ]
                }
          )
253
      }