exp: add exit1 experiment

Tests unit bad exits
This commit is contained in:
Rodrigo Arias 2021-04-15 18:56:42 +02:00
parent 886d16bcc6
commit 2151e20bd6
2 changed files with 72 additions and 0 deletions

View File

@ -123,4 +123,8 @@
examples = { examples = {
granularity = callPackage ./examples/granularity.nix { }; granularity = callPackage ./examples/granularity.nix { };
}; };
test = {
exit1 = callPackage ./test/exit1.nix { };
};
} }

68
garlic/exp/test/exit1.nix Normal file
View File

@ -0,0 +1,68 @@
{
stdenv
, stdexp
, bsc
, targetMachine
, stages
, garlicTools
}:
with stdenv.lib;
with garlicTools;
let
machineConfig = targetMachine.config;
inherit (machineConfig) hw;
# Initial variable configuration
varConf = {
script = [
"exit 1"
"exit 0"
"kill -SEGV $$"
"kill -TERM $$"
];
};
# Generate the complete configuration for each unit
genConf = with bsc; c: targetMachine.config // rec {
expName = "exit1";
unitName = expName + "-" +
builtins.replaceStrings [" " "$"] ["-" "-"] script;
inherit (machineConfig) hw;
# Repeat the execution of each unit 30 times
loops = 1;
inherit (c) script;
# Resources
qos = "debug";
cpusPerTask = 1;
ntasksPerNode = 2;
nodes = 1;
jobName = unitName;
};
# Compute the array of configurations
configs = stdexp.buildConfigs {
inherit varConf genConf;
};
exec = {nextStage, conf, ...}: with conf; stages.exec {
inherit nextStage;
pre = "sleep 5";
post = "echo dummy";
};
prog = {conf,...}: stages.script {
inherit (conf) script;
};
pipeline = stdexp.stdPipeline ++ [ exec prog ];
in
stdexp.genExperiment { inherit configs pipeline; }