Re: [Piglit] [PATCH] summary.py: Replace path separators in testrun names

2014-09-05 Thread Jason Ekstrand
Dylan,
There's one more on line 196 that you're missing.  Wrapping that one in
escape_pathname fixes it up nicely.  With that change,

Reviewed-by: Jason Ekstrand 

--Jason


On Fri, Sep 5, 2014 at 11:35 AM, Jason Ekstrand 
wrote:

> Yeah, on second thought, not quite working...  I'll poke at it a bit.
>
>
> On Thu, Sep 4, 2014 at 10:11 PM, Jason Ekstrand 
> wrote:
>
>> Thanks a bunch Dylan.  It's working great for me.
>> --Jason
>>
>>
>> On Thu, Sep 4, 2014 at 5:11 PM, Dylan Baker 
>> wrote:
>>
>>> On Friday, September 05, 2014 12:22:02 AM Emil Velikov wrote:
>>> > On 04/09/14 22:55, Dylan Baker wrote:
>>> > > 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.
>>> > >
>>> > In case this makes it in time for XDC2014 there will be a nice bottle
>>> of wine
>>> > waiting for you ;-)
>>> >
>>> > -Emil
>>> >
>>>
>>> Well, I don't get travel budget, so you'll have to ship me that bottle
>>> :)
>>>
>>> ___
>>> Piglit mailing list
>>> Piglit@lists.freedesktop.org
>>> http://lists.freedesktop.org/mailman/listinfo/piglit
>>>
>>>
>>
>
___
Piglit mailing list
Piglit@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/piglit


Re: [Piglit] [PATCH] summary.py: Replace path separators in testrun names

2014-09-05 Thread Jason Ekstrand
Yeah, on second thought, not quite working...  I'll poke at it a bit.


On Thu, Sep 4, 2014 at 10:11 PM, Jason Ekstrand 
wrote:

> Thanks a bunch Dylan.  It's working great for me.
> --Jason
>
>
> On Thu, Sep 4, 2014 at 5:11 PM, Dylan Baker 
> wrote:
>
>> On Friday, September 05, 2014 12:22:02 AM Emil Velikov wrote:
>> > On 04/09/14 22:55, Dylan Baker wrote:
>> > > 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.
>> > >
>> > In case this makes it in time for XDC2014 there will be a nice bottle
>> of wine
>> > waiting for you ;-)
>> >
>> > -Emil
>> >
>>
>> Well, I don't get travel budget, so you'll have to ship me that bottle
>> :)
>>
>> ___
>> Piglit mailing list
>> Piglit@lists.freedesktop.org
>> http://lists.freedesktop.org/mailman/listinfo/piglit
>>
>>
>
___
Piglit mailing list
Piglit@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/piglit


Re: [Piglit] [PATCH] summary.py: Replace path separators in testrun names

2014-09-04 Thread Jason Ekstrand
Thanks a bunch Dylan.  It's working great for me.
--Jason


On Thu, Sep 4, 2014 at 5:11 PM, Dylan Baker  wrote:

> On Friday, September 05, 2014 12:22:02 AM Emil Velikov wrote:
> > On 04/09/14 22:55, Dylan Baker wrote:
> > > 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.
> > >
> > In case this makes it in time for XDC2014 there will be a nice bottle of
> wine
> > waiting for you ;-)
> >
> > -Emil
> >
>
> Well, I don't get travel budget, so you'll have to ship me that bottle
> :)
>
> ___
> Piglit mailing list
> Piglit@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/piglit
>
>
___
Piglit mailing list
Piglit@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/piglit


Re: [Piglit] [PATCH] summary.py: Replace path separators in testrun names

2014-09-04 Thread Dylan Baker
On Friday, September 05, 2014 12:22:02 AM Emil Velikov wrote:
> On 04/09/14 22:55, Dylan Baker wrote:
> > 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.
> > 
> In case this makes it in time for XDC2014 there will be a nice bottle of wine
> waiting for you ;-)
> 
> -Emil
> 

Well, I don't get travel budget, so you'll have to ship me that bottle
:)


signature.asc
Description: This is a digitally signed message part.
___
Piglit mailing list
Piglit@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/piglit


Re: [Piglit] [PATCH] summary.py: Replace path separators in testrun names

2014-09-04 Thread Emil Velikov
On 04/09/14 22:55, Dylan Baker wrote:
> 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.
> 
In case this makes it in time for XDC2014 there will be a nice bottle of wine
waiting for you ;-)

-Emil

___
Piglit mailing list
Piglit@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/piglit


Re: [Piglit] [PATCH] summary.py: Replace path separators in testrun names

2014-09-04 Thread Dylan Baker
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 
> > Signed-off-by: Dylan Baker 
> > ---
> >  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': ''})
> >  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': '%(name)s'
> > @@ -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:
> > 
> 


signature.asc
Description: This is a digitally signed message part.
___
Piglit mailing list
Piglit@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/piglit


Re: [Piglit] [PATCH] summary.py: Replace path separators in testrun names

2014-09-04 Thread Emil Velikov
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.

Am I imagining or this will bring all the segfaults in bash to an end ?

Thanks
Emil

> CC: Jason Ekstrand 
> Signed-off-by: Dylan Baker 
> ---
>  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': ''})
>  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': '%(name)s'
> @@ -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:
> 

___
Piglit mailing list
Piglit@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/piglit


Re: [Piglit] [PATCH] summary.py: Replace path separators in testrun names

2014-09-04 Thread Ilia Mirkin
On Thu, Sep 4, 2014 at 4:54 PM, 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.
>
> CC: Jason Ekstrand 
> Signed-off-by: Dylan Baker 

Reviewed-by: Ilia Mirkin 

> ---
>  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': ''})
>  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': '%(name)s'
> @@ -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:
> --
> 2.1.0
>
> ___
> Piglit mailing list
> Piglit@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/piglit
___
Piglit mailing list
Piglit@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/piglit


[Piglit] [PATCH] summary.py: Replace path separators in testrun names

2014-09-04 Thread Dylan Baker
This solves the bug of running piglit run -n 'wip/foo' which causes a
number of issues in the html summary generation.

CC: Jason Ekstrand 
Signed-off-by: Dylan Baker 
---
 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': ''})
 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': '%(name)s'
@@ -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:
-- 
2.1.0

___
Piglit mailing list
Piglit@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/piglit