[Piglit] [PATCH] summary.py: Replace path separators in testrun names
Dylan Baker
baker.dylan.c at gmail.com
Thu Sep 4 14:55:04 PDT 2014
On Thursday, September 04, 2014 10:49:10 PM Emil Velikov wrote:
> On 04/09/14 21:54, Dylan Baker wrote:
> > This solves the bug of running piglit run -n 'wip/foo' which causes a
> > number of issues in the html summary generation.
> >
> From a quick look it seems that it might help with a funny issue that I'm seeing:
>
> Whenever piglit is ran on Windows the testname uses \\ as path separator (in
> some cases / is also used). When trying to generate summary under Linux, the
> script ends up generating a ton of spec\extenstion_name\test files, rather
> than structuring everything as normal.
The mixed '/' and '\\' issue is known, it's mostly due to hard coding of
values. It's on my list (although pretty far down) of things to fix.
>
> Am I imagining or this will bring all the segfaults in bash to an end ?
I've never heard of this. Although I use zsh, so I guess that's not
surprising.
>
> Thanks
> Emil
>
> > CC: Jason Ekstrand <jason at jlekstrand.net>
> > Signed-off-by: Dylan Baker <dylanx.c.baker at intel.com>
> > ---
> > framework/summary.py | 14 ++++++++++----
> > 1 file changed, 10 insertions(+), 4 deletions(-)
> >
> > diff --git a/framework/summary.py b/framework/summary.py
> > index d1b737b..debd6a7 100644
> > --- a/framework/summary.py
> > +++ b/framework/summary.py
> > @@ -47,6 +47,11 @@ def escape_filename(key):
> > return re.sub(r'[<>:"|?*#]', '_', key)
> >
> >
> > +def escape_pathname(key):
> > + """ Remove / and \\ from names """
> > + return re.sub(r'[/\\]', '_', key)
> > +
> > +
> > def normalize_href(href):
> > """Force backward slashes in URLs."""
> > return href.replace('\\', '/')
> > @@ -113,7 +118,7 @@ class HTMLIndex(list):
> > self._newRow()
> > self.append({'type': 'other', 'text': '<td />'})
> > for each in summary.results:
> > - href = posixpath.join(each.name, "index.html")
> > + href = posixpath.join(escape_pathname(each.name), "index.html")
> > href = normalize_href(href)
> > self.append({'type': 'other',
> > 'text': '<td class="head"><b>%(name)s</b><br />'
> > @@ -454,7 +459,8 @@ class Summary:
> >
> > # Iterate across the tests creating the various test specific files
> > for each in self.results:
> > - os.mkdir(path.join(destination, each.name))
> > + name = escape_pathname(each.name)
> > + os.mkdir(path.join(destination, name))
> >
> > if each.time_elapsed is not None:
> > time = datetime.timedelta(0, each.time_elapsed)
> > @@ -463,7 +469,7 @@ class Summary:
> >
> > self.__find_totals(each)
> >
> > - with open(path.join(destination, each.name, "index.html"), 'w') as out:
> > + with open(path.join(destination, name, "index.html"), 'w') as out:
> > out.write(testindex.render(name=each.name,
> > totals=self.totals,
> > time=time,
> > @@ -474,7 +480,7 @@ class Summary:
> >
> > # Then build the individual test results
> > for key, value in each.tests.iteritems():
> > - html_path = path.join(destination, each.name, escape_filename(key + ".html"))
> > + html_path = path.join(destination, name, escape_filename(key + ".html"))
> > temp_path = path.dirname(html_path)
> >
> > if value['result'] not in exclude:
> >
>
-------------- 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/20140904/c35a68a4/attachment.sig>
More information about the Piglit
mailing list