Re: [Piglit] [PATCH] oclconform: Fix PEP 8 issues.

2015-11-16 Thread Dylan Baker
On Sat, Nov 14, 2015 at 11:20:33PM -0800, Vinson Lee wrote:
> Signed-off-by: Vinson Lee 
> ---
>  framework/test/oclconform.py | 39 +--
>  1 file changed, 25 insertions(+), 14 deletions(-)
> 
> diff --git a/framework/test/oclconform.py b/framework/test/oclconform.py
> index 14ce902..eb3adb4 100644
> --- a/framework/test/oclconform.py
> +++ b/framework/test/oclconform.py
> @@ -41,20 +41,24 @@ __all__ = [
>  def get_test_section_name(test):
>  return 'oclconform-{}'.format(test)
>  
> -class OCLConform(Test):
>  
> +class OCLConform(Test):
>  def interpret_result(self):
>  if self.result.returncode != 0 or 'FAIL' in self.result.out:
>  self.result.result = 'fail'
>  else:
>  self.result.result = 'pass'
>  
> +
>  def add_sub_test(profile, test_name, subtest_name, subtest):
> -profile.test_list[grouptools.join('oclconform', test_name, 
> subtest_name)] = subtest
> +profile.test_list[grouptools.join('oclconform', test_name,
> +  subtest_name)] = subtest
> +
>  
>  def add_test(profile, test_name, test):
>  profile.test_list[grouptools.join('oclconform', test_name)] = test
>  
> +
>  def add_oclconform_tests(profile):
>  section_name = 'oclconform'
>  if not PIGLIT_CONFIG.has_section(section_name):
> @@ -68,30 +72,37 @@ def add_oclconform_tests(profile):
>  for test in tests:
>  test_section_name = get_test_section_name(test)
>  if not PIGLIT_CONFIG.has_section(test_section_name):
> -print("Warning: no section defined for {}".format(test), 
> file=stderr)
> +print("Warning: no section defined for {}".format(test),
> +  file=stderr)
>  continue
>  
>  test_name = PIGLIT_CONFIG.get(test_section_name, 'test_name')
> -should_run_concurrent = PIGLIT_CONFIG.has_option(test_section_name, 
> 'concurrent')
> +should_run_concurrent = PIGLIT_CONFIG.has_option(test_section_name,
> + 'concurrent')
>  if PIGLIT_CONFIG.has_option(test_section_name, 'list_subtests'):
> -list_tests = PIGLIT_CONFIG.get(test_section_name, 
> 'list_subtests')
> -subtest_regex = PIGLIT_CONFIG.get(test_section_name, 
> 'subtest_regex')
> +list_tests = PIGLIT_CONFIG.get(test_section_name,
> +   'list_subtests')
> +subtest_regex = PIGLIT_CONFIG.get(test_section_name,
> +  'subtest_regex')
>  subtest_regex.encode('string_escape')
>  run_subtests = PIGLIT_CONFIG.get(test_section_name, 
> 'run_subtest')
> -list_tests =list_tests.split()
> +list_tests = list_tests.split()
>  
> -subtests = subprocess.check_output(args=list_tests, 
> cwd=bindir).split('\n')
> +subtests = subprocess.check_output(args=list_tests,
> +   cwd=bindir).split('\n')
>  for subtest in subtests:
>  m = re.match(subtest_regex, subtest)
>  if not m:
>  continue
>  subtest = m.group(1)
> -subtest_command = join(bindir, 
> run_subtests.replace('', subtest))
> +subtest_command = join(bindir,
> +   run_subtests.replace('',
> +subtest))
>  add_sub_test(profile, test_name, subtest,
> -  OCLConform(command=subtest_command.split(),
> - run_concurrent=should_run_concurrent))
> + OCLConform(command=subtest_command.split(),
> +
> run_concurrent=should_run_concurrent))
>  else:
>  run_test = PIGLIT_CONFIG.get(test_section_name, 'run_test')
> -add_test(profile, test_name, OCLConform(command=run_test.split(),
> - 
> run_concurrent=should_run_concurrent))
> -
> +add_test(profile, test_name,
> + OCLConform(command=run_test.split(),
> +run_concurrent=should_run_concurrent))
> -- 
> 2.4.9 (Apple Git-60)
> 

Reviewed-by: Dylan Baker 


