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