lava_wait_jobs.py: Extract trace data from LAVA log
To be used for code coverage purposes. Actual code goes into
codecov_helper module.
Signed-off-by: Paul Sokolovsky <paul.sokolovsky@linaro.org>
Change-Id: I81be8d007fd84dfa0110e478dbf5451c1a9eaff7
diff --git a/lava_helper/codecov_helper.py b/lava_helper/codecov_helper.py
index ad4ad55..3ab21de 100644
--- a/lava_helper/codecov_helper.py
+++ b/lava_helper/codecov_helper.py
@@ -22,6 +22,21 @@
subprocess.check_call(cmd, shell=True, cwd=cwd)
+def extract_trace_data(lava_log_fname, job_dir):
+ last_fname = None
+ f_out = None
+ with open(lava_log_fname) as f_in:
+ for l in f_in:
+ if l.startswith("covtrace-"):
+ fname, l = l.split(" ", 1)
+ if fname != last_fname:
+ if f_out:
+ f_out.close()
+ f_out = open(job_dir + "/" + fname, "w")
+ last_fname = fname
+ f_out.write(l)
+
+
def coverage_reports(jobs, user_args):
lava = test_lava_dispatch_credentials(user_args)
for job_id, info in jobs.items():