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