From f8e27a06aa72951744078f0865591822286550af Mon Sep 17 00:00:00 2001 From: "William D. Jones" Date: Mon, 18 Mar 2019 00:46:06 -0400 Subject: [PATCH] Annotate cmdline comment, summary string, and output XML with OS-specific information. --- sbysrc/sby.py | 4 +++- sbysrc/sby_core.py | 22 ++++++++++++++-------- 2 files changed, 17 insertions(+), 9 deletions(-) diff --git a/sbysrc/sby.py b/sbysrc/sby.py index 13d1cd1..4680b00 100644 --- a/sbysrc/sby.py +++ b/sbysrc/sby.py @@ -364,6 +364,9 @@ def run_job(taskname): print('', file=f) print('' % (junit_errors, junit_failures, job.total_time), file=f) print('' % (junit_errors, junit_failures, junit_ts_name, job.total_time), file=f) + print('', file=f) + print('' % os.name, file=f) + print('', file=f) print('' % (junit_ts_name, junit_tc_name, job.status, job.total_time), file=f) if junit_errors: print('' % (job.status, job.status), file=f) @@ -385,4 +388,3 @@ for t in tasknames: retcode |= run_job(t) sys.exit(retcode) - diff --git a/sbysrc/sby_core.py b/sbysrc/sby_core.py index 608cca1..631524c 100644 --- a/sbysrc/sby_core.py +++ b/sbysrc/sby_core.py @@ -36,6 +36,8 @@ class SbyTask: if os.name == "posix": self.cmdline = cmdline else: + # Windows command interpreter equivalents for sequential + # commands (; => &) command grouping ({} => ()). replacements = { ";" : "&", "{" : "(", @@ -598,15 +600,19 @@ class SbyJob: ru = resource.getrusage(resource.RUSAGE_CHILDREN) total_process_time = int((ru.ru_utime + ru.ru_stime) - self.start_process_time) self.total_time = total_process_time + + self.summary = [ + "Elapsed clock time [H:MM:SS (secs)]: %d:%02d:%02d (%d)" % + (total_clock_time // (60*60), (total_clock_time // 60) % 60, total_clock_time % 60, total_clock_time), + "Elapsed process time [H:MM:SS (secs)]: %d:%02d:%02d (%d)" % + (total_process_time // (60*60), (total_process_time // 60) % 60, total_process_time % 60, total_process_time), + ] + self.summary else: - total_process_time = 0 - - self.summary = [ - "Elapsed clock time [H:MM:SS (secs)]: %d:%02d:%02d (%d)" % - (total_clock_time // (60*60), (total_clock_time // 60) % 60, total_clock_time % 60, total_clock_time), - "Elapsed process time [H:MM:SS (secs)]: %d:%02d:%02d (%d)" % - (total_process_time // (60*60), (total_process_time // 60) % 60, total_process_time % 60, total_process_time), - ] + self.summary + self.summary = [ + "Elapsed clock time [H:MM:SS (secs)]: %d:%02d:%02d (%d)" % + (total_clock_time // (60*60), (total_clock_time // 60) % 60, total_clock_time % 60, total_clock_time), + "Elapsed process time unvailable on Windows" + ] + self.summary for line in self.summary: self.log("summary: %s" % line) -- 2.30.2