[Piglit] [PATCH 1/2] framework/summary.py: add assert to Summary.__init__()

Kenneth Graunke kenneth at whitecape.org
Wed Jan 22 08:49:53 PST 2014


On 01/22/2014 07:46 AM, Dylan Baker wrote:
> Normally piglit doesn't generate test names with leading slashes, and
> the code has no way to deal with them. In fact, a leading slash will
> cause a loop in Summary.__init__ to run infinitely.  The simplest
> solution is an assertion, which means the program will assert before it
> ever gets to the loop.
> 
> Signed-off-by: Dylan Baker <baker.dylan.c at gmail.com>
> ---
>  framework/summary.py | 6 ++++++
>  1 file changed, 6 insertions(+)
> 
> diff --git a/framework/summary.py b/framework/summary.py
> index 6ee1226..2ba5f16 100644
> --- a/framework/summary.py
> +++ b/framework/summary.py
> @@ -281,6 +281,12 @@ class Summary:
>              status = self.status[results.name]
>  
>              for key, value in results.tests.iteritems():
> +                # if the first character of key is a / then our while loop will
> +                # become an infinite loop. Beyond that / should never be the
> +                # leading character, if it is then there is a bug in one of the
> +                # test profiles.
> +                assert key[0] != '/'
> +
>                  #FIXME: Add subtest support
>  
>                  # Walk the test name as if it was a path, at each level update
> 

Both of these are:
Reviewed-by: Kenneth Graunke <kenneth at whitecape.org>

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: OpenPGP digital signature
URL: <http://lists.freedesktop.org/archives/piglit/attachments/20140122/58f27e1f/attachment.pgp>


More information about the Piglit mailing list