[Piglit] [RFC PATCH] summary.py: escape \ from Windows results when creating folders on Linux

Jose Fonseca jfonseca at vmware.com
Sun Nov 23 01:44:55 PST 2014


On 22/11/14 04:49, Emil Velikov wrote:
> Seemingly this is sufficient for a Windows piglit run/result file to be
> ran under Linux and the correct directory structure (and html) to be
> generated.
>
> Unfortunately my python-fu is a bit short so I'm not sure if(how much)
> this will backfire when used on Windows with either Linux or Windows
> result file.

I think it should be fine.  Windows web browsers (and most applications) 
handle / in paths.


>
> Cc: Dylan Baker <dylanx.c.baker at intel.com>
> Signed-off-by: Emil Velikov <emil.l.velikov at gmail.com>
> ---
>   framework/summary.py | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/framework/summary.py b/framework/summary.py
> index f4fd80d..6dc2b07 100644
> --- a/framework/summary.py
> +++ b/framework/summary.py
> @@ -482,7 +482,7 @@ class Summary:
>
>               # Then build the individual test results
>               for key, value in each.tests.iteritems():
> -                html_path = path.join(destination, name, escape_filename(key + ".html"))
> +                html_path = path.join(destination, name, escape_filename(key.replace('\\', '/') + ".html"))

There is normalize_href() helper already. So you could use it instead of 
".replace('\\', '/')"


But otherwise looks good.


Jose

>                   temp_path = path.dirname(html_path)
>
>                   if value['result'] not in exclude:
>



More information about the Piglit mailing list