[Piglit] [PATCH] summary.py: Fix duplicate entries bug

Chris Forbes chrisf at ijw.co.nz
Mon Jul 15 22:38:55 PDT 2013


It would be nicer to not add the duplicates in the first place, rather
than collapsing them out at the end like this.

Does *everything* which uses the result lists impose an ordering? This
change destroys any preexisting ordering of the results.

-- Chris

On Tue, Jul 16, 2013 at 1:49 PM, Dylan Baker <baker.dylan.c at gmail.com> wrote:
> The current behavior is that changes fixes and regressions are
> calculated by comparing result[i] against result[i++], of course when
> there are four or more results provided a test could regress or be fixed
> twice. This causes them to be added to the list multiple times, and thus
> written into the HTML or text more than once.
>
> This patch corrects this behavior by converting the list to a set before
> passing it along to mako or to be printed. Since a set can only hold
> unique values this prevents it from being printed more than once.
>
> CC: Chris Forbes <chrisf at ijw.co.nz>
> Signed-off-by: Dylan Baker <baker.dylan.c at gmail.com>
> ---
>  framework/summary.py | 8 ++++++++
>  1 file changed, 8 insertions(+)
>
> diff --git a/framework/summary.py b/framework/summary.py
> index 2eb3226..811e36c 100644
> --- a/framework/summary.py
> +++ b/framework/summary.py
> @@ -464,6 +464,14 @@ class Summary:
>                          if status[i] > 1 and status[i + 1] == 1:
>                              self.tests['fixes'].append(test)
>
> +        # Remove duplicate entries from the status lists
> +        # If there are 4+ results can result in mutiple passes or regressions
> +        # and changes # other words: "pass fail pass fail" will result in a
> +        # regression, a fix, and a regression and it will be printed twice in
> +        # the summary. Turning them into sets remove duplicates
> +        for (result, value) in self.tests.items():
> +            self.tests[result] = set(value)
> +
>      def __find_totals(self):
>          """
>          Private: Find the total number of pass, fail, crash, skip, and warn in
> --
> 1.8.3.1
>


More information about the Piglit mailing list