[Piglit] [PATCH] Add user-specified test name suffix to junit output.

Dylan Baker baker.dylan.c at gmail.com
Wed Sep 17 14:33:44 PDT 2014


I went ahead and pushed this.

Thanks Mark

On Wednesday, September 17, 2014 02:28:07 PM Dylan Baker wrote:
> I know I told you in person that I had comments, but I'm going to take
> them back. This looks fine to me.
> 
> Reviewed-by: Dylan Baker <baker.dylan.c at gmail.com>
> 
> On Tuesday, September 16, 2014 01:27:55 PM Mark Janes wrote:
> > When summarizing piglit results from a set of hardware, it is
> > necessary to differentiate failures from the various platforms.  Tools
> > like jenkins are confused when a test name is repeated in test
> > results, especially when it both passes and fails in separate result
> > files.
> > 
> > Provide the --junit_suffix parameter to piglit to append a string to
> > the name of each test in the junit output.  Multiple invocations of
> > piglit can be summarized together in jenkins with different suffixes.
> > ---
> >  framework/programs/run.py | 5 +++++
> >  framework/results.py      | 3 ++-
> >  2 files changed, 7 insertions(+), 1 deletion(-)
> > 
> > diff --git a/framework/programs/run.py b/framework/programs/run.py
> > index 9a6276f..6971701 100644
> > --- a/framework/programs/run.py
> > +++ b/framework/programs/run.py
> > @@ -163,6 +163,10 @@ def _run_parser(input_):
> >      parser.add_argument("-s", "--sync",
> >                          action="store_true",
> >                          help="Sync results to disk after every test")
> > +    parser.add_argument("--junit_suffix",
> > +                        type=str,
> > +                        default="",
> > +                        help="suffix string to append to each test name in junit")
> >      parser.add_argument("test_profile",
> >                          metavar="<Path to one or more test profile(s)>",
> >                          nargs='+',
> > @@ -245,6 +249,7 @@ def run(input_):
> >      # refactored to make that possible because of the flattening pass that is
> >      # part of profile.run
> >      options['test_count'] = 0
> > +    options['test_suffix'] = args.junit_suffix
> >  
> >      # Begin json.
> >      backend = framework.results.get_backend(args.backend)(
> > diff --git a/framework/results.py b/framework/results.py
> > index e73519a..b567553 100644
> > --- a/framework/results.py
> > +++ b/framework/results.py
> > @@ -391,6 +391,7 @@ class JUnitBackend(FSyncMixin, Backend):
> >          self._file.write(
> >              '<testsuite name="piglit" tests="{}">\n'.format(
> >                  metadata['test_count']))
> > +        self._test_suffix = metadata["test_suffix"]
> >  
> >      def finalize(self, metadata=None):
> >          self._file.write('</testsuite>\n')
> > @@ -414,7 +415,7 @@ class JUnitBackend(FSyncMixin, Backend):
> >          classname = 'piglit.' + classname
> >  
> >          # Create the root element
> > -        element = etree.Element('testcase', name=testname,
> > +        element = etree.Element('testcase', name=testname + self._test_suffix,
> >                                  classname=classname,
> >                                  time=str(data['time']),
> >                                  status=str(data['result']))
> > -- 
> > 2.1.0
> > 
> > _______________________________________________
> > Piglit mailing list
> > Piglit at lists.freedesktop.org
> > http://lists.freedesktop.org/mailman/listinfo/piglit
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 473 bytes
Desc: This is a digitally signed message part.
URL: <http://lists.freedesktop.org/archives/piglit/attachments/20140917/67df80f4/attachment-0001.sig>


More information about the Piglit mailing list