[Piglit] [PATCH] glsl-deriv-varyings: Fixes compilation warnings and adds extra regular subtest

2014-12-19 Thread Andres Gomez
A new subtest has been introduced for testing the regular expected
values when using dFdx/dFdy in combination with the negative and abs
register modifiers.
---
 tests/shaders/glsl-deriv-varyings.c | 62 ++---
 1 file changed, 50 insertions(+), 12 deletions(-)

diff --git a/tests/shaders/glsl-deriv-varyings.c 
b/tests/shaders/glsl-deriv-varyings.c
index fa72eec..c3492df 100644
--- a/tests/shaders/glsl-deriv-varyings.c
+++ b/tests/shaders/glsl-deriv-varyings.c
@@ -55,6 +55,8 @@ static GLint prog4;
 static GLint fs4;
 static GLint prog5;
 static GLint fs5;
+static GLint prog6;
+static GLint fs6;
 
 
 static GLfloat verts[12] = {175.0, 125.0, 0.0,
@@ -86,7 +88,6 @@ static const char *fragShaderText =
"} \n";
 
 static const char *fragShaderText2 =
-   "uniform sampler2D tex2d;\n"
"varying vec2 texCoords;\n"
"void main()\n"
"{ \n"
@@ -96,7 +97,6 @@ static const char *fragShaderText2 =
"} \n";
 
 static const char *fragShaderText3 =
-   "uniform sampler2D tex2d;\n"
"varying vec2 texCoords;\n"
"void main()\n"
"{ \n"
@@ -106,7 +106,6 @@ static const char *fragShaderText3 =
"} \n";
 
 static const char *fragShaderText4 =
-   "uniform sampler2D tex2d;\n"
"varying vec2 texCoords;\n"
"void main()\n"
"{ \n"
@@ -116,12 +115,20 @@ static const char *fragShaderText4 =
"} \n";
 
 static const char *fragShaderText5 =
-   "uniform sampler2D tex2d;\n"
"varying vec2 texCoords;\n"
"void main()\n"
"{ \n"
"   gl_FragColor = vec4(dFdx(-abs(texCoords.x)) * -40.0,\n"
-   "   dFdy(-abs(texCoords.y) * -40.0,\n"
+   "   dFdy(-abs(texCoords.y)) * -40.0,\n"
+   "   0.0, 1.0);\n"
+   "} \n";
+
+static const char *fragShaderText6 =
+   "varying vec2 texCoords;\n"
+   "void main()\n"
+   "{ \n"
+   "   gl_FragColor = vec4(dFdx(abs(texCoords.x)) * 40.0,\n"
+   "   dFdy(abs(texCoords.y)) * 40.0,\n"
"   0.0, 1.0);\n"
"} \n";
 
@@ -158,12 +165,15 @@ compileLinkProg(void)
 
fs5 = glCreateShader(GL_FRAGMENT_SHADER);
 
+   fs6 = glCreateShader(GL_FRAGMENT_SHADER);
+
glShaderSource(vs1, 1, (const GLchar **) &vertShaderText, NULL);
glShaderSource(fs1, 1, (const GLchar **) &fragShaderText, NULL);
glShaderSource(fs2, 1, (const GLchar **) &fragShaderText2, NULL);
glShaderSource(fs3, 1, (const GLchar **) &fragShaderText3, NULL);
-   glShaderSource(fs4, 1, (const GLchar **) &fragShaderText3, NULL);
-   glShaderSource(fs5, 1, (const GLchar **) &fragShaderText3, NULL);
+   glShaderSource(fs4, 1, (const GLchar **) &fragShaderText4, NULL);
+   glShaderSource(fs5, 1, (const GLchar **) &fragShaderText5, NULL);
+   glShaderSource(fs6, 1, (const GLchar **) &fragShaderText6, NULL);
 
glCompileShader(vs1);
glGetShaderiv(vs1, GL_COMPILE_STATUS, &stat);
@@ -207,6 +217,13 @@ compileLinkProg(void)
exit(1);
}
 
+   glCompileShader(fs6);
+   glGetShaderiv(fs6, GL_COMPILE_STATUS, &stat);
+   if (!stat) {
+   printf("error compiling fragment shader6!\n");
+   exit(1);
+   }
+
 
prog1 = glCreateProgram();
glAttachShader(prog1, vs1);
@@ -281,6 +298,21 @@ compileLinkProg(void)
texCoords);
glEnableVertexAttribArray(0);
glEnableVertexAttribArray(1);
+
+
+   prog6 = glCreateProgram();
+   glAttachShader(prog6, vs1);
+   glAttachShader(prog6, fs6);
+   glBindAttribLocation(prog6, 1, "textureCoords");
+   glLinkProgram(prog6);
+   glUseProgram(prog6);
+
+   glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, 3*sizeof(GLfloat),
+   verts);
+   glVertexAttribPointer(1, 2, GL_FLOAT, GL_FALSE, 2*sizeof(GLfloat),
+   texCoords);
+   glEnableVertexAttribArray(0);
+   glEnableVertexAttribArray(1);
 }
 
 static void
@@ -359,13 +391,19 @@ piglit_display(void)
glUseProgram(prog5);
glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);
 
+   glTranslatef(75.0, 0.0, 0.0);
+
+   glUseProgram(prog6);
+   glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);
+
glPopMatrix();
 
-   pass = pass && piglit_probe_pixel_rgb(132, 125, green);
-   pass = pass && piglit_probe_pixel_rgb(205, 125, deriv);
-   pass = pass && piglit_probe_pixel_rgb(280, 125, deriv);
-   pass = pass && piglit_probe_pixel_rgb(355, 125, deriv);
-   pass = pass && piglit_probe_pixel_rgb(430, 125, deriv);
+   pass = pass && piglit_probe_pixel_rgb(132, 130, green);
+   pass = pass && piglit_probe_pixel_rgb(205, 130, deriv);
+   pass = pass && piglit_probe_pixel_rgb(280, 130, deriv);
+   pass = pass && piglit_probe_pixel_rgb(355, 130, deriv

Re: [Piglit] [PATCH] Fix recently introduced GCC warnings in glsl-deriv-varyings

2014-12-19 Thread Andres Gomez
On Tue, 2014-12-16 at 20:18 +0100, Andres Gomez wrote:
> Previous patch at:
> http://lists.freedesktop.org/archives/piglit/2014-December/013648.html
> 
> Introduced a couple of GCC warnings in the last 2 newly introduced
> tests.
> 
> After correcting the warnings I'm realizing these tests are exposing
> yet another bug, probably, in glReadPixels.
> 
> This patch removes these 2 tests temporarily while I'm working in this
> new bug. I will re-introduce them once I have a solution for mesa.

Please, ignore this patch. My findings in:
https://bugs.freedesktop.org/show_bug.cgi?id=87407

Are showing a possible bug in the limit values when using dFdx/dFdy in
combination with the abs() modifier.

Ian is recommending in that patch to actually replace this current
piglit test with individual shader_runner tests. I will work in this
direction in the bug above but, in the meanwhile, I'm posting next a
patch for testing the regular values and fix the compilation warnings.

-- 
Br,

Andres

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


[Piglit] [Bug 87513] NameError: name 'dirname' is not defined

2014-12-19 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=87513

Dylan  changed:

   What|Removed |Added

 Status|ASSIGNED|RESOLVED
 Resolution|--- |FIXED

--- Comment #3 from Dylan  ---
6882947..f48cfa9  master -> master

-- 
You are receiving this mail because:
You are the QA Contact for the bug.
You are the assignee for the bug.
___
Piglit mailing list
Piglit@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/piglit


Re: [Piglit] [PATCH] generate-cl-store-tests.py: fix copy and paste error from 68829470

2014-12-19 Thread Mark Janes
Reviewed-by: Mark Janes 

Dylan Baker  writes:

> bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=87513
> Signed-off-by: Dylan Baker 
> ---
>  generated_tests/generate-cl-store-tests.py | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/generated_tests/generate-cl-store-tests.py 
> b/generated_tests/generate-cl-store-tests.py
> index 586c4f0..e1bc06d 100644
> --- a/generated_tests/generate-cl-store-tests.py
> +++ b/generated_tests/generate-cl-store-tests.py
> @@ -32,7 +32,7 @@ TYPES = ['char', 'uchar', 'short', 'ushort', 'int', 'uint', 
> 'long', 'ulong', 'fl
>  VEC_SIZES = ['', '2', '4', '8', '16']
>  
>  dirName = os.path.join("cl", "store")
> -utils.safe_makedirs(dirname)
> +utils.safe_makedirs(dirName)
>  
>  
>  def gen_array(size):
> -- 
> 2.2.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] [Bug 87513] NameError: name 'dirname' is not defined

2014-12-19 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=87513

Dylan  changed:

   What|Removed |Added

 Status|NEW |ASSIGNED

--- Comment #2 from Dylan  ---
There is a patch on the list for this:

"generate-cl-store-tests.py: fix copy and paste error from 68829470"

-- 
You are receiving this mail because:
You are the QA Contact for the bug.
You are the assignee for the bug.
___
Piglit mailing list
Piglit@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/piglit


[Piglit] [PATCH] generate-cl-store-tests.py: fix copy and paste error from 68829470

2014-12-19 Thread Dylan Baker
bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=87513
Signed-off-by: Dylan Baker 
---
 generated_tests/generate-cl-store-tests.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/generated_tests/generate-cl-store-tests.py 
b/generated_tests/generate-cl-store-tests.py
index 586c4f0..e1bc06d 100644
--- a/generated_tests/generate-cl-store-tests.py
+++ b/generated_tests/generate-cl-store-tests.py
@@ -32,7 +32,7 @@ TYPES = ['char', 'uchar', 'short', 'ushort', 'int', 'uint', 
'long', 'ulong', 'fl
 VEC_SIZES = ['', '2', '4', '8', '16']
 
 dirName = os.path.join("cl", "store")
-utils.safe_makedirs(dirname)
+utils.safe_makedirs(dirName)
 
 
 def gen_array(size):
-- 
2.2.0

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


[Piglit] [Bug 87513] NameError: name 'dirname' is not defined

2014-12-19 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=87513

--- Comment #1 from Dylan  ---
copy and paste error. I'll fix it imediately.

-- 
You are receiving this mail because:
You are the QA Contact for the bug.
You are the assignee for the bug.
___
Piglit mailing list
Piglit@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/piglit


[Piglit] [Bug 87513] New: NameError: name 'dirname' is not defined

2014-12-19 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=87513

Bug ID: 87513
   Summary: NameError: name 'dirname' is not defined
   Product: piglit
   Version: unspecified
  Hardware: x86-64 (AMD64)
OS: Linux (All)
Status: NEW
  Keywords: bisected, regression
  Severity: blocker
  Priority: medium
 Component: tests
  Assignee: piglit@lists.freedesktop.org
  Reporter: v...@freedesktop.org
QA Contact: piglit@lists.freedesktop.org
CC: baker.dyla...@gmail.com, mark.a.ja...@intel.com

piglit: 688294703e580c2d9b77e814cdd3ae68d96c57a3 (master)

[ 99%] Generating cl_store_tests.list
Traceback (most recent call last):
  File "generated_tests/generate-cl-store-tests.py", line 35, in 
utils.safe_makedirs(dirname)
NameError: name 'dirname' is not defined


commit 688294703e580c2d9b77e814cdd3ae68d96c57a3
Author: Dylan Baker 
Date:   Wed Dec 17 15:28:59 2014 -0800

generated_tests: Actually catch exception in os.makedirs

Patch b59ff71eb was supposed to fix os.makedirs exceptions, but falls
short because of a missing else statement that causes all of the caught
exceptions to fall back to raise.

This corrects, it also pulls the duplicate functions out into a shared
module.

v2: - remove accidentally included hunk (Mark)
v3: - Actually include the modules directory in the commit (Mark)

Signed-off-by: Dylan Baker 
Reviewed-by: Mark Janes 

-- 
You are receiving this mail because:
You are the QA Contact for the bug.
You are the assignee for the bug.
___
Piglit mailing list
Piglit@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/piglit


Re: [Piglit] [Patch v3] generated_tests: Actually catch exception in os.makedirs

2014-12-19 Thread Mark Janes
Dylan Baker  writes:

> Patch b59ff71eb was supposed to fix os.makedirs exceptions, but falls
> short because of a missing else statement that causes all of the caught
> exceptions to fall back to raise.
>
> This corrects, it also pulls the duplicate functions out into a shared
> module.
>
> v2: - remove accidentally included hunk (Mark)
> v3: - Actually include the modules directory in the commit (Mark)

Reviewed-by: Mark Janes 
___
Piglit mailing list
Piglit@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/piglit


Re: [Piglit] [PATCH 02/24] arb_direct_state_access: glTextureSubImage*D test.

2014-12-19 Thread Laura Ekstrand
I just sent out a patch that simplifies this test a lot.

Laura

On Fri, Dec 19, 2014 at 9:47 AM, Laura Ekstrand 
wrote:

> I agree with you that DSA really needs minimal testing.  I used this test
> because it was a quick way to test most of the entry points in a trivial
> manner (but not so trivial as to not use any image data).  In my DSA
> patches, the DSA entry points share the same implementation as the
> traditional ones, so as long as the traditional functions are thoroughly
> tested, the DSA functions really just need to be called.
>
> Therefore, I'm inclined not to merge your changes into my
> texturesubimage.c test.  I will probably just fix that TEXTURE_3D error you
> found (thanks for pointing that out), and maybe scale the test back by
> removing the formats and other unneeded details.
>
> Thanks for pointing this out, and let me know if you have a better idea.
>
> Laura
>
> On Thu, Dec 18, 2014 at 1:29 PM, Neil Roberts 
> wrote:
>
>> Today I pushed some patches to the original version of this test which
>> change it quite a lot. Previously it updated a sub-region of the texture
>> with the exact same contents as were already in the texture so an
>> implementation that did nothing on glTexSubImage[123]D would actually
>> pass the test. It might be worth updating this test to the new version
>> otherwise it's really not testing very much and it doesn't test
>> glTextureSubImage3D at all.
>>
>> On the other hand I think testing textures with all possible formats
>> might be a bit overkill just for testing DSA and it's a shame to have so
>> much duplicated code. I wonder if it would be better to make a simpler
>> test that only tests one format and one target per function?
>>
>> http://cgit.freedesktop.org/piglit/commit/?id=5cfdc9d1d46fce911284576
>> http://cgit.freedesktop.org/piglit/commit/?id=8433c118dfa6f03f615724d
>> http://cgit.freedesktop.org/piglit/commit/?id=e4e88dfdb22be7b75150eae
>>
>> I've also just posted some patches today to test it with array textures
>> but I don't think it would make sense to apply those for DSA.
>>
>> Regards,
>> - Neil
>>
>> Laura Ekstrand  writes:
>>
>> > ---
>> >  tests/all.py   |   1 +
>> >  .../spec/arb_direct_state_access/CMakeLists.gl.txt |   1 +
>> >  .../spec/arb_direct_state_access/texturesubimage.c | 415
>> +
>> >  3 files changed, 417 insertions(+)
>> >  create mode 100644 tests/spec/arb_direct_state_access/texturesubimage.c
>> >
>> > diff --git a/tests/all.py b/tests/all.py
>> > index 84639c2..5ed0444 100644
>> > --- a/tests/all.py
>> > +++ b/tests/all.py
>> > @@ -4308,6 +4308,7 @@ import_glsl_parser_tests(arb_derivative_control,
>> >
>> >  spec['ARB_direct_state_access'] = {}
>> >  spec['ARB_direct_state_access']['dsa-textures'] =
>> PiglitGLTest('arb_direct_state_access-dsa-textures', run_concurrent=True)
>> > +spec['ARB_direct_state_access']['texturesubimage'] =
>> PiglitGLTest('arb_direct_state_access-texturesubimage', run_concurrent=True)
>> >
>> >  profile.tests['hiz'] = hiz
>> >  profile.tests['fast_color_clear'] = fast_color_clear
>> > diff --git a/tests/spec/arb_direct_state_access/CMakeLists.gl.txt
>> b/tests/spec/arb_direct_state_access/CMakeLists.gl.txt
>> > index cb0f7da..102579c 100644
>> > --- a/tests/spec/arb_direct_state_access/CMakeLists.gl.txt
>> > +++ b/tests/spec/arb_direct_state_access/CMakeLists.gl.txt
>> > @@ -10,4 +10,5 @@ link_libraries (
>> >  )
>> >
>> >  piglit_add_executable (arb_direct_state_access-dsa-textures
>> dsa-textures.c dsa-utils.c)
>> > +piglit_add_executable (arb_direct_state_access-dsa-texturesubimage
>> texturesubimage.c)
>> >  # vim: ft=cmake:
>> > diff --git a/tests/spec/arb_direct_state_access/texturesubimage.c
>> b/tests/spec/arb_direct_state_access/texturesubimage.c
>> > new file mode 100644
>> > index 000..b3a09e6
>> > --- /dev/null
>> > +++ b/tests/spec/arb_direct_state_access/texturesubimage.c
>> > @@ -0,0 +1,415 @@
>> > +/*
>> > + * Copyright © 2011 VMware, Inc.
>> > + * Copyright © 2014 Intel Corporation
>> > + *
>> > + * Permission is hereby granted, free of charge, to any person
>> obtaining a
>> > + * copy of this software and associated documentation files (the
>> "Software"),
>> > + * to deal in the Software without restriction, including without
>> limitation
>> > + * the rights to use, copy, modify, merge, publish, distribute,
>> sublicense,
>> > + * and/or sell copies of the Software, and to permit persons to whom
>> the
>> > + * Software is furnished to do so, subject to the following conditions:
>> > + *
>> > + * The above copyright notice and this permission notice (including
>> the next
>> > + * paragraph) shall be included in all copies or substantial portions
>> of the
>> > + * Software.
>> > + *
>> > + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
>> EXPRESS OR
>> > + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
>> MERCHANTABILITY,
>> > + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGE

[Piglit] [Patch v3] generated_tests: Actually catch exception in os.makedirs

2014-12-19 Thread Dylan Baker
Patch b59ff71eb was supposed to fix os.makedirs exceptions, but falls
short because of a missing else statement that causes all of the caught
exceptions to fall back to raise.

This corrects, it also pulls the duplicate functions out into a shared
module.

v2: - remove accidentally included hunk (Mark)
v3: - Actually include the modules directory in the commit (Mark)

Signed-off-by: Dylan Baker 
---
 generated_tests/gen_builtin_packing_tests.py   |  9 +
 generated_tests/gen_builtin_uniform_tests.py   | 12 ++
 generated_tests/gen_builtin_uniform_tests_fp64.py  | 12 ++
 generated_tests/gen_const_builtin_equal_tests.py   |  9 +
 generated_tests/gen_constant_array_size_tests.py   | 11 +-
 .../gen_constant_array_size_tests_fp64.py  | 11 +-
 generated_tests/gen_interpolation_tests.py | 11 +-
 generated_tests/gen_non-lvalue_tests.py|  4 +-
 generated_tests/gen_outerproduct_invalid_params.py |  9 +
 generated_tests/gen_outerproduct_tests.py  | 10 ++---
 generated_tests/gen_shader_bit_encoding_tests.py   |  9 +
 .../gen_shader_image_load_store_tests.py   | 10 ++---
 generated_tests/gen_texture_lod_tests.py   |  9 +
 generated_tests/gen_texture_query_lod_tests.py |  9 +
 generated_tests/gen_uniform_initializer_tests.py   | 12 ++
 generated_tests/generate-cl-store-tests.py | 10 ++---
 .../interpolation-qualifier-built-in-variable.py   |  9 +
 {tests => generated_tests/modules}/__init__.py |  0
 generated_tests/modules/utils.py   | 44 ++
 19 files changed, 84 insertions(+), 126 deletions(-)
 copy {tests => generated_tests/modules}/__init__.py (100%)
 create mode 100644 generated_tests/modules/utils.py

diff --git a/generated_tests/gen_builtin_packing_tests.py 
b/generated_tests/gen_builtin_packing_tests.py
index 5ca727a..901f493 100644
--- a/generated_tests/gen_builtin_packing_tests.py
+++ b/generated_tests/gen_builtin_packing_tests.py
@@ -43,6 +43,7 @@ from math import copysign, fabs, fmod, frexp, isinf, isnan, 
modf
 from numpy import int8, int16, uint8, uint16, uint32, float32
 
 from templates import template_dir
+from modules import utils
 
 TEMPLATES = template_dir(os.path.basename(os.path.splitext(__file__)[0]))
 
@@ -1027,13 +1028,7 @@ class ShaderTest(object):
 
 def write_file(self):
 dirname = os.path.dirname(self.filename)
-if not os.path.exists(dirname):
-try:
-os.makedirs(dirname)
-except OSError as e:
-if e.errno == 17:  # file exists
-pass
-raise
+utils.safe_makedirs(dirname)
 
 with open(self.filename, "w") as f:
 f.write(self.__template.render(func=self.__func_info))
diff --git a/generated_tests/gen_builtin_uniform_tests.py 
b/generated_tests/gen_builtin_uniform_tests.py
index d3a7816..9bb3075 100644
--- a/generated_tests/gen_builtin_uniform_tests.py
+++ b/generated_tests/gen_builtin_uniform_tests.py
@@ -52,6 +52,8 @@ import os
 import os.path
 import sys
 
+from modules import utils
+
 
 def compute_offset_and_scale(test_vectors):
 """Compute scale and offset values such that for each result in
@@ -537,15 +539,7 @@ class ShaderTest(object):
 shader_test += self.make_test()
 filename = self.filename()
 dirname = os.path.dirname(filename)
-
-if not os.path.exists(dirname):
-try:
-os.makedirs(dirname)
-except OSError as e:
-if e.errno == 17:  # file exists
-pass
-raise
-
+utils.safe_makedirs(dirname)
 with open(filename, 'w') as f:
 f.write(shader_test)
 
diff --git a/generated_tests/gen_builtin_uniform_tests_fp64.py 
b/generated_tests/gen_builtin_uniform_tests_fp64.py
index cf10c85..23032bd 100644
--- a/generated_tests/gen_builtin_uniform_tests_fp64.py
+++ b/generated_tests/gen_builtin_uniform_tests_fp64.py
@@ -52,6 +52,8 @@ import os
 import os.path
 import sys
 
+from modules import utils
+
 
 def compute_offset_and_scale(test_vectors):
 """Compute scale and offset values such that for each result in
@@ -507,15 +509,7 @@ class ShaderTest(object):
 shader_test += self.make_test()
 filename = self.filename()
 dirname = os.path.dirname(filename)
-
-if not os.path.exists(dirname):
-try:
-os.makedirs(dirname)
-except OSError as e:
-if e.errno == 17:  # file exists
-pass
-raise
-
+utils.safe_makedirs(dirname)
 with open(filename, 'w') as f:
 f.write(shader_test)
 
diff --git a/generated_tests/gen_const_builtin_equal_tests.py 
b/generated_tests/gen_const_builtin_equal_tests.py
index 490a591..47a238c 100644
--- a/generated_tests/gen_const_builtin_equal_tests.py
+++ b/generated_tests/gen_const_builtin_eq

[Piglit] [PATCH] arb_direct_state_access: Simplified texturesubimage test.

2014-12-19 Thread Laura Ekstrand
---
 .../spec/arb_direct_state_access/texturesubimage.c | 390 -
 1 file changed, 66 insertions(+), 324 deletions(-)

diff --git a/tests/spec/arb_direct_state_access/texturesubimage.c 
b/tests/spec/arb_direct_state_access/texturesubimage.c
index b3a09e6..9f3e0fb 100644
--- a/tests/spec/arb_direct_state_access/texturesubimage.c
+++ b/tests/spec/arb_direct_state_access/texturesubimage.c
@@ -25,363 +25,100 @@
 
 
 /**
- * This should expose any errors in texel addressing within a texture image
- * when calling glTextureSubImage1D/2D/3D().
+ * Test glTextureSubImage*D. This is pretty trivial, since it only uses
+ * glTextureSubImage*D with offsets of 0 and the width, height, and depth of
+ * the full image. Moreover, it doesn't test varying depths for the 3D case.
+ * But since DSA functions share backends with the non-DSA ones, we really
+ * only need to test entry points here.
  *
+ * Laura Ekstrand
+ * October 2014
+ *
+ * Based on texsubimage.c by
  * Brian Paul
  * October 2011
  *
- * Adapted for testing ARB_direct_state_access by
- * Laura Ekstrand
- * October 2014
  */
 
 
 #include "piglit-util-gl.h"
-#include "../fbo/fbo-formats.h"
+#include 
+#include 
 
 PIGLIT_GL_TEST_CONFIG_BEGIN
 
config.supports_gl_compat_version = 10;
 
-   config.window_visual = PIGLIT_GL_VISUAL_RGBA | PIGLIT_GL_VISUAL_DOUBLE;
+   config.window_visual = PIGLIT_GL_VISUAL_RGBA |
+  PIGLIT_GL_VISUAL_DOUBLE;
 
 PIGLIT_GL_TEST_CONFIG_END
 
-/**
- * This is a subset of the formats in fbo-formats.h
- * We don't test non-color, float, or int/uint textures at this time.
- */
-static const struct test_desc texsubimage_test_sets[] = {
-   {
-   core,
-   ARRAY_SIZE(core),
-   "Core formats",
-   GL_UNSIGNED_NORMALIZED,
-   },
-   {
-   tdfx_texture_compression_fxt1,
-   ARRAY_SIZE(tdfx_texture_compression_fxt1),
-   "GL_3DFX_texture_compression_FXT1",
-   GL_UNSIGNED_NORMALIZED,
-   {"GL_ARB_texture_compression",
-"GL_3DFX_texture_compression_FXT1"},
-   },
-   {
-   ext_texture_compression_s3tc,
-   ARRAY_SIZE(ext_texture_compression_s3tc),
-   "GL_EXT_texture_compression_s3tc",
-   GL_UNSIGNED_NORMALIZED,
-   {"GL_ARB_texture_compression",
-"GL_EXT_texture_compression_s3tc"},
-   },
-   {
-   ext_texture_compression_rgtc,
-   ARRAY_SIZE(ext_texture_compression_rgtc),
-   "GL_EXT_texture_compression_rgtc",
-   GL_UNSIGNED_NORMALIZED,
-   {"GL_EXT_texture_compression_rgtc"}
-   },
-   {
-   ext_texture_compression_latc,
-   ARRAY_SIZE(ext_texture_compression_latc),
-   "GL_EXT_texture_compression_latc",
-   GL_UNSIGNED_NORMALIZED,
-   {"GL_EXT_texture_compression_latc"}
-   }
-};
-
-
-/**
- * XXX add this to piglit-util if useful elsewhere.
- */
-static GLvoid
-piglit_draw_rect_tex3d(float x, float y, float w, float h,
-  float tx, float ty, float tw, float th,
-  float tz0, float tz1)
+GLubyte*
+random_image_data(int width, int height, int depth)
 {
-   float verts[4][4];
-   float tex[4][3];
-
-   verts[0][0] = x;
-   verts[0][1] = y;
-   verts[0][2] = 0.0;
-   verts[0][3] = 1.0;
-   tex[0][0] = tx;
-   tex[0][1] = ty;
-   tex[0][2] = tz0;
-   verts[1][0] = x + w;
-   verts[1][1] = y;
-   verts[1][2] = 0.0;
-   verts[1][3] = 1.0;
-   tex[1][0] = tx + tw;
-   tex[1][1] = ty;
-   tex[1][2] = tz1;
-   verts[2][0] = x + w;
-   verts[2][1] = y + h;
-   verts[2][2] = 0.0;
-   verts[2][3] = 1.0;
-   tex[2][0] = tx + tw;
-   tex[2][1] = ty + th;
-   tex[2][2] = tz1;
-   verts[3][0] = x;
-   verts[3][1] = y + h;
-   verts[3][2] = 0.0;
-   verts[3][3] = 1.0;
-   tex[3][0] = tx;
-   tex[3][1] = ty + th;
-   tex[3][2] = tz0;
-
-   glVertexPointer(4, GL_FLOAT, 0, verts);
-   glTexCoordPointer(3, GL_FLOAT, 0, tex);
-   glEnableClientState(GL_VERTEX_ARRAY);
-   glEnableClientState(GL_TEXTURE_COORD_ARRAY);
-
-   glDrawArrays(GL_QUADS, 0, 4);
-
-   glDisableClientState(GL_VERTEX_ARRAY);
-   glDisableClientState(GL_TEXTURE_COORD_ARRAY);
-}
-
-
-static GLboolean
-equal_images(const GLubyte *img1, const GLubyte *img2,
- GLuint w, GLuint h)
-{
-   return memcmp(img1, img2, w*h*4) == 0;
-}
-
-
-/**
- * Get block size for compressed format.
- * \return GL_TRUE if format is compressed, GL_FALSE otherwise
- * XXX this could be a piglit util function if useful elsewhere.
- */
-static GLboolean
-get_format_block_size(GLenum format, GLuint *bw, GLuint *bh)
-{
-   switch (format) {
-   case GL_COMPRESSED_RGB_FXT1_3DFX:
-   case GL_COMPR

Re: [Piglit] [Patch v2] generated_tests: Actually catch exception in os.makedirs

2014-12-19 Thread Dylan Baker
Sigh.  

Well, the good news is I just forgot to check it in and it's sitting
safe and sound in my tree.

I'll send a v3.

On Friday, December 19, 2014 12:42:11 PM Mark Janes wrote:
> It looks like this patch omits the utils.py module which is being
> called.
> 
> This would have been hard to spot in a build-test, because the pyc from
> your previous patch was still in place.
> 
> -Mark
> Dylan Baker  writes:
> 
> > Patch b59ff71eb was supposed to fix os.makedirs exceptions, but falls
> > short because of a missing else statement that causes all of the caught
> > exceptions to fall back to raise.
> >
> > This corrects, it also pulls the duplicate functions out into a shared
> > module.
> >
> > v2: - remove accidentally included hunk (Mark)
> >
> > Signed-off-by: Dylan Baker 
> > ---
> >  generated_tests/gen_builtin_packing_tests.py |  9 ++---
> >  generated_tests/gen_builtin_uniform_tests.py | 12 
> > +++-
> >  generated_tests/gen_builtin_uniform_tests_fp64.py| 12 
> > +++-
> >  generated_tests/gen_const_builtin_equal_tests.py |  9 ++---
> >  generated_tests/gen_constant_array_size_tests.py | 11 
> > ++-
> >  generated_tests/gen_constant_array_size_tests_fp64.py| 11 
> > ++-
> >  generated_tests/gen_interpolation_tests.py   | 11 
> > ++-
> >  generated_tests/gen_non-lvalue_tests.py  |  4 ++--
> >  generated_tests/gen_outerproduct_invalid_params.py   |  9 ++---
> >  generated_tests/gen_outerproduct_tests.py| 10 
> > +++---
> >  generated_tests/gen_shader_bit_encoding_tests.py |  9 ++---
> >  generated_tests/gen_shader_image_load_store_tests.py | 10 
> > +++---
> >  generated_tests/gen_texture_lod_tests.py |  9 ++---
> >  generated_tests/gen_texture_query_lod_tests.py   |  9 ++---
> >  generated_tests/gen_uniform_initializer_tests.py | 12 
> > +++-
> >  generated_tests/generate-cl-store-tests.py   | 10 
> > +++---
> >  generated_tests/interpolation-qualifier-built-in-variable.py |  9 ++---
> >  17 files changed, 40 insertions(+), 126 deletions(-)
> >
> > diff --git a/generated_tests/gen_builtin_packing_tests.py 
> > b/generated_tests/gen_builtin_packing_tests.py
> > index 5ca727a..901f493 100644
> > --- a/generated_tests/gen_builtin_packing_tests.py
> > +++ b/generated_tests/gen_builtin_packing_tests.py
> > @@ -43,6 +43,7 @@ from math import copysign, fabs, fmod, frexp, isinf, 
> > isnan, modf
> >  from numpy import int8, int16, uint8, uint16, uint32, float32
> >  
> >  from templates import template_dir
> > +from modules import utils
> >  
> >  TEMPLATES = template_dir(os.path.basename(os.path.splitext(__file__)[0]))
> >  
> > @@ -1027,13 +1028,7 @@ class ShaderTest(object):
> >  
> >  def write_file(self):
> >  dirname = os.path.dirname(self.filename)
> > -if not os.path.exists(dirname):
> > -try:
> > -os.makedirs(dirname)
> > -except OSError as e:
> > -if e.errno == 17:  # file exists
> > -pass
> > -raise
> > +utils.safe_makedirs(dirname)
> >  
> >  with open(self.filename, "w") as f:
> >  f.write(self.__template.render(func=self.__func_info))
> > diff --git a/generated_tests/gen_builtin_uniform_tests.py 
> > b/generated_tests/gen_builtin_uniform_tests.py
> > index d3a7816..9bb3075 100644
> > --- a/generated_tests/gen_builtin_uniform_tests.py
> > +++ b/generated_tests/gen_builtin_uniform_tests.py
> > @@ -52,6 +52,8 @@ import os
> >  import os.path
> >  import sys
> >  
> > +from modules import utils
> > +
> >  
> >  def compute_offset_and_scale(test_vectors):
> >  """Compute scale and offset values such that for each result in
> > @@ -537,15 +539,7 @@ class ShaderTest(object):
> >  shader_test += self.make_test()
> >  filename = self.filename()
> >  dirname = os.path.dirname(filename)
> > -
> > -if not os.path.exists(dirname):
> > -try:
> > -os.makedirs(dirname)
> > -except OSError as e:
> > -if e.errno == 17:  # file exists
> > -pass
> > -raise
> > -
> > +utils.safe_makedirs(dirname)
> >  with open(filename, 'w') as f:
> >  f.write(shader_test)
> >  
> > diff --git a/generated_tests/gen_builtin_uniform_tests_fp64.py 
> > b/generated_tests/gen_builtin_uniform_tests_fp64.py
> > index cf10c85..23032bd 100644
> > --- a/generated_tests/gen_builtin_uniform_tests_fp64.py
> > +++ b/generated_tests/gen_builtin_uniform_tests_fp64.py
> > @@ -52,6 +52,8 @@ import os
> >  import os.path
> >  import sys
> >  
> > +from modules import utils
> > +
> >  
> >  def compute_offset_and_scale(test_vectors):
> >  """Compute scale 

Re: [Piglit] [Patch v2] generated_tests: Actually catch exception in os.makedirs

2014-12-19 Thread Mark Janes
It looks like this patch omits the utils.py module which is being
called.

This would have been hard to spot in a build-test, because the pyc from
your previous patch was still in place.

-Mark
Dylan Baker  writes:

> Patch b59ff71eb was supposed to fix os.makedirs exceptions, but falls
> short because of a missing else statement that causes all of the caught
> exceptions to fall back to raise.
>
> This corrects, it also pulls the duplicate functions out into a shared
> module.
>
> v2: - remove accidentally included hunk (Mark)
>
> Signed-off-by: Dylan Baker 
> ---
>  generated_tests/gen_builtin_packing_tests.py |  9 ++---
>  generated_tests/gen_builtin_uniform_tests.py | 12 
> +++-
>  generated_tests/gen_builtin_uniform_tests_fp64.py| 12 
> +++-
>  generated_tests/gen_const_builtin_equal_tests.py |  9 ++---
>  generated_tests/gen_constant_array_size_tests.py | 11 ++-
>  generated_tests/gen_constant_array_size_tests_fp64.py| 11 ++-
>  generated_tests/gen_interpolation_tests.py   | 11 ++-
>  generated_tests/gen_non-lvalue_tests.py  |  4 ++--
>  generated_tests/gen_outerproduct_invalid_params.py   |  9 ++---
>  generated_tests/gen_outerproduct_tests.py| 10 +++---
>  generated_tests/gen_shader_bit_encoding_tests.py |  9 ++---
>  generated_tests/gen_shader_image_load_store_tests.py | 10 +++---
>  generated_tests/gen_texture_lod_tests.py |  9 ++---
>  generated_tests/gen_texture_query_lod_tests.py   |  9 ++---
>  generated_tests/gen_uniform_initializer_tests.py | 12 
> +++-
>  generated_tests/generate-cl-store-tests.py   | 10 +++---
>  generated_tests/interpolation-qualifier-built-in-variable.py |  9 ++---
>  17 files changed, 40 insertions(+), 126 deletions(-)
>
> diff --git a/generated_tests/gen_builtin_packing_tests.py 
> b/generated_tests/gen_builtin_packing_tests.py
> index 5ca727a..901f493 100644
> --- a/generated_tests/gen_builtin_packing_tests.py
> +++ b/generated_tests/gen_builtin_packing_tests.py
> @@ -43,6 +43,7 @@ from math import copysign, fabs, fmod, frexp, isinf, isnan, 
> modf
>  from numpy import int8, int16, uint8, uint16, uint32, float32
>  
>  from templates import template_dir
> +from modules import utils
>  
>  TEMPLATES = template_dir(os.path.basename(os.path.splitext(__file__)[0]))
>  
> @@ -1027,13 +1028,7 @@ class ShaderTest(object):
>  
>  def write_file(self):
>  dirname = os.path.dirname(self.filename)
> -if not os.path.exists(dirname):
> -try:
> -os.makedirs(dirname)
> -except OSError as e:
> -if e.errno == 17:  # file exists
> -pass
> -raise
> +utils.safe_makedirs(dirname)
>  
>  with open(self.filename, "w") as f:
>  f.write(self.__template.render(func=self.__func_info))
> diff --git a/generated_tests/gen_builtin_uniform_tests.py 
> b/generated_tests/gen_builtin_uniform_tests.py
> index d3a7816..9bb3075 100644
> --- a/generated_tests/gen_builtin_uniform_tests.py
> +++ b/generated_tests/gen_builtin_uniform_tests.py
> @@ -52,6 +52,8 @@ import os
>  import os.path
>  import sys
>  
> +from modules import utils
> +
>  
>  def compute_offset_and_scale(test_vectors):
>  """Compute scale and offset values such that for each result in
> @@ -537,15 +539,7 @@ class ShaderTest(object):
>  shader_test += self.make_test()
>  filename = self.filename()
>  dirname = os.path.dirname(filename)
> -
> -if not os.path.exists(dirname):
> -try:
> -os.makedirs(dirname)
> -except OSError as e:
> -if e.errno == 17:  # file exists
> -pass
> -raise
> -
> +utils.safe_makedirs(dirname)
>  with open(filename, 'w') as f:
>  f.write(shader_test)
>  
> diff --git a/generated_tests/gen_builtin_uniform_tests_fp64.py 
> b/generated_tests/gen_builtin_uniform_tests_fp64.py
> index cf10c85..23032bd 100644
> --- a/generated_tests/gen_builtin_uniform_tests_fp64.py
> +++ b/generated_tests/gen_builtin_uniform_tests_fp64.py
> @@ -52,6 +52,8 @@ import os
>  import os.path
>  import sys
>  
> +from modules import utils
> +
>  
>  def compute_offset_and_scale(test_vectors):
>  """Compute scale and offset values such that for each result in
> @@ -507,15 +509,7 @@ class ShaderTest(object):
>  shader_test += self.make_test()
>  filename = self.filename()
>  dirname = os.path.dirname(filename)
> -
> -if not os.path.exists(dirname):
> -try:
> -os.makedirs(dirname)
> -except OSError as e:
> -if e.errno == 17:  # file exists
> -pa

Re: [Piglit] [PATCH v2] cl: add clLinkProgram test

2014-12-19 Thread Tom Stellard
On Fri, Dec 19, 2014 at 02:39:06PM +0100, EdB wrote:
> v2:
> Use piglit_cl_get_program_build_info instead of piglit_cl_get_program_info,
> I was expected it to fail so I didn't paid attention.
> 
> Remove "-invalid- --link-- options" on CL_INVALID_OPERATION test.

Reviewed-by: Tom Stellard 

> ---
>  tests/cl/api/CMakeLists.cl.txt |   1 +
>  tests/cl/api/link-program.c| 394 
> +
>  2 files changed, 395 insertions(+)
>  create mode 100644 tests/cl/api/link-program.c
> 
> diff --git a/tests/cl/api/CMakeLists.cl.txt b/tests/cl/api/CMakeLists.cl.txt
> index 7e78491..b598528 100644
> --- a/tests/cl/api/CMakeLists.cl.txt
> +++ b/tests/cl/api/CMakeLists.cl.txt
> @@ -31,6 +31,7 @@ piglit_cl_add_api_test (create-program-with-source 
> create-program-with-source.c)
>  piglit_cl_add_api_test (retain_release-program retain_release-program.c)
>  piglit_cl_add_api_test (build-program build-program.c)
>  piglit_cl_add_api_test (compile-program compile-program.c)
> +piglit_cl_add_api_test (link-program link-program.c)
>  piglit_cl_add_api_test (unload-compiler unload-compiler.c)
>  piglit_cl_add_api_test (get-program-info get-program-info.c)
>  piglit_cl_add_api_test (get-program-build-info get-program-build-info.c)
> diff --git a/tests/cl/api/link-program.c b/tests/cl/api/link-program.c
> new file mode 100644
> index 000..e98f428
> --- /dev/null
> +++ b/tests/cl/api/link-program.c
> @@ -0,0 +1,394 @@
> +/*
> + * Copyright © 2014 EdB 
> + *
> + * Permission is hereby granted, free of charge, to any person obtaining a
> + * copy of this software and associated documentation files (the "Software"),
> + * to deal in the Software without restriction, including without limitation
> + * the rights to use, copy, modify, merge, publish, distribute, sublicense,
> + * and/or sell copies of the Software, and to permit persons to whom the
> + * Software is furnished to do so, subject to the following conditions:
> + *
> + * The above copyright notice and this permission notice (including the next
> + * paragraph) shall be included in all copies or substantial portions of the
> + * Software.
> + *
> + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
> + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
> + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
> + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
> + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
> + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
> + * DEALINGS IN THE SOFTWARE.
> + */
> +
> +/**
> + * @file link-program.c
> + *
> + * Test API function:
> + *
> + *   cl_program
> + *   clLinkProgram(cl_context context,
> + * cl_uint num_devices, const cl_device_id device_list,
> + * const char *options,
> + * cl_uint num_input_programs, const cl_program *input_programs,
> + * void (CL_CALLBACK *pfn_notify)(cl_program program, void 
> *user_data),
> + * void *user_data,
> + * cl_int *errcode_ret)
> + */
> +
> +#include "piglit-framework-cl-api.h"
> +
> +
> +PIGLIT_CL_API_TEST_CONFIG_BEGIN
> +
> + config.name = "clLinkProgram";
> + config.version_min = 12;
> +
> + config.run_per_platform = true;
> + config.create_context = true;
> +
> +PIGLIT_CL_API_TEST_CONFIG_END
> +
> +
> +const char* strings[] = {
> + "int get_number() { return 42; }",
> + "int get_number();\n",
> + "kernel void test_kernel() { int i = get_number(); }",
> + "int get_number() { return 0; }"
> +};
> +
> +#if defined(CL_VERSION_1_2)
> +static cl_program
> +compile_program(cl_context context,
> +cl_uint num_devices, const cl_device_id *device_list,
> +cl_uint count, const char **strings,
> +const char* err_str) {
> + cl_int errNo;
> + cl_program program;
> +
> + /* Create program with source */
> + program = clCreateProgramWithSource(context,
> + count,
> + strings,
> + NULL,
> + &errNo);
> + if(!piglit_cl_check_error(errNo, CL_SUCCESS)) {
> + fprintf(stderr,
> + "Failed (error code: %s): Create program with source 
> (for the %s).\n",
> + piglit_cl_get_error_name(errNo), err_str);
> + return NULL;
> + }
> +
> + /* Compile program */
> + errNo = clCompileProgram(program,
> +num_devices, device_list,
> +" ",
> +0, NULL, NULL,
> +NULL, NULL);
> +
> + if(!piglit_cl_check_error(errNo, CL_SUCCESS)) {
> + fprintf(stderr, "Failed (error code: %s): Compile program (for 
> the %s).\n",
> + piglit_

Re: [Piglit] [Patch v2] generated_tests: Actually catch exception in os.makedirs

2014-12-19 Thread Dylan Baker
Sorry Mark, in got my in-reply-to and cc flags backwards, I meant to cc
you on this.

On Wednesday, December 17, 2014 03:33:53 PM Dylan Baker wrote:
> Patch b59ff71eb was supposed to fix os.makedirs exceptions, but falls
> short because of a missing else statement that causes all of the caught
> exceptions to fall back to raise.
> 
> This corrects, it also pulls the duplicate functions out into a shared
> module.
> 
> v2: - remove accidentally included hunk (Mark)
> 
> Signed-off-by: Dylan Baker 
> ---
>  generated_tests/gen_builtin_packing_tests.py |  9 ++---
>  generated_tests/gen_builtin_uniform_tests.py | 12 
> +++-
>  generated_tests/gen_builtin_uniform_tests_fp64.py| 12 
> +++-
>  generated_tests/gen_const_builtin_equal_tests.py |  9 ++---
>  generated_tests/gen_constant_array_size_tests.py | 11 ++-
>  generated_tests/gen_constant_array_size_tests_fp64.py| 11 ++-
>  generated_tests/gen_interpolation_tests.py   | 11 ++-
>  generated_tests/gen_non-lvalue_tests.py  |  4 ++--
>  generated_tests/gen_outerproduct_invalid_params.py   |  9 ++---
>  generated_tests/gen_outerproduct_tests.py| 10 +++---
>  generated_tests/gen_shader_bit_encoding_tests.py |  9 ++---
>  generated_tests/gen_shader_image_load_store_tests.py | 10 +++---
>  generated_tests/gen_texture_lod_tests.py |  9 ++---
>  generated_tests/gen_texture_query_lod_tests.py   |  9 ++---
>  generated_tests/gen_uniform_initializer_tests.py | 12 
> +++-
>  generated_tests/generate-cl-store-tests.py   | 10 +++---
>  generated_tests/interpolation-qualifier-built-in-variable.py |  9 ++---
>  17 files changed, 40 insertions(+), 126 deletions(-)
> 
> diff --git a/generated_tests/gen_builtin_packing_tests.py 
> b/generated_tests/gen_builtin_packing_tests.py
> index 5ca727a..901f493 100644
> --- a/generated_tests/gen_builtin_packing_tests.py
> +++ b/generated_tests/gen_builtin_packing_tests.py
> @@ -43,6 +43,7 @@ from math import copysign, fabs, fmod, frexp, isinf, isnan, 
> modf
>  from numpy import int8, int16, uint8, uint16, uint32, float32
>  
>  from templates import template_dir
> +from modules import utils
>  
>  TEMPLATES = template_dir(os.path.basename(os.path.splitext(__file__)[0]))
>  
> @@ -1027,13 +1028,7 @@ class ShaderTest(object):
>  
>  def write_file(self):
>  dirname = os.path.dirname(self.filename)
> -if not os.path.exists(dirname):
> -try:
> -os.makedirs(dirname)
> -except OSError as e:
> -if e.errno == 17:  # file exists
> -pass
> -raise
> +utils.safe_makedirs(dirname)
>  
>  with open(self.filename, "w") as f:
>  f.write(self.__template.render(func=self.__func_info))
> diff --git a/generated_tests/gen_builtin_uniform_tests.py 
> b/generated_tests/gen_builtin_uniform_tests.py
> index d3a7816..9bb3075 100644
> --- a/generated_tests/gen_builtin_uniform_tests.py
> +++ b/generated_tests/gen_builtin_uniform_tests.py
> @@ -52,6 +52,8 @@ import os
>  import os.path
>  import sys
>  
> +from modules import utils
> +
>  
>  def compute_offset_and_scale(test_vectors):
>  """Compute scale and offset values such that for each result in
> @@ -537,15 +539,7 @@ class ShaderTest(object):
>  shader_test += self.make_test()
>  filename = self.filename()
>  dirname = os.path.dirname(filename)
> -
> -if not os.path.exists(dirname):
> -try:
> -os.makedirs(dirname)
> -except OSError as e:
> -if e.errno == 17:  # file exists
> -pass
> -raise
> -
> +utils.safe_makedirs(dirname)
>  with open(filename, 'w') as f:
>  f.write(shader_test)
>  
> diff --git a/generated_tests/gen_builtin_uniform_tests_fp64.py 
> b/generated_tests/gen_builtin_uniform_tests_fp64.py
> index cf10c85..23032bd 100644
> --- a/generated_tests/gen_builtin_uniform_tests_fp64.py
> +++ b/generated_tests/gen_builtin_uniform_tests_fp64.py
> @@ -52,6 +52,8 @@ import os
>  import os.path
>  import sys
>  
> +from modules import utils
> +
>  
>  def compute_offset_and_scale(test_vectors):
>  """Compute scale and offset values such that for each result in
> @@ -507,15 +509,7 @@ class ShaderTest(object):
>  shader_test += self.make_test()
>  filename = self.filename()
>  dirname = os.path.dirname(filename)
> -
> -if not os.path.exists(dirname):
> -try:
> -os.makedirs(dirname)
> -except OSError as e:
> -if e.errno == 17:  # file exists
> -pass
> -raise
> -
> +utils.safe_makedirs(

Re: [Piglit] [PATCH] arb_shader_precision: add tests for floating point precision

2014-12-19 Thread Dylan Baker
I have a few little things, but they're pretty small. With my requested
changes you have my rb on the python portion. You should probably still
try to get someone who understands GL better than I do to review the
actual tests.

Reviewed-by: Dylan Baker 

On Friday, December 19, 2014 11:01:05 AM Micah Fedke wrote:
> This generated_tests script creates a suite of tests that measure the
> floating point precision of most GLSL built-ins, according to
> ARB_shader_precision.  Test vectors come from builtin_function.py, but
> are filtered down to avoid non-float types.
> 
> These tests are reporting precision errors in ceil, cross, degrees,
> distance, inverse, mix, mod, normalize, op-assign-div, op-assign-mult,
> op-div, op-mult, reflect, refract and smoothstep on Ivybridge.
> 
> ---
> 
> Updates since previous (RFC v5):
> 
> RFC ended, now submitting as a patch
> 
> Suppressed the use of repr() in the generator
>   - python's repr() does not output enough digits to uniquely
> represent a 32 bit float value - the {0:1.8e} format is 
> used instead
> 
> Eliminated the use of distance() for ulps calculations
>   - this was producing an imprecise result in some situations
> 
> Updated the list of failing functions in the description
> 
> 
> Note: I am new to the project and don't have commit access.
> 
>  generated_tests/CMakeLists.txt |  10 +-
>  generated_tests/gen_shader_precision_tests.py  | 159 
> +
>  generated_tests/shader_precision_templates/fs.mako | 127 
>  generated_tests/shader_precision_templates/gs.mako | 140 ++
>  generated_tests/shader_precision_templates/vs.mako | 136 ++
>  5 files changed, 571 insertions(+), 1 deletion(-)
>  create mode 100644 generated_tests/gen_shader_precision_tests.py
>  create mode 100644 generated_tests/shader_precision_templates/fs.mako
>  create mode 100644 generated_tests/shader_precision_templates/gs.mako
>  create mode 100644 generated_tests/shader_precision_templates/vs.mako
> 
> diff --git a/generated_tests/CMakeLists.txt b/generated_tests/CMakeLists.txt
> index 6d27b3e..77ee06c 100644
> --- a/generated_tests/CMakeLists.txt
> +++ b/generated_tests/CMakeLists.txt
> @@ -91,6 +91,13 @@ piglit_make_generated_tests(
>   constant_array_size_tests_fp64.list
>   gen_constant_array_size_tests_fp64.py
>   builtin_function_fp64.py)
> +piglit_make_generated_tests(
> + shader_precision_tests.list
> + gen_shader_precision_tests.py
> + builtin_function.py
> + shader_precision_templates/vs.mako
> + shader_precision_templates/fs.mako
> + shader_precision_templates/gs.mako)

Can you move these to templates// like most
of the other generators have? You might also want to have a look at said
generators for the helpers they use for getting templates.

>  
>  # Add a "gen-tests" target that can be used to generate all the
>  # tests without doing any other compilation.
> @@ -113,4 +120,5 @@ add_custom_target(gen-tests ALL
>   uniform-initializer_tests.list
>   interpolation-qualifier-built-in-variable.list
>   builtin_uniform_tests_fp64.list
> - constant_array_size_tests_fp64.list)
> + constant_array_size_tests_fp64.list
> + shader_precision_tests.list)
> diff --git a/generated_tests/gen_shader_precision_tests.py 
> b/generated_tests/gen_shader_precision_tests.py
> new file mode 100644
> index 000..2eab2b0
> --- /dev/null
> +++ b/generated_tests/gen_shader_precision_tests.py
> @@ -0,0 +1,159 @@
> +# coding=utf-8
> +#
> +# Copyright © 2014 Intel Corporation
> +#
> +# Permission is hereby granted, free of charge, to any person obtaining a
> +# copy of this software and associated documentation files (the "Software"),
> +# to deal in the Software without restriction, including without limitation
> +# the rights to use, copy, modify, merge, publish, distribute, sublicense,
> +# and/or sell copies of the Software, and to permit persons to whom the
> +# Software is furnished to do so, subject to the following conditions:
> +#
> +# The above copyright notice and this permission notice (including the next
> +# paragraph) shall be included in all copies or substantial portions of the
> +# Software.
> +#
> +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
> +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
> +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
> +# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
> +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
> +# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
> +# DEALINGS IN THE SOFTWARE.
> +
> +
> +"""Generate a set of shader_runner tests for overloaded versions of every
> + built-in function specified in arb_shader_precision, based on the test
> + vectors computed by builtin_function.p

Re: [Piglit] [PATCH 02/24] arb_direct_state_access: glTextureSubImage*D test.

2014-12-19 Thread Laura Ekstrand
I agree with you that DSA really needs minimal testing.  I used this test
because it was a quick way to test most of the entry points in a trivial
manner (but not so trivial as to not use any image data).  In my DSA
patches, the DSA entry points share the same implementation as the
traditional ones, so as long as the traditional functions are thoroughly
tested, the DSA functions really just need to be called.

Therefore, I'm inclined not to merge your changes into my texturesubimage.c
test.  I will probably just fix that TEXTURE_3D error you found (thanks for
pointing that out), and maybe scale the test back by removing the formats
and other unneeded details.

Thanks for pointing this out, and let me know if you have a better idea.

Laura

On Thu, Dec 18, 2014 at 1:29 PM, Neil Roberts  wrote:

> Today I pushed some patches to the original version of this test which
> change it quite a lot. Previously it updated a sub-region of the texture
> with the exact same contents as were already in the texture so an
> implementation that did nothing on glTexSubImage[123]D would actually
> pass the test. It might be worth updating this test to the new version
> otherwise it's really not testing very much and it doesn't test
> glTextureSubImage3D at all.
>
> On the other hand I think testing textures with all possible formats
> might be a bit overkill just for testing DSA and it's a shame to have so
> much duplicated code. I wonder if it would be better to make a simpler
> test that only tests one format and one target per function?
>
> http://cgit.freedesktop.org/piglit/commit/?id=5cfdc9d1d46fce911284576
> http://cgit.freedesktop.org/piglit/commit/?id=8433c118dfa6f03f615724d
> http://cgit.freedesktop.org/piglit/commit/?id=e4e88dfdb22be7b75150eae
>
> I've also just posted some patches today to test it with array textures
> but I don't think it would make sense to apply those for DSA.
>
> Regards,
> - Neil
>
> Laura Ekstrand  writes:
>
> > ---
> >  tests/all.py   |   1 +
> >  .../spec/arb_direct_state_access/CMakeLists.gl.txt |   1 +
> >  .../spec/arb_direct_state_access/texturesubimage.c | 415
> +
> >  3 files changed, 417 insertions(+)
> >  create mode 100644 tests/spec/arb_direct_state_access/texturesubimage.c
> >
> > diff --git a/tests/all.py b/tests/all.py
> > index 84639c2..5ed0444 100644
> > --- a/tests/all.py
> > +++ b/tests/all.py
> > @@ -4308,6 +4308,7 @@ import_glsl_parser_tests(arb_derivative_control,
> >
> >  spec['ARB_direct_state_access'] = {}
> >  spec['ARB_direct_state_access']['dsa-textures'] =
> PiglitGLTest('arb_direct_state_access-dsa-textures', run_concurrent=True)
> > +spec['ARB_direct_state_access']['texturesubimage'] =
> PiglitGLTest('arb_direct_state_access-texturesubimage', run_concurrent=True)
> >
> >  profile.tests['hiz'] = hiz
> >  profile.tests['fast_color_clear'] = fast_color_clear
> > diff --git a/tests/spec/arb_direct_state_access/CMakeLists.gl.txt
> b/tests/spec/arb_direct_state_access/CMakeLists.gl.txt
> > index cb0f7da..102579c 100644
> > --- a/tests/spec/arb_direct_state_access/CMakeLists.gl.txt
> > +++ b/tests/spec/arb_direct_state_access/CMakeLists.gl.txt
> > @@ -10,4 +10,5 @@ link_libraries (
> >  )
> >
> >  piglit_add_executable (arb_direct_state_access-dsa-textures
> dsa-textures.c dsa-utils.c)
> > +piglit_add_executable (arb_direct_state_access-dsa-texturesubimage
> texturesubimage.c)
> >  # vim: ft=cmake:
> > diff --git a/tests/spec/arb_direct_state_access/texturesubimage.c
> b/tests/spec/arb_direct_state_access/texturesubimage.c
> > new file mode 100644
> > index 000..b3a09e6
> > --- /dev/null
> > +++ b/tests/spec/arb_direct_state_access/texturesubimage.c
> > @@ -0,0 +1,415 @@
> > +/*
> > + * Copyright © 2011 VMware, Inc.
> > + * Copyright © 2014 Intel Corporation
> > + *
> > + * Permission is hereby granted, free of charge, to any person
> obtaining a
> > + * copy of this software and associated documentation files (the
> "Software"),
> > + * to deal in the Software without restriction, including without
> limitation
> > + * the rights to use, copy, modify, merge, publish, distribute,
> sublicense,
> > + * and/or sell copies of the Software, and to permit persons to whom the
> > + * Software is furnished to do so, subject to the following conditions:
> > + *
> > + * The above copyright notice and this permission notice (including the
> next
> > + * paragraph) shall be included in all copies or substantial portions
> of the
> > + * Software.
> > + *
> > + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
> EXPRESS OR
> > + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
> MERCHANTABILITY,
> > + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT
> SHALL
> > + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
> OTHER
> > + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
> ARISING
> > + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE O

[Piglit] [PATCH] arb_shader_precision: add tests for floating point precision

2014-12-19 Thread Micah Fedke
This generated_tests script creates a suite of tests that measure the
floating point precision of most GLSL built-ins, according to
ARB_shader_precision.  Test vectors come from builtin_function.py, but
are filtered down to avoid non-float types.

These tests are reporting precision errors in ceil, cross, degrees,
distance, inverse, mix, mod, normalize, op-assign-div, op-assign-mult,
op-div, op-mult, reflect, refract and smoothstep on Ivybridge.

---

Updates since previous (RFC v5):

RFC ended, now submitting as a patch

Suppressed the use of repr() in the generator
  - python's repr() does not output enough digits to uniquely
represent a 32 bit float value - the {0:1.8e} format is 
used instead

Eliminated the use of distance() for ulps calculations
  - this was producing an imprecise result in some situations

Updated the list of failing functions in the description


Note: I am new to the project and don't have commit access.

 generated_tests/CMakeLists.txt |  10 +-
 generated_tests/gen_shader_precision_tests.py  | 159 +
 generated_tests/shader_precision_templates/fs.mako | 127 
 generated_tests/shader_precision_templates/gs.mako | 140 ++
 generated_tests/shader_precision_templates/vs.mako | 136 ++
 5 files changed, 571 insertions(+), 1 deletion(-)
 create mode 100644 generated_tests/gen_shader_precision_tests.py
 create mode 100644 generated_tests/shader_precision_templates/fs.mako
 create mode 100644 generated_tests/shader_precision_templates/gs.mako
 create mode 100644 generated_tests/shader_precision_templates/vs.mako

diff --git a/generated_tests/CMakeLists.txt b/generated_tests/CMakeLists.txt
index 6d27b3e..77ee06c 100644
--- a/generated_tests/CMakeLists.txt
+++ b/generated_tests/CMakeLists.txt
@@ -91,6 +91,13 @@ piglit_make_generated_tests(
constant_array_size_tests_fp64.list
gen_constant_array_size_tests_fp64.py
builtin_function_fp64.py)
+piglit_make_generated_tests(
+   shader_precision_tests.list
+   gen_shader_precision_tests.py
+   builtin_function.py
+   shader_precision_templates/vs.mako
+   shader_precision_templates/fs.mako
+   shader_precision_templates/gs.mako)
 
 # Add a "gen-tests" target that can be used to generate all the
 # tests without doing any other compilation.
@@ -113,4 +120,5 @@ add_custom_target(gen-tests ALL
uniform-initializer_tests.list
interpolation-qualifier-built-in-variable.list
builtin_uniform_tests_fp64.list
-   constant_array_size_tests_fp64.list)
+   constant_array_size_tests_fp64.list
+   shader_precision_tests.list)
diff --git a/generated_tests/gen_shader_precision_tests.py 
b/generated_tests/gen_shader_precision_tests.py
new file mode 100644
index 000..2eab2b0
--- /dev/null
+++ b/generated_tests/gen_shader_precision_tests.py
@@ -0,0 +1,159 @@
+# coding=utf-8
+#
+# Copyright © 2014 Intel Corporation
+#
+# Permission is hereby granted, free of charge, to any person obtaining a
+# copy of this software and associated documentation files (the "Software"),
+# to deal in the Software without restriction, including without limitation
+# the rights to use, copy, modify, merge, publish, distribute, sublicense,
+# and/or sell copies of the Software, and to permit persons to whom the
+# Software is furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice (including the next
+# paragraph) shall be included in all copies or substantial portions of the
+# Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
+# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+# DEALINGS IN THE SOFTWARE.
+
+
+"""Generate a set of shader_runner tests for overloaded versions of every
+ built-in function specified in arb_shader_precision, based on the test
+ vectors computed by builtin_function.py, and structured according to the mako
+ templates in shader_precision_templates/.
+
+ The vertex, geometry, and fragment shader types are exercised by each test.
+ In all cases, the inputs to the built-in functions come from uniforms, so
+ that the effectiveness of the test won't be circumvented by constant folding
+ in the GLSL compiler.
+
+ The tests operate by invoking the built-in function in the appropriate
+ shader, calculating any deviance from the expected value (in ulps), comparing
+ the deviance to a supplied tolerance (according to those specified in
+ arb_shader_precision), and then outputting the pass/fail result as a solid
+ rgba color wh

Re: [Piglit] [PATCH] arb_texture_buffer_object-formats: Initialize variable.

2014-12-19 Thread Brian Paul

On 12/18/2014 10:22 PM, Vinson Lee wrote:

Fix Clang Static Analyzer "Assigned value is garbage or undefined" bugs.

Signed-off-by: Vinson Lee 
---
  tests/spec/arb_texture_buffer_object/formats.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tests/spec/arb_texture_buffer_object/formats.c 
b/tests/spec/arb_texture_buffer_object/formats.c
index 81f494e..86f27f8 100644
--- a/tests/spec/arb_texture_buffer_object/formats.c
+++ b/tests/spec/arb_texture_buffer_object/formats.c
@@ -275,7 +275,7 @@ get_expected_f(const struct format *format, int sample, 
float *expected)
  static bool
  get_expected_i(const struct format *format, int sample, uint32_t *expected)
  {
-   uint32_t chans[4];
+   uint32_t chans[4] = { 0 };
int i;

for (i = 0; i < format->components; i++) {



Reviewed-by: Brian Paul 

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


[Piglit] [PATCH v2] cl: add clLinkProgram test

2014-12-19 Thread EdB
v2:
Use piglit_cl_get_program_build_info instead of piglit_cl_get_program_info,
I was expected it to fail so I didn't paid attention.

Remove "-invalid- --link-- options" on CL_INVALID_OPERATION test.
---
 tests/cl/api/CMakeLists.cl.txt |   1 +
 tests/cl/api/link-program.c| 394 +
 2 files changed, 395 insertions(+)
 create mode 100644 tests/cl/api/link-program.c

diff --git a/tests/cl/api/CMakeLists.cl.txt b/tests/cl/api/CMakeLists.cl.txt
index 7e78491..b598528 100644
--- a/tests/cl/api/CMakeLists.cl.txt
+++ b/tests/cl/api/CMakeLists.cl.txt
@@ -31,6 +31,7 @@ piglit_cl_add_api_test (create-program-with-source 
create-program-with-source.c)
 piglit_cl_add_api_test (retain_release-program retain_release-program.c)
 piglit_cl_add_api_test (build-program build-program.c)
 piglit_cl_add_api_test (compile-program compile-program.c)
+piglit_cl_add_api_test (link-program link-program.c)
 piglit_cl_add_api_test (unload-compiler unload-compiler.c)
 piglit_cl_add_api_test (get-program-info get-program-info.c)
 piglit_cl_add_api_test (get-program-build-info get-program-build-info.c)
diff --git a/tests/cl/api/link-program.c b/tests/cl/api/link-program.c
new file mode 100644
index 000..e98f428
--- /dev/null
+++ b/tests/cl/api/link-program.c
@@ -0,0 +1,394 @@
+/*
+ * Copyright © 2014 EdB 
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the next
+ * paragraph) shall be included in all copies or substantial portions of the
+ * Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
+ */
+
+/**
+ * @file link-program.c
+ *
+ * Test API function:
+ *
+ *   cl_program
+ *   clLinkProgram(cl_context context,
+ * cl_uint num_devices, const cl_device_id device_list,
+ * const char *options,
+ * cl_uint num_input_programs, const cl_program *input_programs,
+ * void (CL_CALLBACK *pfn_notify)(cl_program program, void *user_data),
+ * void *user_data,
+ * cl_int *errcode_ret)
+ */
+
+#include "piglit-framework-cl-api.h"
+
+
+PIGLIT_CL_API_TEST_CONFIG_BEGIN
+
+   config.name = "clLinkProgram";
+   config.version_min = 12;
+
+   config.run_per_platform = true;
+   config.create_context = true;
+
+PIGLIT_CL_API_TEST_CONFIG_END
+
+
+const char* strings[] = {
+   "int get_number() { return 42; }",
+   "int get_number();\n",
+   "kernel void test_kernel() { int i = get_number(); }",
+   "int get_number() { return 0; }"
+};
+
+#if defined(CL_VERSION_1_2)
+static cl_program
+compile_program(cl_context context,
+cl_uint num_devices, const cl_device_id *device_list,
+cl_uint count, const char **strings,
+const char* err_str) {
+   cl_int errNo;
+   cl_program program;
+
+   /* Create program with source */
+   program = clCreateProgramWithSource(context,
+   count,
+   strings,
+   NULL,
+   &errNo);
+   if(!piglit_cl_check_error(errNo, CL_SUCCESS)) {
+   fprintf(stderr,
+   "Failed (error code: %s): Create program with source 
(for the %s).\n",
+   piglit_cl_get_error_name(errNo), err_str);
+   return NULL;
+   }
+
+   /* Compile program */
+   errNo = clCompileProgram(program,
+  num_devices, device_list,
+  " ",
+  0, NULL, NULL,
+  NULL, NULL);
+
+   if(!piglit_cl_check_error(errNo, CL_SUCCESS)) {
+   fprintf(stderr, "Failed (error code: %s): Compile program (for 
the %s).\n",
+   piglit_cl_get_error_name(errNo), err_str);
+   clReleaseProgram(program);
+   return NULL;
+   }
+
+   return program;
+}
+
+static bool
+test(cl_context context,
+ cl_uint num_devices, const cl_device_id *device_list,
+ const char *option

[Piglit] [PATCH] cl: add clLinkProgram test

2014-12-19 Thread EdB
---
 tests/cl/api/CMakeLists.cl.txt |   1 +
 tests/cl/api/link-program.c| 386 +
 2 files changed, 387 insertions(+)
 create mode 100644 tests/cl/api/link-program.c

diff --git a/tests/cl/api/CMakeLists.cl.txt b/tests/cl/api/CMakeLists.cl.txt
index 7e78491..b598528 100644
--- a/tests/cl/api/CMakeLists.cl.txt
+++ b/tests/cl/api/CMakeLists.cl.txt
@@ -31,6 +31,7 @@ piglit_cl_add_api_test (create-program-with-source 
create-program-with-source.c)
 piglit_cl_add_api_test (retain_release-program retain_release-program.c)
 piglit_cl_add_api_test (build-program build-program.c)
 piglit_cl_add_api_test (compile-program compile-program.c)
+piglit_cl_add_api_test (link-program link-program.c)
 piglit_cl_add_api_test (unload-compiler unload-compiler.c)
 piglit_cl_add_api_test (get-program-info get-program-info.c)
 piglit_cl_add_api_test (get-program-build-info get-program-build-info.c)
diff --git a/tests/cl/api/link-program.c b/tests/cl/api/link-program.c
new file mode 100644
index 000..610aa8f
--- /dev/null
+++ b/tests/cl/api/link-program.c
@@ -0,0 +1,386 @@
+/*
+ * Copyright © 2014 EdB 
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the next
+ * paragraph) shall be included in all copies or substantial portions of the
+ * Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
+ */
+
+/**
+ * @file link-program.c
+ *
+ * Test API function:
+ *
+ *   cl_program
+ *   clLinkProgram(cl_context context,
+ * cl_uint num_devices, const cl_device_id device_list,
+ * const char *options,
+ * cl_uint num_input_programs, const cl_program *input_programs,
+ * void (CL_CALLBACK *pfn_notify)(cl_program program, void *user_data),
+ * void *user_data,
+ * cl_int *errcode_ret)
+ */
+
+#include "piglit-framework-cl-api.h"
+
+
+PIGLIT_CL_API_TEST_CONFIG_BEGIN
+
+   config.name = "clLinkProgram";
+   config.version_min = 12;
+
+   config.run_per_platform = true;
+   config.create_context = true;
+
+PIGLIT_CL_API_TEST_CONFIG_END
+
+
+const char* strings[] = {
+   "int get_number() { return 42; }",
+   "int get_number();\n",
+   "kernel void test_kernel() { int i = get_number(); }",
+   "int get_number() { return 0; }"
+};
+
+#if defined(CL_VERSION_1_2)
+static cl_program
+compile_program(cl_context context,
+cl_uint num_devices, const cl_device_id *device_list,
+cl_uint count, const char **strings,
+const char* err_str) {
+   cl_int errNo;
+   cl_program program;
+
+   /* Create program with source */
+   program = clCreateProgramWithSource(context,
+   count,
+   strings,
+   NULL,
+   &errNo);
+   if(!piglit_cl_check_error(errNo, CL_SUCCESS)) {
+   fprintf(stderr,
+   "Failed (error code: %s): Create program with source 
(for the %s).\n",
+   piglit_cl_get_error_name(errNo), err_str);
+   return NULL;
+   }
+
+   /* Compile program */
+   errNo = clCompileProgram(program,
+  num_devices, device_list,
+  " ",
+  0, NULL, NULL,
+  NULL, NULL);
+
+   if(!piglit_cl_check_error(errNo, CL_SUCCESS)) {
+   fprintf(stderr, "Failed (error code: %s): Compile program (for 
the %s).\n",
+   piglit_cl_get_error_name(errNo), err_str);
+   clReleaseProgram(program);
+   return NULL;
+   }
+
+   return program;
+}
+
+static bool
+test(cl_context context,
+ cl_uint num_devices, const cl_device_id *device_list,
+ const char *options,
+ cl_uint num_input_programs, const cl_program *input_programs,
+ void (CL_CALLBACK *pfn_notify)(cl_program program, void *user_data),
+ void *user_data,
+ cl_program *ret_program,
+