Annotate cmdline comment, summary string, and output XML with
authorWilliam D. Jones <thor0505@comcast.net>
Mon, 18 Mar 2019 04:46:06 +0000 (00:46 -0400)
committerWilliam D. Jones <thor0505@comcast.net>
Mon, 18 Mar 2019 04:46:06 +0000 (00:46 -0400)
OS-specific information.

sbysrc/sby.py
sbysrc/sby_core.py

index 13d1cd1a193dbbb02da9d7c027dd4ab42fb56b52..4680b00b20d12a35e34fb260559d7c01e2ddc577 100644 (file)
@@ -364,6 +364,9 @@ def run_job(taskname):
             print('<?xml version="1.0" encoding="UTF-8"?>', file=f)
             print('<testsuites disabled="0" errors="%d" failures="%d" tests="1" time="%d">' % (junit_errors, junit_failures, job.total_time), file=f)
             print('<testsuite disabled="0" errors="%d" failures="%d" name="%s" skipped="0" tests="1" time="%d">' % (junit_errors, junit_failures, junit_ts_name, job.total_time), file=f)
+            print('<properties>', file=f)
+            print('<property name="os" value="%s"/>' % os.name, file=f)
+            print('</properties>', file=f)
             print('<testcase classname="%s" name="%s" status="%s" time="%d">' % (junit_ts_name, junit_tc_name, job.status, job.total_time), file=f)
             if junit_errors:
                 print('<error message="%s" type="%s"/>' % (job.status, job.status), file=f)
@@ -385,4 +388,3 @@ for t in tasknames:
     retcode |= run_job(t)
 
 sys.exit(retcode)
-
index 608cca14dd8333f459fcf09287810c253c1e614c..631524cd57af6af1b24264d761d744a74078d38f 100644 (file)
@@ -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)