From 2151e20bd6f0cedadfbc8913f1d987282866dde0 Mon Sep 17 00:00:00 2001 From: Rodrigo Arias Mallo Date: Thu, 15 Apr 2021 18:56:42 +0200 Subject: [PATCH] exp: add exit1 experiment Tests unit bad exits --- garlic/exp/index.nix | 4 +++ garlic/exp/test/exit1.nix | 68 +++++++++++++++++++++++++++++++++++++++ 2 files changed, 72 insertions(+) create mode 100644 garlic/exp/test/exit1.nix diff --git a/garlic/exp/index.nix b/garlic/exp/index.nix index 8af4d98..f7bed5e 100644 --- a/garlic/exp/index.nix +++ b/garlic/exp/index.nix @@ -123,4 +123,8 @@ examples = { granularity = callPackage ./examples/granularity.nix { }; }; + + test = { + exit1 = callPackage ./test/exit1.nix { }; + }; } diff --git a/garlic/exp/test/exit1.nix b/garlic/exp/test/exit1.nix new file mode 100644 index 0000000..2feb393 --- /dev/null +++ b/garlic/exp/test/exit1.nix @@ -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; }