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

Dylan Baker baker.dylan.c at gmail.com
Tue Mar 25 13:48:08 PDT 2014


On Friday, March 21, 2014 13:55:11 Thomas Wood wrote:
> 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'

you might consider splitting this into a private method

> +        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()
> 

The rest of this patch should be part of a separate patch

> -    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)

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/piglit/attachments/20140325/bb357709/attachment-0001.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 490 bytes
Desc: This is a digitally signed message part.
URL: <http://lists.freedesktop.org/archives/piglit/attachments/20140325/bb357709/attachment-0001.sig>


More information about the Piglit mailing list