From de83ce2ab6560a9154a9edf2d0d47691103ce639 Mon Sep 17 00:00:00 2001 From: Jean-Philippe NOEL Date: Thu, 27 Sep 2012 16:55:42 +0200 Subject: validation: dump the configuration, refs #3363 --- validation/test/P2P_throughput/P2P_throughput.py | 7 +++-- .../test/P2P_throughput/P2P_throughput_caller.py | 34 +++++++++++----------- 2 files changed, 22 insertions(+), 19 deletions(-) (limited to 'validation/test') 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__": -- cgit v1.2.3