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