[Piglit] [PATCH 2/2] framework: print a summary line after a run has finished

Thomas Wood thomas.wood at intel.com
Fri Mar 21 06:55:11 PDT 2014


Signed-off-by: Thomas Wood <thomas.wood at intel.com>
---
 framework/core.py | 2 ++
 framework/log.py  | 8 ++++++++
 piglit-resume.py  | 3 +--
 piglit-run.py     | 3 +--
 4 files changed, 12 insertions(+), 4 deletions(-)

diff --git a/framework/core.py b/framework/core.py
index ef8e7f6..14a832d 100644
--- a/framework/core.py
+++ b/framework/core.py
@@ -601,6 +601,8 @@ class TestProfile(object):
         multi.join()
         single.join()
 
+        log.summary()
+
     def filter_tests(self, function):
         """Filter out tests that return false from the supplied function
 
diff --git a/framework/log.py b/framework/log.py
index 96f757e..227e18b 100644
--- a/framework/log.py
+++ b/framework/log.py
@@ -132,3 +132,11 @@ class Log(object):
         x = self.__generator.next()
         self.__running.append(x)
         return x
+
+    def summary(self):
+        output = "[{percent}] {summary}".format(**{'percent': self._percent(),
+                                                   'summary': self._summary()})
+        length = len(output)
+        if self.__lastlength > length:
+            output = output + (" " * (self.__lastlength - length)) + '\n'
+        sys.stdout.write(output)
diff --git a/piglit-resume.py b/piglit-resume.py
index c9cb72b..09d0664 100755
--- a/piglit-resume.py
+++ b/piglit-resume.py
@@ -87,8 +87,7 @@ def main():
     json_writer.close_dict()
     json_writer.file.close()
 
-    print("\n"
-          "Thank you for running Piglit!\n"
+    print("Thank you for running Piglit!\n"
           "Results have ben wrriten to {0}".format(results_path))
 
 if __name__ == "__main__":
diff --git a/piglit-run.py b/piglit-run.py
index d57abd7..672c057 100755
--- a/piglit-run.py
+++ b/piglit-run.py
@@ -177,8 +177,7 @@ def main():
     json_writer.close_dict()
     json_writer.file.close()
 
-    print('\n'
-          'Thank you for running Piglit!\n'
+    print('Thank you for running Piglit!\n'
           'Results have been written to ' + result_filepath)
 
 
-- 
1.8.5.3



More information about the Piglit mailing list