signature.asc
Description: PGP signature
___
Piglit mailing list
Piglit@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/piglit


[Piglit] [PATCH v2 3/3] framework/test/glsl_parser_test.py: allow forcing the desktop version

2015-11-16 Thread baker . dylan . c
From: Dylan Baker 

This adds a new environment variable, PIGLIT_FORCE_GLSLPARSER_DESKTOP,
which forces glsl_parser_test.py to use "glslparsertest" for GLES tests
(instead of "glslparsertest_gles2").

This could be used to force testing ES__compatibility extensions
even when OpenGL ES tests are being built.

Signed-off-by: Dylan Baker 
---
 framework/test/glsl_parser_test.py| 17 ++---
 framework/tests/glsl_parser_test_tests.py | 10 ++
 2 files changed, 20 insertions(+), 7 deletions(-)

diff --git a/framework/test/glsl_parser_test.py 
b/framework/test/glsl_parser_test.py
index a543f52..544e2fe 100644
--- a/framework/test/glsl_parser_test.py
+++ b/framework/test/glsl_parser_test.py
@@ -40,6 +40,10 @@ _HAS_GL_VERSION = os.path.exists(os.path.join(TEST_BIN_DIR, 
'glslparsertest'))
 _HAS_GLES_VERSION = os.path.exists(os.path.join(TEST_BIN_DIR,
 'glslparsertest_gles2'))
 
+# This forces testing with compatibility extensions, even when GLES support is
+# built
+_FORCE_DESKTOP_VERSION = os.environ.get('PIGLIT_FORCE_GLSLPARSER_DESKTOP', 
False)
+
 
 def _is_gles_version(version):
 """Return True if version is es, otherwsie false."""
@@ -141,15 +145,14 @@ class GLSLParserTest(FastSkipMixin, PiglitBaseTest):
 then the test will be skipped in the python layer.
 
 """
-if _is_gles_version(version):
-if _HAS_GLES_VERSION:
-return 'glslparsertest_gles2'
-else:
-return 'glslparsertest'
-
-if _HAS_GL_VERSION:
+if (_is_gles_version(version)
+and _HAS_GLES_VERSION
+and not _FORCE_DESKTOP_VERSION):
+return 'glslparsertest_gles2'
+elif _HAS_GL_VERSION:
 return 'glslparsertest'
 else:
+# In this case there is no version taht can run the test, skip it
 self.__is_skip = True
 return 'None'
 
diff --git a/framework/tests/glsl_parser_test_tests.py 
b/framework/tests/glsl_parser_test_tests.py
index 4a61a5e..dcdcf5c 100644
--- a/framework/tests/glsl_parser_test_tests.py
+++ b/framework/tests/glsl_parser_test_tests.py
@@ -391,6 +391,16 @@ def test_get_glslparsertest_gles2():
 test.description = description.format(version)
 yield test, content.format(version), 'glslparsertest'
 
+description = ("test.glsl_parser_test.GLSLParserTest: "
+   "gets gl binary if glsl is '{}' and "
+   "PIGLIT_FORCE_GLSLPARSER_DESKTOP is true")
+
+with mock.patch('framework.test.glsl_parser_test._HAS_GLES_VERSION', 
False):
+with 
mock.patch('framework.test.glsl_parser_test._FORCE_DESKTOP_VERSION', True):
+for version in versions:
+test.description = description.format(version)
+yield test, content.format(version), 'glslparsertest'
+
 
 def test_set_glsl_version():
 """test.glsl_parser_test.GLSLParserTest: sets glsl_version"""
-- 
2.6.2

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


[Piglit] [PATCH v2 2/3] framework/test/glsl_parser_test.py: Handle gl versions correctly

2015-11-16 Thread baker . dylan . c
From: Dylan Baker 

This patch fixes the behavior of glsl_parser_test in cases other that
OpenGL and OpenGL ES are available. This means that if OpenGL ES isn't
available then OpenGL ES shaders will be passed to the regular version
of glslparsertest, which can run them with an ARB_ES_compatibility
extension. When a test is for desktop OpenGL, but only OpenGL ES is
available, then the test will skip in the python layer.

Signed-off-by: Dylan Baker 

v2: - Rebase on top of now upstream fast-skipping patchs
- When using glslparsertest to run GLES tests add
  ARB_ES_compatibility to gl_required, to integrate with fast
  skipping.
- Fix some tests. These tests are pretty fragile and probably just
  need to be reworked.
- small refactors, make use of the _is_gles_version helper
- Split skip conditions into a private method
---
 framework/test/glsl_parser_test.py|  72 +--
 framework/tests/glsl_parser_test_tests.py | 140 +-
 2 files changed, 166 insertions(+), 46 deletions(-)

diff --git a/framework/test/glsl_parser_test.py 
b/framework/test/glsl_parser_test.py
index 6d91c22..a543f52 100644
--- a/framework/test/glsl_parser_test.py
+++ b/framework/test/glsl_parser_test.py
@@ -26,14 +26,20 @@ import os
 import re
 
 from framework import exceptions
-from .piglit_test import PiglitBaseTest
+from .base import TestIsSkip
 from .opengl import FastSkipMixin
+from .piglit_test import PiglitBaseTest, TEST_BIN_DIR
 
 __all__ = [
 'GLSLParserTest',
 'GLSLParserNoConfigError',
 ]
 
+# In different configurations piglit may have one or both of these.
+_HAS_GL_VERSION = os.path.exists(os.path.join(TEST_BIN_DIR, 'glslparsertest'))
+_HAS_GLES_VERSION = os.path.exists(os.path.join(TEST_BIN_DIR,
+'glslparsertest_gles2'))
+
 
 def _is_gles_version(version):
 """Return True if version is es, otherwsie false."""
@@ -42,6 +48,7 @@ def _is_gles_version(version):
 # glslparsertest doesn't honor them.
 if version.endswith('es'):
 return True
+
 version = float(version)
 
 return version in [1.0, 3.0, 3.1, 3.2]
@@ -74,6 +81,10 @@ class GLSLParserTest(FastSkipMixin, PiglitBaseTest):
 def __init__(self, filepath):
 os.stat(filepath)
 
+# This value is set to true if a test is for desktop OpenGL, but only
+# OpenGL ES is available.
+self.__is_skip = False
+
 # a set that stores a list of keys that have been found already
 self.__found_keys = set()
 
@@ -89,19 +100,59 @@ class GLSLParserTest(FastSkipMixin, PiglitBaseTest):
 
 super(GLSLParserTest, self).__init__(command, run_concurrent=True)
 
+self.__set_skip_conditions(config)
+
+def __set_skip_conditions(self, config):
+"""Set OpenGL and OpenGL ES fast skipping conditions."""
 glsl = config.get('glsl_version')
 if glsl:
-if glsl in ['1.00', '3.00']:
-self.glsl_es_version = float(glsl)
-elif glsl.endswith('es'):
-self.glsl_es_version = float(glsl.split()[0])
+if _is_gles_version(glsl):
+self.glsl_es_version = float(glsl[:3])
 else:
 self.glsl_version = float(glsl)
 
+# If GLES is requested, but piglit was not built with a gles version,
+# then ARB_ES3_compatibility is required. Add it to
+# self.gl_required
+if self.glsl_es_version and not _HAS_GLES_VERSION:
+if self.glsl_es_version == 1.0:
+ver = '2'
+elif self.glsl_es_version == 3.0:
+ver = '3'
+elif self.glsl_es_version == 3.1:
+ver = '3_1'
+elif self.glsl_es_version == 3.2:
+ver = '3_2'
+self.gl_required.add('ARB_ES{}_compatibility'.format(ver))
+
 req = config.get('require_extensions')
 if req:
 self.gl_required = set(req.split())
 
+def __pick_binary(self, version):
+"""Pick the correct version of glslparsertest to use.
+
+This will try to select glslparsertest_gles2 for OpenGL ES tests, and
+glslparsertest for desktop OpenGL tests. However, sometimes this isn't
+possible. In that case all tests will be assigned to the desktop
+version.
+
+If the test requires desktop OpenGL, but only OpenGL ES is available,
+then the test will be skipped in the python layer.
+
+"""
+if _is_gles_version(version):
+if _HAS_GLES_VERSION:
+return 'glslparsertest_gles2'
+else:
+return 'glslparsertest'
+
+if _HAS_GL_VERSION:
+return 'glslparsertest'
+else:
+self.__is_skip = True
+return 'None'
+
 def __get_command(self, config, filepath):
 """ Create the command argument to pass to super()
 
@@ -120,7 +171,7

[Piglit] [PATCH v2 1/3] glsl_parser_test.py: Fix which versions are sent to glslparsertest_gles2

2015-11-16 Thread baker . dylan . c
From: Dylan Baker 

There are two versions of glslparsertest, an undecorated one for desktop
OpenGL, and a '_gles2' suffixed one for OpenGL ES. Piglit should pass 3.1
and 3.2 to the '_gles2' version like it does for GLES 2 and GLES 3.0

This also extends the test generator to cover these new cases (and a few
it should have been covering before). It now covers 1.00, 3.00, 3.10,
3.20, 3.00 es, 3.10 es, and 3.20 es.

Signed-off-by: Dylan Baker 
---
 framework/test/glsl_parser_test.py| 14 +-
 framework/tests/glsl_parser_test_tests.py |  5 -
 2 files changed, 17 insertions(+), 2 deletions(-)

diff --git a/framework/test/glsl_parser_test.py 
b/framework/test/glsl_parser_test.py
index d1a461a..6d91c22 100644
--- a/framework/test/glsl_parser_test.py
+++ b/framework/test/glsl_parser_test.py
@@ -35,6 +35,18 @@ __all__ = [
 ]
 
 
+def _is_gles_version(version):
+"""Return True if version is es, otherwsie false."""
+if isinstance(version, basestring):
+# GLES 3+ versions should have "es" appended, even though
+# glslparsertest doesn't honor them.
+if version.endswith('es'):
+return True
+version = float(version)
+
+return version in [1.0, 3.0, 3.1, 3.2]
+
+
 class GLSLParserNoConfigError(exceptions.PiglitInternalError):
 pass
 
