Commit e8bc2391 authored by Valentin Reis's avatar Valentin Reis
Browse files

minor refactor dhrun code

parent 775efc99
Pipeline #6633 passed with stages
in 10 minutes and 57 seconds
...@@ -145,7 +145,7 @@ in { apps = ...@@ -145,7 +145,7 @@ in { apps =
apps apps
, hello = , hello =
lib.makeBase lib.makeBase
( lib.emptyMakeBaseArgs "echo" basicManifest cn ( lib.emptyMakeBaseArg "echo" basicManifest cn
⫽ { args = ⫽ { args =
[ message ] [ message ]
, verbose = , verbose =
...@@ -160,7 +160,7 @@ in { apps = ...@@ -160,7 +160,7 @@ in { apps =
) )
, listen = , listen =
lib.makeExtended lib.makeExtended
( lib.emptyMakeBaseArgs "sleep" basicManifest cn ( lib.emptyMakeBaseArg "sleep" basicManifest cn
⫽ { args = ⫽ { args =
[ "1" ] [ "1" ]
, verbose = , verbose =
...@@ -207,14 +207,4 @@ in { apps = ...@@ -207,14 +207,4 @@ in { apps =
"perfwrap.json" "perfwrap.json"
} }
) )
, stream =
apps.stream True < NoCap = {=} | Cap : Text >
, openmc =
apps.openmc True < NoCap = {=} | Cap : Text >
, lammps =
apps.lammps True < NoCap = {=} | Cap : Text >
, qmcpack =
apps.qmcpack True < NoCap = {=} | Cap : Text >
, amg =
apps.amg True < NoCap = {=} | Cap : Text >
} }
...@@ -56,7 +56,7 @@ let basicCommand = ...@@ -56,7 +56,7 @@ let basicCommand =
let Powercap = < Cap : Text | NoCap : {} > let Powercap = < Cap : Text | NoCap : {} >
let MakeBaseArgs = let MakeBaseArg =
{ manifest : { manifest :
Text Text
, cmd : , cmd :
...@@ -81,7 +81,7 @@ let MakeBaseArgs = ...@@ -81,7 +81,7 @@ let MakeBaseArgs =
Powercap Powercap
} }
let emptyMakeBaseArgs = let emptyMakeBaseArg =
λ(cmd : Text) λ(cmd : Text)
→ λ(manifest : Text) → λ(manifest : Text)
→ λ(containerName : Text) → λ(containerName : Text)
...@@ -108,7 +108,7 @@ let emptyMakeBaseArgs = ...@@ -108,7 +108,7 @@ let emptyMakeBaseArgs =
, powercap = , powercap =
< NoCap = {=} | Cap : Text > < NoCap = {=} | Cap : Text >
} }
: MakeBaseArgs : MakeBaseArg
let addVerbose = λ(v : Bool) → if v then [ "--verbose" ] else [] : List Text let addVerbose = λ(v : Bool) → if v then [ "--verbose" ] else [] : List Text
...@@ -123,7 +123,7 @@ let addPowercap = ...@@ -123,7 +123,7 @@ let addPowercap =
p p
let makeBase = let makeBase =
λ(args : MakeBaseArgs) λ(args : MakeBaseArg)
→ { cmds = → { cmds =
[ basicCommand [ basicCommand
{ name = { name =
...@@ -188,7 +188,7 @@ let makeBase = ...@@ -188,7 +188,7 @@ let makeBase =
: types.Config : types.Config
let makeExtended = let makeExtended =
λ(args : MakeBaseArgs) λ(args : MakeBaseArg)
→ λ(cmds : List types.Cmd) → λ(cmds : List types.Cmd)
→ let b = makeBase args in b ⫽ { cmds = b.cmds # cmds } → let b = makeBase args in b ⫽ { cmds = b.cmds # cmds }
...@@ -392,8 +392,8 @@ let extendApp = ...@@ -392,8 +392,8 @@ let extendApp =
in { values = in { values =
values values
, emptyMakeBaseArgs = , emptyMakeBaseArg =
emptyMakeBaseArgs emptyMakeBaseArg
, makeBase = , makeBase =
makeBase makeBase
, makeExtended = , makeExtended =
...@@ -418,4 +418,4 @@ in { values = ...@@ -418,4 +418,4 @@ in { values =
powerexpeCmds powerexpeCmds
, extendApp = , extendApp =
extendApp extendApp
} }
\ No newline at end of file
...@@ -349,14 +349,7 @@ let ...@@ -349,14 +349,7 @@ let
unpackPhase = "true"; unpackPhase = "true";
}; };
doDhrun = drv: app: doDhrun = dhrscript: test.overrideAttrs (old:{
let
dhrscript = pkgs.writeText "test.dhall" ''
let all = ${dhrunSpecs}/all-tests.dh
in all.apps.${app} True < NoCap = {=} | Cap : Text >
'';
in
drv.overrideAttrs (old:{
buildPhase = '' buildPhase = ''
cat ${dhrscript} |\ cat ${dhrscript} |\
dhall resolve |\ dhall resolve |\
...@@ -377,23 +370,48 @@ let ...@@ -377,23 +370,48 @@ let
''; '';
}); });
testHello = doDhrun test "hello"; appDhrunScript = app: pkgs.writeText "test.dhall" ''
testListen = doDhrun test "listen"; let all = ${dhrunSpecs}/all-tests.dh
testPerfwrapper = doDhrun test "performance"; in all.apps.${app} True < NoCap = {=} | Cap : Text >
testPower = doDhrun test "power"; '';
testSTREAM = doDhrun (test.overrideAttrs
(old:{buildInputs=old.buildInputs++[ stream ];})) "stream"; doDhrunApp = app :
testAMG = doDhrun (test.overrideAttrs let
(old:{buildInputs=old.buildInputs++[ amg ];})) "amg"; dhrunscript = pkgs.writeText "test.dhall" ''
testOpenMC = doDhrun (test.overrideAttrs let all = ${dhrunSpecs}/all-tests.dh
in all.apps.${app} True < NoCap = {=} | Cap : Text >
'';
in
doDhrun dhrunscript;
doDhrunKey = key:
let
dhrunscript = pkgs.writeText "test.dhall" ''
let all = ${dhrunSpecs}/all-tests.dh
in all.${key}
'';
in
doDhrun dhrunscript;
testHello = doDhrunKey "hello";
testListen = doDhrunKey "listen";
testPerfwrapper = doDhrunKey "performance";
testPower = doDhrunKey "power";
testSTREAM = (doDhrunApp "stream").overrideAttrs
(old:{buildInputs=old.buildInputs++[ stream ];});
testAMG = (doDhrunApp "amg").overrideAttrs
(old:{buildInputs=old.buildInputs++[ amg ];});
testOpenMC = (doDhrunApp "openmc").overrideAttrs
(old:{buildInputs=old.buildInputs++[ openmc ]; (old:{buildInputs=old.buildInputs++[ openmc ];
OPENMC_CROSS_SECTIONS = "${openmc-data}/cross_sections.xml"; OPENMC_CROSS_SECTIONS = "${openmc-data}/cross_sections.xml";
})) "openmc"; });
testLAMMPS = doDhrun (test.overrideAttrs testLAMMPS = (doDhrunApp "lammps").overrideAttrs
(old:{buildInputs=old.buildInputs++[ lammps ];})) "lammps"; (old:{buildInputs=old.buildInputs++[ lammps ];});
testQMCPack = doDhrun (test.overrideAttrs testQMCPack = (doDhrunApp "qmcpack").overrideAttrs
(old:{buildInputs=old.buildInputs++[ qmcpack ];})) "qmcpack"; (old:{buildInputs=old.buildInputs++[ qmcpack ];});
testAll = doDhrun (test.overrideAttrs
testAll = test.overrideAttrs
(old:{ (old:{
buildInputs = old.buildInputs ++ [ buildInputs = old.buildInputs ++ [
lammps lammps
...@@ -403,7 +421,7 @@ let ...@@ -403,7 +421,7 @@ let
amg amg
openmc-data openmc-data
]; ];
OPENMC_CROSS_SECTIONS = "${openmc-data}/cross_sections.xml";})) "tests"; OPENMC_CROSS_SECTIONS = "${openmc-data}/cross_sections.xml";});
powerexpe = testAll.overrideAttrs (old:{ powerexpe = testAll.overrideAttrs (old:{
name = "power-experiments"; name = "power-experiments";
......
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