Skip to content

Instantly share code, notes, and snippets.

@apahim
Created October 21, 2015 02:30
Show Gist options
  • Save apahim/5e28820d81e444385f0d to your computer and use it in GitHub Desktop.
Save apahim/5e28820d81e444385f0d to your computer and use it in GitHub Desktop.
commit 17679e560536eb0eba0e17151748403b550d98d0
Author: Amador Pahim <[email protected]>
Date: Tue Oct 20 01:27:32 2015 -0200
[ WIP ] Partial commit recording job information for further replay
For while, only recording commandline and confi options.
Signed-off-by: Amador Pahim <[email protected]>
diff --git a/avocado/core/job.py b/avocado/core/job.py
index c3ba361..abcb447 100644
--- a/avocado/core/job.py
+++ b/avocado/core/job.py
@@ -444,6 +444,28 @@ class Job(object):
self._log_mux_variants(mux)
self._log_job_id()
+ def _record_cmdline(self):
+ with open(self.rec_cmdfile, 'w') as cmd_file_obj:
+ cmd_file_obj.write("%s" % sys.argv)
+
+ def _record_config(self):
+ config_matrix = []
+ for section in settings.config.sections():
+ for value in settings.config.items(section):
+ config_key = ".".join((section, value[0]))
+ config_matrix.append([config_key, value[1]])
+
+ config_dict = {}
+ for key, value in config_matrix:
+ config_dict[key] = value
+
+ with open(self.rec_configfile, 'w') as config_file_obj:
+ config_file_obj.write("%s" % config_dict)
+
+ def _record_job(self):
+ self._record_cmdline()
+ self._record_config()
+
def _run(self, urls=None):
"""
Unhandled job method. Runs a list of test URLs to its completion.
@@ -486,6 +508,7 @@ class Job(object):
self._start_sysinfo()
self._log_job_debug_info(mux)
+ self._record_job()
self.view.logfile = self.logfile
failures = self.test_runner.run_suite(test_suite, mux,
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment