[Piglit] [PATCH 3/8] framework: Avoid magic number usage in making skip and problems lists.

Dylan Baker baker.dylan.c at gmail.com
Wed Sep 18 15:26:50 PDT 2013


On Wednesday 18 September 2013 15:00:28 Eric Anholt wrote:
> I broke these two pages when doing the unstable-result change, because
> I didn't expect absolute numbers to be used on this thing that looked
> like it was for relative severity comparisons.
> ---
>  framework/summary.py | 18 +++++++++---------
>  1 file changed, 9 insertions(+), 9 deletions(-)
> 
> diff --git a/framework/summary.py b/framework/summary.py
> index 26bdda9..656efc0 100644
> --- a/framework/summary.py
> +++ b/framework/summary.py
> @@ -432,11 +432,14 @@ class Summary:
> 
>          for test in self.tests['all']:
>              status = []
> +            status_text = []
>              for each in self.results:
>                  try:
> -                   
> status.append(find_regressions(each.tests[test]['result'])) +              
>      s = each.tests[test]['result']
>                  except KeyError:
> -                    status.append(find_regressions("special"))
> +                    s = 'special'
> +                status_text.append(s)
> +                status.append(find_regressions(s))
> 
>              if 'changes' in lists:
>                  # Check and append self.tests['changes']
> @@ -447,15 +450,12 @@ class Summary:
>                      self.tests['changes'].add(test)
> 
>              if 'problems' in lists:
> -                # If the result contains a value other than 1 (pass) or 4
> -                # (skip) it is a problem. Skips are not problems becasuse
> -                # they have Their own page.
> -                if [i for e in [2, 3, 5] for i in status if e is i]:
> -                    self.tests['problems'].add(test)
> +                for i in status_text:
> +                    if i not in ['pass', 'skip', 'special']:
> +                        self.tests['problems'].add(test)
> 
>              if 'skipped' in lists:
> -                # Find all tests with a status of skip
> -                if 4 in status:
> +                if 'skip' in status_text:
>                      self.tests['skipped'].add(test)
> 
>              if 'fixes' in lists:

please see my set [PATCH 1/2] status.py: Adds a new status class and 
subclasses series. It should either completely eleminate the need for this 
patch, or at least simplify it even more.
-------------- 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/20130918/a263e5d1/attachment.pgp>


More information about the Piglit mailing list