summaryrefslogtreecommitdiff
path: root/validation/test
diff options
context:
space:
mode:
authorJean-Philippe NOEL2012-09-27 16:55:42 +0200
committerJean-Philippe NOEL2012-10-05 09:46:11 +0200
commitde83ce2ab6560a9154a9edf2d0d47691103ce639 (patch)
tree809f1fb82e2f1f1a0d25177ee6b53968d1a05afb /validation/test
parent576743d9e62d5e2a63be7d9becd7c10237bb03f2 (diff)
validation: dump the configuration, refs #3363
Diffstat (limited to 'validation/test')
-rw-r--r--validation/test/P2P_throughput/P2P_throughput.py7
-rw-r--r--validation/test/P2P_throughput/P2P_throughput_caller.py34
2 files changed, 22 insertions, 19 deletions
diff --git a/validation/test/P2P_throughput/P2P_throughput.py b/validation/test/P2P_throughput/P2P_throughput.py
index 72c3eae7da..8c860b2f8e 100644
--- a/validation/test/P2P_throughput/P2P_throughput.py
+++ b/validation/test/P2P_throughput/P2P_throughput.py
@@ -83,11 +83,11 @@ def read_bench_data():
bench_data_file_path = get_bench_data_file_path()
return evaluate(bench_data_file_path)
-def report(new_config):
+def report(config, config_file):
"""Generates the PDF report as specified in the configuration.
It requires to set up first the test bench as detailed in the test bench
description."""
- update_config(new_config)
+ update_config(config)
# Build the picture of the test bench
fig_name = build_test_bench_picture()
@@ -96,6 +96,9 @@ def report(new_config):
if config["make_measurements"] == True:
iperf.check_tokens()
write_bench_data()
+ #We dump the file and not the config, since it may be more
+ #readable and may contain some useful comments
+ subprocess.check_call(["cp", config_file, get_reports_directory()])
iperf.clean_traces()
t0 = time.time()
estimated_min = measurements_estimated_time_min()
diff --git a/validation/test/P2P_throughput/P2P_throughput_caller.py b/validation/test/P2P_throughput/P2P_throughput_caller.py
index 38b6d9665b..833e1e02c3 100644
--- a/validation/test/P2P_throughput/P2P_throughput_caller.py
+++ b/validation/test/P2P_throughput/P2P_throughput_caller.py
@@ -14,7 +14,7 @@ class P2P_throughput_caller:
def __init__(self):
from optparse import OptionParser
dirname = os.path.dirname(__file__)
- self.example_file_name = os.path.join(dirname, "config.py")
+ self.template_config_file = os.path.join(dirname, "config.py")
usage = r"""
%prog report conf_file
Generate the P2P throughput report based on conf_file
@@ -27,7 +27,7 @@ class P2P_throughput_caller:
conf_file must be the path of a file containing exactly the same
parameters as the template (""" + \
- self.example_file_name + """).\n""" + \
+ self.template_config_file + """).\n""" + \
"""
The tokens must be set on the two iperf hosts before making the
measurements and cleared when the bench is released."""
@@ -44,30 +44,30 @@ class P2P_throughput_caller:
if cmd not in self._commands:
self._parser.error("Unknown command \"{0}\".".format(cmd))
- example_config = P2P_throughput.evaluate(self.example_file_name)
- file_name = args[1]
+ template_config = P2P_throughput.evaluate(self.template_config_file)
+ config_file = args[1]
try:
- config = P2P_throughput.evaluate(file_name)
- expected = sorted(example_config.keys())
+ config = P2P_throughput.evaluate(config_file)
+ expected = sorted(template_config.keys())
actual = sorted(config.keys())
assert actual == expected, (actual, expected)
except IOError:
- self._parser.error(file_name + " cannot be read.")
+ self._parser.error(config_file + " cannot be read.")
except SyntaxError:
- self._parser.error(file_name + " cannot be evaluated.")
+ self._parser.error(config_file + " cannot be evaluated.")
except AttributeError:
- self._parser.error(file_name + " does not contain a dictionnary.")
+ self._parser.error(config_file + " does not contain a dictionnary.")
except AssertionError as error:
(actual, expected) = error.args
message = file_name + " does not contain exactly the same " \
"parameters as the template (" + \
- self.example_file_name + ").\n" + \
- file_name + \
+ self.template_config_file + ").\n" + \
+ config_file + \
" contains the following parameters:\n" + \
str(actual) + \
"\n" + \
- self.example_file_name + \
+ self.template_config_file + \
" contains the following parameters:\n" + \
str(expected)
self._parser.error(message)
@@ -76,15 +76,15 @@ class P2P_throughput_caller:
str(type(error)) + "\n" + \
str(error))
- self._commands[cmd](config)
+ self._commands[cmd](config, config_file)
- def run_report(self, config):
- P2P_throughput.report(config)
+ def run_report(self, config, config_file):
+ P2P_throughput.report(config, config_file)
- def run_set_tokens(self, config):
+ def run_set_tokens(self, config, config_file):
P2P_throughput.set_tokens(config)
- def run_clear_tokens(self, config):
+ def run_clear_tokens(self, config, config_file):
P2P_throughput.clear_tokens(config)
if __name__ == "__main__":