@@ -108,7 +120,7 @@ class GLSLParserTest(FastSkipMixin, PiglitBaseTest):
 # Create the command and pass it into a PiglitTest()
 glsl = config['glsl_version']
 command = [
-'glslparsertest_gles2' if glsl in ['1.00', '3.00'] else 
'glslparsertest',
+'glslparsertest_gles2' if _is_gles_version(glsl) else 
'glslparsertest',
 filepath,
 config['expect_result'],
 config['glsl_version']
diff --git a/framework/tests/glsl_parser_test_tests.py 
b/framework/tests/glsl_parser_test_tests.py
index b837723..ba02947 100644
--- a/framework/tests/glsl_parser_test_tests.py
+++ b/framework/tests/glsl_parser_test_tests.py
@@ -373,7 +373,10 @@ def test_get_glslparsertest_gles2():
 description = ("test.glsl_parser_test.GLSLParserTest: "
"gets gles2 binary if glsl is {}")
 
-for version in ['1.00', '3.00']:
+versions = ['1.00', '3.00', '3.10', '3.20', '3.00 es', '3.10 es',
+'3.20 es']
+
+for version in versions:
 test.description = description.format(version)
 yield test, content.format(version)
 
-- 
2.6.2

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


[Piglit] [PATCH v2 0/3] Fix glslparsertest python version handling

2015-11-16 Thread baker . dylan . c
From: Dylan Baker 

This fixes the way that glslparsertest in the python layer handles
versions.

Specifically with this series:
- the python layer makes smarter decisions about using glslparsertest or
  glslparsertest_gles2, especially in cases where only one has been
  built
- If glslparsertest is used for GLES tests, then
  ARB_ES_compatibility will be added to the required extensions in
  the fast skipping layer
- Even in cases where both are built, gles 3.1 and gles 3.2 tests are
  not directed to glslparsertest_gles2 when it is available, rather than
  glslparsertest

Dylan Baker (3):
  glsl_parser_test.py: Fix which versions are sent to
glslparsertest_gles2
  framework/test/glsl_parser_test.py: Handle gl versions correctly
  framework/test/glsl_parser_test.py: allow forcing the desktop version

 framework/test/glsl_parser_test.py|  87 +++--
 framework/tests/glsl_parser_test_tests.py | 151 ++
 2 files changed, 193 insertions(+), 45 deletions(-)

-- 
2.6.2

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


Re: [Piglit] [PATCH v2 0/3] Fix glslparsertest python version handling

2015-11-16 Thread Dylan Baker
On Mon, Nov 16, 2015 at 05:27:30PM -0800, baker.dyla...@gmail.com wrote:
> From: Dylan Baker 
> 
> This fixes the way that glslparsertest in the python layer handles
> versions.
> 
> Specifically with this series:
> - the python layer makes smarter decisions about using glslparsertest or
>   glslparsertest_gles2, especially in cases where only one has been
>   built
> - If glslparsertest is used for GLES tests, then
>   ARB_ES_compatibility will be added to the required extensions in
>   the fast skipping layer
> - Even in cases where both are built, gles 3.1 and gles 3.2 tests are
>   not directed to glslparsertest_gles2 when it is available, rather than
>   glslparsertest
> 
> Dylan Baker (3):
>   glsl_parser_test.py: Fix which versions are sent to
> glslparsertest_gles2
>   framework/test/glsl_parser_test.py: Handle gl versions correctly
>   framework/test/glsl_parser_test.py: allow forcing the desktop version
> 
>  framework/test/glsl_parser_test.py|  87 +++--
>  framework/tests/glsl_parser_test_tests.py | 151 
> ++
>  2 files changed, 193 insertions(+), 45 deletions(-)
> 
> -- 
> 2.6.2
> 

Err, this is version 3, actually.


signature.asc
Description: PGP signature
___
Piglit mailing list
Piglit@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/piglit


[Piglit] [PATCH] arb_gpu_shader_fp64: Silence Coverity uninitialized variable defects.

2015-11-16 Thread Vinson Lee
Coverity does not the parse the shader and cannot determine all cases
are being handled.

Fixes Coverity "uninitialized scalar variable" defects.

Signed-off-by: Vinson Lee 
---
 tests/spec/arb_gpu_shader_fp64/execution/getuniformdv.c | 4 
 1 file changed, 4 insertions(+)

diff --git a/tests/spec/arb_gpu_shader_fp64/execution/getuniformdv.c 
b/tests/spec/arb_gpu_shader_fp64/execution/getuniformdv.c
index 5f7d85e..80ec945 100644
--- a/tests/spec/arb_gpu_shader_fp64/execution/getuniformdv.c
+++ b/tests/spec/arb_gpu_shader_fp64/execution/getuniformdv.c
@@ -152,6 +152,10 @@ piglit_init(int argc, char **argv)
   } else if (name[0] == 'b') {
 expectedType = GL_BOOL;
  expectedSize = 1;
+  } else {
+ assert(0);
+ expectedType = GL_NONE;
+ expectedSize = 0;
   }
 
   if (type != expectedType) {
-- 
2.6.3

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


[Piglit] [PATCH] cl-api-enqueue-fill-image: Fix memory leaks.

2015-11-16 Thread Vinson Lee
Fixes Coverity "resource leak" defects.

Signed-off-by: Vinson Lee 
---
 tests/cl/api/enqueue-fill-image.c | 4 
 1 file changed, 4 insertions(+)

diff --git a/tests/cl/api/enqueue-fill-image.c 
b/tests/cl/api/enqueue-fill-image.c
index ebcfba4..994ccb4 100644
--- a/tests/cl/api/enqueue-fill-image.c
+++ b/tests/cl/api/enqueue-fill-image.c
@@ -129,12 +129,14 @@ piglit_cl_test(const int argc,
if(!piglit_cl_check_error(err, CL_SUCCESS)) {
fprintf(stderr, "Failed (error code: %s): Creating an image\n",
piglit_cl_get_error_name(err));
+   free(image_support);
return PIGLIT_FAIL;
}
 
if (!test(queue, image, pattern, origin, region,
  0, NULL, NULL,
  CL_SUCCESS, &result, "Enqueuing the image to be filled")) {
+   free(image_support);
return PIGLIT_FAIL;
}
 
@@ -145,6 +147,7 @@ piglit_cl_test(const int argc,
if(!piglit_cl_check_error(err, CL_SUCCESS)) {
fprintf(stderr, "Failed (error code: %s): Reading image\n",
piglit_cl_get_error_name(err));
+   free(image_support);
return PIGLIT_FAIL;
}
 
@@ -169,6 +172,7 @@ piglit_cl_test(const int argc,
if (!piglit_cl_probe_integer(dst_buf[i], exp_buf[i], 0)) {
fprintf(stderr, "Error at %d: got %d, expected %d\n",
i, dst_buf[i], exp_buf[i]);
+   free(image_support);
return PIGLIT_FAIL;
}
}
-- 
2.6.3

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