Skip to content
Snippets Groups Projects
Commit a1f47992b582 authored by Pierre-Yves David's avatar Pierre-Yves David :octopus:
Browse files

simple-command: allow for a preparation step before runs.

This will help use to benchmark more complex operation.
parent e93c95be7964
No related branches found
No related tags found
No related merge requests found
......@@ -84,6 +84,11 @@
This can be changed by variants (see next section).
prepare-run
~~~~~~~~~~~
A command (or series of command) to run before each command run.
variants
--------
......
......@@ -202,7 +202,10 @@
cmd = SimpleCommand(self)
cmd.apply_data_env(data_env)
r = self._time_command(bin_env_path, data_env_path, cmd)
prepare = self.get_var('simple-command.prepare-run')
r = self._time_command(bin_env_path, data_env_path, cmd, prepare)
res = {}
# we should store more
res['time'] = {}
......@@ -213,7 +216,7 @@
res['time']['max'] = r['results'][0]['max']
return res
def _time_command(self, bin_env_path, data_env_path, cmd):
def _time_command(self, bin_env_path, data_env_path, cmd, prepare=None):
bin_env_path = os.path.abspath(bin_env_path)
data_env_path = os.path.abspath(data_env_path)
shell_path = poulpe.bin_env_script(bin_env_path)
......@@ -230,7 +233,5 @@
"--export-json",
tmp_result.name,
'--show-output',
"--",
cmd.command,
]
if cmd.accept_failure:
......@@ -235,6 +236,13 @@
]
if cmd.accept_failure:
time_cmd.insert(-2, "--ignore-failure")
time_cmd.append("--ignore-failure")
if prepare is not None:
time_cmd.append('--prepare')
time_cmd.append(prepare)
time_cmd.append("--")
time_cmd.append(cmd.command)
cwd = data_env_path
if cmd.cwd is not None:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment