[Piglit] [PATCH 1/2] sso: Add a rendezvous_by_location-3-stages test.

2015-09-11 Thread Kenneth Graunke
Having more than two stages makes SSO interface matching a lot more
interesting.  However, the five-stage variant won't run on i965 for
a while.  So, this patch adds a three-stage variant (VS/GS/FS, but
no tessellation).

Beyond that, this test is a little meaner: I made the VS have more
outputs than the GS has inputs, with the locations specified to have a
gap.  An implementation that lays out VS outputs and GS inputs
contiguously would fail; they have to match up properly.

Signed-off-by: Kenneth Graunke 
---
 .../arb_separate_shader_objects/CMakeLists.gl.txt  |   1 +
 .../rendezvous_by_location-3-stages.c  | 152 +
 2 files changed, 153 insertions(+)
 create mode 100644 
tests/spec/arb_separate_shader_objects/rendezvous_by_location-3-stages.c

diff --git a/tests/spec/arb_separate_shader_objects/CMakeLists.gl.txt 
b/tests/spec/arb_separate_shader_objects/CMakeLists.gl.txt
index abd6b37..f7feb27 100644
--- a/tests/spec/arb_separate_shader_objects/CMakeLists.gl.txt
+++ b/tests/spec/arb_separate_shader_objects/CMakeLists.gl.txt
@@ -16,6 +16,7 @@ piglit_add_executable 
(arb_separate_shader_object-GetProgramPipelineiv GetProgra
 piglit_add_executable (arb_separate_shader_object-IsProgramPipeline 
IsProgramPipeline.c)
 piglit_add_executable (arb_separate_shader_object-ProgramUniform-coverage 
ProgramUniform-coverage.c)
 piglit_add_executable (arb_separate_shader_object-rendezvous_by_location 
rendezvous_by_location.c)
+piglit_add_executable 
(arb_separate_shader_object-rendezvous_by_location-3-stages 
rendezvous_by_location-3-stages.c)
 piglit_add_executable 
(arb_separate_shader_object-rendezvous_by_location-5-stages 
rendezvous_by_location-5-stages.c)
 piglit_add_executable 
(arb_separate_shader_object-UseProgramStages-non-separable 
UseProgramStages-non-separable.c)
 piglit_add_executable (arb_separate_shader_object-ValidateProgramPipeline 
ValidateProgramPipeline.c)
diff --git 
a/tests/spec/arb_separate_shader_objects/rendezvous_by_location-3-stages.c 
b/tests/spec/arb_separate_shader_objects/rendezvous_by_location-3-stages.c
new file mode 100644
index 000..b8192a6
--- /dev/null
+++ b/tests/spec/arb_separate_shader_objects/rendezvous_by_location-3-stages.c
@@ -0,0 +1,152 @@
+/*
+ * Copyright © 2013 Intel Corporation
+ * Copyright © 2015 Advanced Micro Devices, Inc.
+ *
+ * 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.
+ */
+
+/**
+ * This test uses 3 separate shaders (VS, GS, FS) and tests whether
+ * separate shader objects combined with tessellation and geometry shaders
+ * all work together.
+ */
+
+#include "piglit-util-gl.h"
+
+PIGLIT_GL_TEST_CONFIG_BEGIN
+
+   config.supports_gl_compat_version = 0;
+   config.supports_gl_core_version = 32;
+   config.window_visual = PIGLIT_GL_VISUAL_RGBA | PIGLIT_GL_VISUAL_DOUBLE;
+
+PIGLIT_GL_TEST_CONFIG_END
+
+static GLuint pipeline;
+
+static const char *vs_code =
+   "#version 150\n"
+   "#extension GL_ARB_separate_shader_objects: require\n"
+   "#extension GL_ARB_explicit_attrib_location: require\n"
+   "\n"
+   "layout(location = 0) in vec4 piglit_vertex;\n"
+   "\n"
+   "layout(location = 2) out vec3 a;\n"
+   "layout(location = 4) out vec3 b;\n"
+   "layout(location = 3) out vec3 c;\n"
+   "\n"
+   "void main()\n"
+   "{\n"
+   "gl_Position = piglit_vertex;\n"
+   "a = vec3(0.5, 0, 0.3);\n"
+   "b = vec3(0.4, 0, 0.2);\n"
+   "c = vec3(0.3, 0, 0.1);\n"
+   "}\n"
+   ;
+
+static const char *gs_code =
+   "#version 150\n"
+   "#extension GL_ARB_separate_shader_objects: require\n"
+   "#extension GL_ARB_explicit_attrib_location: require\n"
+   "layout(triangles) in;\n"
+   "layout(triangle_strip, max_vertices = 3) out;\n"
+   "\n"
+   "layout(location = 2) in vec3 a[]; /* should get vec3(0.5, 0, 0.3) */\n"
+   "layout(location = 4) in vec3 b[]; 

[Piglit] [PATCH 2/2] sso: Add a test that passes data using the legacy gl_TexCoord varyings.

2015-09-11 Thread Kenneth Graunke
In compatiblity profiles, the GL_ARB_separate_shader_objects extension
allows passing data via built-in varyings such as gl_TexCoord[].  We
don't do compatibility profiles, but we do expose SSO in legacy GL
contexts and allow it with GLSL 1.30.

This test actually tries to do that in a rendering test.

This is particularly interesting because Mesa's VARYING_SLOT_* enums
handle built-in varyings different than generic ones.  I wanted to be
able to see how those came through; this provides a simple example.

Signed-off-by: Kenneth Graunke 
---
 .../arb_separate_shader_objects/CMakeLists.gl.txt  |   1 +
 .../arb_separate_shader_objects/compat-builtins.c  | 111 +
 2 files changed, 112 insertions(+)
 create mode 100644 tests/spec/arb_separate_shader_objects/compat-builtins.c

diff --git a/tests/spec/arb_separate_shader_objects/CMakeLists.gl.txt 
b/tests/spec/arb_separate_shader_objects/CMakeLists.gl.txt
index f7feb27..b596f67 100644
--- a/tests/spec/arb_separate_shader_objects/CMakeLists.gl.txt
+++ b/tests/spec/arb_separate_shader_objects/CMakeLists.gl.txt
@@ -12,6 +12,7 @@ link_libraries (
 piglit_add_executable (arb_separate_shader_object-400-combinations 
400-combinations.c)
 piglit_add_executable (arb_separate_shader_object-active-sampler-conflict 
active-sampler-conflict.c)
 piglit_add_executable 
(arb_separate_shader_object-ActiveShaderProgram-invalid-program 
ActiveShaderProgram-invalid-program.c)
+piglit_add_executable (arb_separate_shader_object-compat-builtins 
compat-builtins.c)
 piglit_add_executable (arb_separate_shader_object-GetProgramPipelineiv 
GetProgramPipelineiv.c)
 piglit_add_executable (arb_separate_shader_object-IsProgramPipeline 
IsProgramPipeline.c)
 piglit_add_executable (arb_separate_shader_object-ProgramUniform-coverage 
ProgramUniform-coverage.c)
diff --git a/tests/spec/arb_separate_shader_objects/compat-builtins.c 
b/tests/spec/arb_separate_shader_objects/compat-builtins.c
new file mode 100644
index 000..e84b746
--- /dev/null
+++ b/tests/spec/arb_separate_shader_objects/compat-builtins.c
@@ -0,0 +1,111 @@
+/*
+ * Copyright © 2015 Intel Corporation
+ * Copyright © 2015 Advanced Micro Devices, Inc.
+ *
+ * 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.
+ */
+
+/**
+ */
+
+#include "piglit-util-gl.h"
+
+PIGLIT_GL_TEST_CONFIG_BEGIN
+
+   config.supports_gl_compat_version = 30;
+   config.supports_gl_core_version = 0;
+   config.window_visual = PIGLIT_GL_VISUAL_RGBA | PIGLIT_GL_VISUAL_DOUBLE;
+
+PIGLIT_GL_TEST_CONFIG_END
+
+static GLuint pipeline;
+
+static const char *vs_code =
+   "#version 130\n"
+   "#extension GL_ARB_separate_shader_objects: require\n"
+   "#extension GL_ARB_explicit_attrib_location: require\n"
+   "\n"
+   "out vec4 gl_TexCoord[2];\n"
+   "\n"
+   "void main()\n"
+   "{\n"
+   "gl_Position = gl_Vertex;\n"
+   "gl_TexCoord[0] = vec4(0.1, 0.2, 0.3, 0.4);\n"
+   "gl_TexCoord[1] = vec4(0.01, 0.02, 0.03, 0.04);\n"
+   "}\n"
+   ;
+
+static const char *fs_code =
+   "#version 130\n"
+   "#extension GL_ARB_separate_shader_objects: require\n"
+   "#extension GL_ARB_explicit_attrib_location: require\n"
+   "\n"
+   "in vec4 gl_TexCoord[2];\n"
+   "\n"
+   "void main()\n"
+   "{\n"
+   "gl_FragColor = gl_TexCoord[0] + gl_TexCoord[1];\n"
+   "}\n"
+   ;
+
+enum piglit_result
+piglit_display(void)
+{
+   static const float expected[] = {
+   0.11, 0.22, 0.33, 0.44
+   };
+   bool pass;
+
+   glClearColor(1.0f, 1.0f, 1.0f, 1.0f);
+   glClear(GL_COLOR_BUFFER_BIT);
+
+   glBindProgramPipeline(pipeline);
+   piglit_draw_rect(-1, -1, 2, 2);
+
+   pass = piglit_probe_rect_rgba(0, 0, piglit_width, piglit_height,
+ expected);
+
+   piglit_present_results();
+   return pass ? PIGLIT_PASS : PIGLIT_FAI

[Piglit] [PATCH] arb_copy_image-formats: add code to test GL_DEPTH32F_STENCIL8

2015-09-11 Thread Brian Paul
This internal depth/stencil format was added in GL 3.0
We need to handle a few things specially for this format:
1. The random float data must be in the range [0,1].
2. When we compare pixels, we must skip the 3 unused bytes in the pixel.

This patch also simplifies the array indexing code in check_texture().

Note: This format fails with NVIDIA's 352.21 driver (at least).
It passes with Mesa softpipe with the proposed GL_ARB_copy_image patch
series.

v2: check for GL_ARB_depth_buffer_float instead of GL 3.0
---
 tests/spec/arb_copy_image/formats.c | 59 +
 1 file changed, 54 insertions(+), 5 deletions(-)

diff --git a/tests/spec/arb_copy_image/formats.c 
b/tests/spec/arb_copy_image/formats.c
index eb0f314..67c8b33 100644
--- a/tests/spec/arb_copy_image/formats.c
+++ b/tests/spec/arb_copy_image/formats.c
@@ -172,6 +172,10 @@ struct texture_format formats[] = {
FORMAT(GL_COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT, GL_RGB, GL_BYTE, true, 
16, 4, 4),
 #endif
 
+#ifdef GL_ARB_depth_buffer_float
+FORMAT(GL_DEPTH32F_STENCIL8, GL_DEPTH_STENCIL, 
GL_FLOAT_32_UNSIGNED_INT_24_8_REV, false, 8, 1, 1),
+#endif
+
 #undef FORMAT
 };
 
@@ -256,6 +260,8 @@ is_format_supported(struct texture_format *format)
 #endif
case GL_STENCIL_INDEX8:
return piglit_is_extension_supported("GL_ARB_texture_stencil8");
+   case GL_DEPTH32F_STENCIL8:
+   return 
piglit_is_extension_supported("GL_ARB_depth_buffer_float");
}
 
return true;
@@ -409,6 +415,24 @@ setup_test_data(struct texture_format *src_format,
rand_int = (int *)(rand_data + data_size);
for (i = 0; i < data_size / sizeof(float); ++i)
dst_float[i] = rand_int[i] / (float)INT16_MAX;
+   }
+   else if (src_format->data_type == GL_FLOAT_32_UNSIGNED_INT_24_8_REV ||
+dst_format->data_type == GL_FLOAT_32_UNSIGNED_INT_24_8_REV) {
+   /* Use float values in [0,1].  The stencil values will
+* be the least significant 8 bits in the dwords at odd
+* offsets. */
+   float *src_float = (float *)src_data;
+   float *dst_float = (float *)dst_data;
+   rand_int = (int *)rand_data;
+   for (i = 0; i < data_size / sizeof(float); ++i) {
+   src_float[i] = (rand_int[i] & 0x) / 65535.0f;
+   assert(src_float[i] <= 1.0f);
+   }
+   rand_int = (int *)(rand_data + data_size);
+   for (i = 0; i < data_size / sizeof(float); ++i) {
+   dst_float[i] = (rand_int[i] & 0x) / 65535.0f;
+   assert(dst_float[i] <= 1.0f);
+   }
} else {
memcpy(src_data, rand_data, data_size);
memcpy(dst_data, rand_data + data_size, data_size);
@@ -708,6 +732,32 @@ run_multisample_test(struct texture_format *src_format,
return pass ? PIGLIT_PASS : PIGLIT_FAIL;
 }
 
+
+/** test if two pixels are equal, according to the format */
+static bool
+pixels_equal(const void *p1, const void *p2,
+const struct texture_format *format)
+{
+   if (format->data_type == GL_FLOAT_32_UNSIGNED_INT_24_8_REV) {
+   /* don't compare the 3 unused bytes which pad the
+* stencil value.
+*/
+   const float *f1 = (const float *) p1;
+   const float *f2 = (const float *) p2;
+   const GLuint *b1 = (const GLuint *) p1;
+   const GLuint *b2 = (const GLuint *) p2;
+   if (f1[0] != f2[0])
+   return false;
+   if ((b1[1] & 0xff) != (b2[1] & 0xff))
+   return false;
+   return true;
+   }
+   else {
+   return memcmp(p1, p2, format->bytes) == 0;
+   }
+}
+
+
 static bool
 check_texture(GLuint texture, unsigned level,
  const struct texture_format *format, const unsigned char *data)
@@ -731,19 +781,18 @@ check_texture(GLuint texture, unsigned level,
passrate = 0;
for (j = 0; j < TEX_SIZE; ++j) {
for (i = 0; i < TEX_SIZE; ++i) {
-   if (memcmp(tex_data + ((j * TEX_SIZE) + i) * 
format->bytes,
-  data + ((j * TEX_SIZE) + i) * format->bytes,
-  format->bytes) == 0) {
+   int pos = ((j * TEX_SIZE) + i) * format->bytes;
+   if (pixels_equal(tex_data + pos, data + pos, format)) {
passrate += 1;
} else {
fprintf(stdout, "texel mismatch at (%d, %d); 
expected 0x",
i, j);
for (k = format->bytes - 1; k >= 0; --k)
-   fprintf(stdout, "%02x", data[((j * 
TEX_SIZE) + i) 

Re: [Piglit] [PATCH 4/4] arb_copy_image-formats: add code to test GL_DEPTH32F_STENCIL8

2015-09-11 Thread Ilia Mirkin
On Fri, Sep 11, 2015 at 6:50 PM, Brian Paul  wrote:
> This internal depth/stencil format was added in GL 3.0
> We need to handle a few things specially for this format:
> 1. The random float data must be in the range [0,1].
> 2. When we compare pixels, we must skip the 3 unused bytes in the pixel.
>
> This patch also simplifies the array indexing code in check_texture().
>
> Note: This format fails with NVIDIA's 352.21 driver (at least).
> It passes with Mesa softpipe with the proposed GL_ARB_copy_image patch
> series.
> ---
>  tests/spec/arb_copy_image/formats.c | 59 
> +
>  1 file changed, 54 insertions(+), 5 deletions(-)
>
> diff --git a/tests/spec/arb_copy_image/formats.c 
> b/tests/spec/arb_copy_image/formats.c
> index eb0f314..1ecc411 100644
> --- a/tests/spec/arb_copy_image/formats.c
> +++ b/tests/spec/arb_copy_image/formats.c
> @@ -172,6 +172,10 @@ struct texture_format formats[] = {
> FORMAT(GL_COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT, GL_RGB, GL_BYTE, true, 
> 16, 4, 4),
>  #endif
>
> +#ifdef GL_DEPTH32F_STENCIL8
> +FORMAT(GL_DEPTH32F_STENCIL8, GL_DEPTH_STENCIL, 
> GL_FLOAT_32_UNSIGNED_INT_24_8_REV, false, 8, 1, 1),
> +#endif
> +
>  #undef FORMAT
>  };
>
> @@ -256,6 +260,8 @@ is_format_supported(struct texture_format *format)
>  #endif
> case GL_STENCIL_INDEX8:
> return 
> piglit_is_extension_supported("GL_ARB_texture_stencil8");
> +   case GL_DEPTH32F_STENCIL8:
> +   return piglit_get_gl_version() >= 30;

Actually GL_ARB_depth_buffer_float added the format, AFAIK. Although
it'll be precious few drivers that support ARB_copy_image and
ARB_depth_buffer_float but not GL3... Although freedreno currently
lacks GL3 support...

> }
>
> return true;
> @@ -409,6 +415,24 @@ setup_test_data(struct texture_format *src_format,
> rand_int = (int *)(rand_data + data_size);
> for (i = 0; i < data_size / sizeof(float); ++i)
> dst_float[i] = rand_int[i] / (float)INT16_MAX;
> +   }
> +   else if (src_format->data_type == GL_FLOAT_32_UNSIGNED_INT_24_8_REV ||
> +dst_format->data_type == GL_FLOAT_32_UNSIGNED_INT_24_8_REV) {
> +   /* Use float values in [0,1].  The stencil values will
> +* be the least significant 8 bits in the dwords at odd
> +* offsets. */
> +   float *src_float = (float *)src_data;
> +   float *dst_float = (float *)dst_data;
> +   rand_int = (int *)rand_data;
> +   for (i = 0; i < data_size / sizeof(float); ++i) {
> +   src_float[i] = (rand_int[i] & 0x) / 65535.0f;
> +   assert(src_float[i] <= 1.0f);
> +   }
> +   rand_int = (int *)(rand_data + data_size);
> +   for (i = 0; i < data_size / sizeof(float); ++i) {
> +   dst_float[i] = (rand_int[i] & 0x) / 65535.0f;
> +   assert(dst_float[i] <= 1.0f);
> +   }
> } else {
> memcpy(src_data, rand_data, data_size);
> memcpy(dst_data, rand_data + data_size, data_size);
> @@ -708,6 +732,32 @@ run_multisample_test(struct texture_format *src_format,
> return pass ? PIGLIT_PASS : PIGLIT_FAIL;
>  }
>
> +
> +/** test if two pixels are equal, according to the format */
> +static bool
> +pixels_equal(const void *p1, const void *p2,
> +const struct texture_format *format)
> +{
> +   if (format->data_type == GL_FLOAT_32_UNSIGNED_INT_24_8_REV) {
> +   /* don't compare the 3 unused bytes which pad the
> +* stencil value.
> +*/
> +   const float *f1 = (const float *) p1;
> +   const float *f2 = (const float *) p2;
> +   const GLuint *b1 = (const GLuint *) p1;
> +   const GLuint *b2 = (const GLuint *) p2;
> +   if (f1[0] != f2[0])
> +   return false;
> +   if ((b1[1] & 0xff) != (b2[1] & 0xff))
> +   return false;
> +   return true;
> +   }
> +   else {
> +   return memcmp(p1, p2, format->bytes) == 0;
> +   }
> +}
> +
> +
>  static bool
>  check_texture(GLuint texture, unsigned level,
>   const struct texture_format *format, const unsigned char *data)
> @@ -731,19 +781,18 @@ check_texture(GLuint texture, unsigned level,
> passrate = 0;
> for (j = 0; j < TEX_SIZE; ++j) {
> for (i = 0; i < TEX_SIZE; ++i) {
> -   if (memcmp(tex_data + ((j * TEX_SIZE) + i) * 
> format->bytes,
> -  data + ((j * TEX_SIZE) + i) * 
> format->bytes,
> -  format->bytes) == 0) {
> +   int pos = ((j * TEX_SIZE) + i) * format->bytes;
> +   if (pixels_equal(tex_data + pos, data + pos,

[Piglit] [PATCH 04/26] framework/backends/json.py: store totals data in json

2015-09-11 Thread Dylan Baker
Because compression is so awesome even a full run of quick.py is only
~50kb with all of this extra data. This isn't a big drain, and saves us
a lot of time calculating this data over and over.

Signed-off-by: Dylan Baker 
---
 framework/backends/json.py   | 18 +-
 framework/tests/json_results_update_tests.py | 51 ++--
 2 files changed, 66 insertions(+), 3 deletions(-)

diff --git a/framework/backends/json.py b/framework/backends/json.py
index b5a38d0..5eeab44 100644
--- a/framework/backends/json.py
+++ b/framework/backends/json.py
@@ -42,7 +42,7 @@ __all__ = [
 ]
 
 # The current version of the JSON results
-CURRENT_JSON_VERSION = 6
+CURRENT_JSON_VERSION = 7
 
 # The level to indent a final file
 INDENT = 4
@@ -274,6 +274,8 @@ def _resume(results_dir):
 except ValueError:
 continue
 
+testrun.calculate_group_totals()
+
 return testrun
 
 
@@ -301,6 +303,7 @@ def _update_results(results, filepath):
 3: _update_three_to_four,
 4: _update_four_to_five,
 5: _update_five_to_six,
+6: _update_six_to_seven,
 }
 
 while results.results_version < CURRENT_JSON_VERSION:
@@ -565,6 +568,19 @@ def _update_five_to_six(result):
 return result
 
 
+def _update_six_to_seven(result):
+"""Update json results from version 6 to 7.
+
+Version 7 results always contain the totals member.
+
+"""
+if not result.totals:
+result.calculate_group_totals()
+result.results_version = 7
+
+return result
+
+
 REGISTRY = Registry(
 extensions=['', '.json'],
 backend=JSONBackend,
diff --git a/framework/tests/json_results_update_tests.py 
b/framework/tests/json_results_update_tests.py
index 3552506..9ae1102 100644
--- a/framework/tests/json_results_update_tests.py
+++ b/framework/tests/json_results_update_tests.py
@@ -693,12 +693,59 @@ class TestV5toV6(object):
 """backends.json.update_results (5 -> 6): A test result is converted 
to a TestResult instance"""
 nt.ok_(isinstance(self.result.tests['a@test'], results.TestResult))
 
+
+class TestV6toV7(object):
+DATA = {
+"results_version": 6,
+"name": "test",
+"options": {
+"profile": ['quick'],
+"dmesg": False,
+"verbose": False,
+"platform": "gbm",
+"sync": False,
+"valgrind": False,
+"filter": [],
+"concurrent": "all",
+"test_count": 0,
+"exclude_tests": [],
+"exclude_filter": [],
+"env": {
+"lspci": "stuff",
+"uname": "more stuff",
+"glxinfo": "and stuff",
+"wglinfo": "stuff"
+}
+},
+"tests": {
+'a@test': results.TestResult('pass'),
+'a@nother@test': results.TestResult('fail'),
+'a@nother@thing': results.TestResult('crash'),
+}
+}
+
+@classmethod
+def setup_class(cls):
+"""Class setup. Create a TestrunResult with v4 data."""
+with utils.tempfile(
+json.dumps(cls.DATA, default=backends.json.piglit_encoder)) as 
t:
+with open(t, 'r') as f:
+cls.result = 
backends.json._update_six_to_seven(backends.json._load(f))
+
+def test_is_TestrunResult(self):
+"""backends.json.update_results (6 -> 7): makes TestrunResult"""
+nt.ok_(isinstance(self.result, results.TestrunResult))
+
+def test_totals(self):
+"""backends.json.update_results (6 -> 7): Totals are populated"""
+nt.ok_(self.result.totals != {})
+
 def test_load_results(self):
-"""backends.json.update_results (5 -> 6): load_results properly 
updates."""
+"""backends.json.update_results (6 -> 7): load_results properly 
updates."""
 with utils.tempdir() as d:
 tempfile = os.path.join(d, 'results.json')
 with open(tempfile, 'w') as f:
 json.dump(self.DATA, f, default=backends.json.piglit_encoder)
 with open(tempfile, 'r') as f:
 result = backends.json.load_results(tempfile, 'none')
-nt.assert_equal(result.results_version, 6)
+nt.eq_(result.results_version, 7)
-- 
2.5.1

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


[Piglit] [PATCH 06/26] framework/summary.py: Make the text mode less weird

2015-09-11 Thread Dylan Baker
Describing the current implementation as anything but weird is hard. The
list of tests and statuses it generates is pretty reasonable, but the
summary is very weird. It counts more than one result in some cases, but
not in others (for comparison statuses), and generates a single column
of data. This is confusing and difficult to read at best.

This rework instead creates a column (each one will be 20 characters)
for each result and properly calculates both the number of tests in each
category, and the number of changes (and all subsets of changes).

Signed-off-by: Dylan Baker 
---
 framework/summary.py | 75 +++-
 1 file changed, 57 insertions(+), 18 deletions(-)

diff --git a/framework/summary.py b/framework/summary.py
index b4aa053..4fabee8 100644
--- a/framework/summary.py
+++ b/framework/summary.py
@@ -32,6 +32,8 @@ import getpass
 import sys
 import posixpath
 import errno
+import textwrap
+import operator
 
 from mako.template import Template
 
@@ -554,7 +556,6 @@ class Summary:
 def generate_text(self, mode):
 """ Write summary information to the console """
 assert mode in ['summary', 'diff', 'incomplete', 'all'], mode
-totals = self.results[-1].totals['root']
 
 def printer(list_):
 """Takes a list of test names to print and prints the name and
@@ -577,23 +578,61 @@ class Summary:
 
 def print_summary():
 """print a summary."""
-print("summary:\n"
-  "   pass: {pass}\n"
-  "   fail: {fail}\n"
-  "  crash: {crash}\n"
-  "   skip: {skip}\n"
-  "timeout: {timeout}\n"
-  "   warn: {warn}\n"
-  " incomplete: {incomplete}\n"
-  " dmesg-warn: {dmesg-warn}\n"
-  " dmesg-fail: {dmesg-fail}".format(**totals))
-if self.tests['changes']:
-print("changes: {changes}\n"
-  "  fixes: {fixes}\n"
-  "regressions: {regressions}".format(
-  **{k: len(v) for k, v in self.tests.iteritems()}))
-
-print("  total: {}".format(sum(totals.itervalues(
+template = textwrap.dedent("""\
+summary:
+   name: {names}
+     {divider}
+   pass: {pass_}
+   fail: {fail}
+  crash: {crash}
+   skip: {skip}
+timeout: {timeout}
+   warn: {warn}
+ incomplete: {incomplete}
+ dmesg-warn: {dmesg_warn}
+ dmesg-fail: {dmesg_fail}
+changes: {changes}
+  fixes: {fixes}
+regressions: {regressions}
+  total: {total}""")
+
+print_template = ' '.join(
+'{: >20}' for x in xrange(len(self.results)))
+
+def status_printer(stat):
+return print_template.format(
+*[x.totals['root'][stat] for x in self.results])
+
+def change_printer(func):
+counts = ['']  # There can't be changes from nil -> 0
+for prev, cur in itertools.izip(self.results[:-1], 
self.results[1:]):
+count = 0
+for name in self.tests['all']:
+try:
+if func(prev.tests[name].result, 
cur.tests[name].result):
+count += 1
+except KeyError:
+pass
+counts.append(count)
+return print_template.format(*counts)
+
+print(template.format(
+names=print_template.format(*[r.name for r in self.results]),
+divider=print_template.format(*['-'*20 for _ in self.results]),
+pass_=status_printer('pass'),
+crash=status_printer('crash'),
+fail=status_printer('fail'),
+skip=status_printer('skip'),
+timeout=status_printer('timeout'),
+warn=status_printer('warn'),
+incomplete=status_printer('incomplete'),
+dmesg_warn=status_printer('dmesg-warn'),
+dmesg_fail=status_printer('dmesg-fail'),
+changes=change_printer(operator.ne),
+fixes=change_printer(operator.gt),
+regressions=change_printer(operator.lt),
+total=print_template.format(*[
+sum(x.totals['root'].itervalues()) for x in 
self.results])))
 
 # Print the name of the test and the status from each test run
 if mode == 'all':
-- 
2.5.1

___
Piglit mailing list
Piglit@lists.freedesktop.org
http://li

[Piglit] [PATCH 07/26] framework/summary.py: make text columns width variable

2015-09-11 Thread Dylan Baker
Makes the widths of the columns always between 6 and 20 (being that
there are unlikely to be more than a million tests, and over 20 is just
too big), it truncates the name of the result if it is over 20
characters long.

Signed-off-by: Dylan Baker 
---
 framework/summary.py | 22 +++---
 1 file changed, 15 insertions(+), 7 deletions(-)

diff --git a/framework/summary.py b/framework/summary.py
index 4fabee8..14c502d 100644
--- a/framework/summary.py
+++ b/framework/summary.py
@@ -596,12 +596,19 @@ class Summary:
 regressions: {regressions}
   total: {total}""")
 
-print_template = ' '.join(
-'{: >20}' for x in xrange(len(self.results)))
+def make(value):
+# This convaluted little function makes a formatter string that
+# looks like this: {: >x.x}, which prints a string that is x
+# characters wide and truncated at x, and right aligned, using
+# spaces to pad any remaining space on the left
+return '{: >' + '{0}.{0}'.format(value) + '}'
+
+lens = [max(min(len(x.name), 20), 6) for x in self.results]
+print_template = ' '.join(make(y) for y in lens)
 
 def status_printer(stat):
-return print_template.format(
-*[x.totals['root'][stat] for x in self.results])
+totals = [str(x.totals['root'][stat]) for x in self.results]
+return print_template.format(*totals)
 
 def change_printer(func):
 counts = ['']  # There can't be changes from nil -> 0
@@ -613,12 +620,12 @@ class Summary:
 count += 1
 except KeyError:
 pass
-counts.append(count)
+counts.append(str(count))
 return print_template.format(*counts)
 
 print(template.format(
 names=print_template.format(*[r.name for r in self.results]),
-divider=print_template.format(*['-'*20 for _ in self.results]),
+divider=print_template.format(*['-'*l for l in lens]),
 pass_=status_printer('pass'),
 crash=status_printer('crash'),
 fail=status_printer('fail'),
@@ -632,7 +639,8 @@ class Summary:
 fixes=change_printer(operator.gt),
 regressions=change_printer(operator.lt),
 total=print_template.format(*[
-sum(x.totals['root'].itervalues()) for x in 
self.results])))
+str(sum(x.totals['root'].itervalues()))
+for x in self.results])))
 
 # Print the name of the test and the status from each test run
 if mode == 'all':
-- 
2.5.1

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


[Piglit] [PATCH 08/26] framework/summary.py: split diff generating code into toplevel function

2015-09-11 Thread Dylan Baker
This is groundwork for later patches in this series.

Signed-off-by: Dylan Baker 
---
 framework/summary.py | 26 +-
 framework/tests/summary_tests.py | 21 -
 2 files changed, 37 insertions(+), 10 deletions(-)

diff --git a/framework/summary.py b/framework/summary.py
index 14c502d..985ee3d 100644
--- a/framework/summary.py
+++ b/framework/summary.py
@@ -612,15 +612,8 @@ class Summary:
 
 def change_printer(func):
 counts = ['']  # There can't be changes from nil -> 0
-for prev, cur in itertools.izip(self.results[:-1], 
self.results[1:]):
-count = 0
-for name in self.tests['all']:
-try:
-if func(prev.tests[name].result, 
cur.tests[name].result):
-count += 1
-except KeyError:
-pass
-counts.append(str(count))
+counts.extend([str(len(e)) for e in find_diffs(
+self.results, self.tests['all'], func)])
 return print_template.format(*counts)
 
 print(template.format(
@@ -653,3 +646,18 @@ class Summary:
 printer(self.tests['incomplete'])
 elif mode == 'summary':
 print_summary()
+
+
+def find_diffs(results, tests, comparator):
+"""Generate diffs between two or more sets of results."""
+diffs = []
+for prev, cur in itertools.izip(results[:-1], results[1:]):
+names = set()
+for name in tests:
+try:
+if comparator(prev.tests[name].result, cur.tests[name].result):
+names.add(name)
+except KeyError:
+pass
+diffs.append(names)
+return diffs
diff --git a/framework/tests/summary_tests.py b/framework/tests/summary_tests.py
index 51ec392..94fbbc6 100644
--- a/framework/tests/summary_tests.py
+++ b/framework/tests/summary_tests.py
@@ -30,7 +30,7 @@ except ImportError:
 import json
 import nose.tools as nt
 
-import framework.summary as summary
+from framework import summary, results
 import framework.tests.utils as utils
 from framework.backends.json import piglit_encoder
 
@@ -125,3 +125,22 @@ class TestSubtestHandling(object):
 def subtest_not_skip_notrun(self):
 """summary.Summary: skips are not changed to notruns"""
 nt.eq_(self.summ.status['fake-tests']['is_skip'], 'skip')
+
+
+def test_find_diffs_():
+"""summary.find_diffs: calculates correct set of diffs"""
+res1 = results.TestrunResult()
+res1.tests['foo'] = results.TestResult('pass')
+res1.tests['bar'] = results.TestResult('fail')
+res1.tests['oink'] = results.TestResult('crash')
+res1.tests['bonk'] = results.TestResult('warn')
+
+res2 = results.TestrunResult()
+res2.tests['foo'] = results.TestResult('fail')
+res2.tests['bar'] = results.TestResult('pass')
+res2.tests['oink'] = results.TestResult('crash')
+
+diffs = summary.find_diffs([res1, res2],
+   {'foo', 'bar', 'oink', 'bonk'},
+   lambda x, y: x != y)
+nt.eq_(diffs, [{'foo', 'bar'}])
-- 
2.5.1

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


[Piglit] [PATCH 03/26] framework/results.py: add TestrunResult.from_dict method

2015-09-11 Thread Dylan Baker
This allows us to easily restore from json serialization, it also
removes the type hint that we've added in the to_json method.

Signed-off-by: Dylan Baker 
---
 framework/backends/json.py   | 28 +++--
 framework/results.py | 32 +++
 framework/tests/results_tests.py | 67 
 framework/tests/utils.py |  1 +
 4 files changed, 118 insertions(+), 10 deletions(-)

diff --git a/framework/backends/json.py b/framework/backends/json.py
index fc816f7..b5a38d0 100644
--- a/framework/backends/json.py
+++ b/framework/backends/json.py
@@ -47,6 +47,13 @@ CURRENT_JSON_VERSION = 6
 # The level to indent a final file
 INDENT = 4
 
+_DECODER_TABLE = {
+'Subtests': results.Subtests,
+'TestResult': results.TestResult,
+'TestrunResult': results.TestrunResult,
+'Totals': results.Totals,
+}
+
 
 def piglit_encoder(obj):
 """ Encoder for piglit that can transform additional classes into json
@@ -66,10 +73,10 @@ def piglit_encoder(obj):
 def piglit_decoder(obj):
 """Json decoder for piglit that can load TestResult objects."""
 if isinstance(obj, dict):
-if obj.get('__type__', '') == 'TestResult':
-return results.TestResult.from_dict(obj)
-elif obj.get('__type__', '') == 'Subtests':
-return results.Subtests.from_dict(obj)
+try:
+return _DECODER_TABLE[obj['__type__']].from_dict(obj)
+except KeyError:
+pass
 return obj
 
 
@@ -141,11 +148,13 @@ class JSONBackend(FileBackend):
 # writing worked and is valid or it didn't work.
 try:
 with open(test, 'r') as f:
-data['tests'].update(json.load(f))
+data['tests'].update(json.load(f, 
object_hook=piglit_decoder))
 except ValueError:
 pass
 assert data['tests']
 
+data = results.TestrunResult.from_dict(data)
+
 # write out the combined file. Use the compression writer from the
 # FileBackend
 with self._write_final(os.path.join(self._dest, 'results.json')) as f:
@@ -221,18 +230,17 @@ def _load(results_file):
 This function converts an existing, fully completed json run.
 
 """
-result = results.TestrunResult()
-result.results_version = 0  # This should get overwritten
 try:
-result.__dict__.update(
-json.load(results_file, object_hook=piglit_decoder))
+result = json.load(results_file, object_hook=piglit_decoder)
 except ValueError as e:
 raise exceptions.PiglitFatalError(
 'While loading json results file: "{}",\n'
 'the following error occured:\n{}'.format(results_file.name,
   str(e)))
 
-return result
+if isinstance(result, results.TestrunResult):
+return result
+return results.TestrunResult.from_dict(result, _no_totals=True)
 
 
 def _resume(results_dir):
diff --git a/framework/results.py b/framework/results.py
index dd7fdc0..61841b7 100644
--- a/framework/results.py
+++ b/framework/results.py
@@ -204,6 +204,11 @@ class Totals(dict):
 result['__type__'] = 'Totals'
 return result
 
+@classmethod
+def from_dict(cls, dict_):
+"""Convert a dictionary into a Totals object."""
+return cls(dict_)
+
 
 class TestrunResult(object):
 """The result of a single piglit run."""
@@ -246,3 +251,30 @@ class TestrunResult(object):
 rep = copy.copy(self.__dict__)
 rep['__type__'] = 'TestrunResult'
 return rep
+
+@classmethod
+def from_dict(cls, dict_, _no_totals=False):
+"""Convert a dictionary into a TestrunResult.
+
+This method is meant to be used for loading results from json or
+similar formats
+
+_no_totals is not meant to be used externally, it allows us to control
+the generation of totals when loading old results formats.
+
+"""
+res = cls()
+for name in ['name', 'uname', 'options', 'glxinfo', 'wglinfo', 'lspci',
+ 'tests', 'totals', 'results_version']:
+value = dict_.get(name)
+if value:
+setattr(res, name, value)
+
+# This could be replaced with a getter/setter property
+time = dict_.get('time_elapsed')
+res.time_elapsed = None if time is None else float(time)
+
+if not res.totals and not _no_totals:
+res.calculate_group_totals()
+
+return res
diff --git a/framework/tests/results_tests.py b/framework/tests/results_tests.py
index 9a4b358..2f09127 100644
--- a/framework/tests/results_tests.py
+++ b/framework/tests/results_tests.py
@@ -498,3 +498,70 @@ class TestTestrunResultToJson(object):
 def test_type(self):
 """results.TestrunResult.to_json: __type__ is added"""
 nt.eq_(self.test['__type__'], 'TestrunRe

[Piglit] [PATCH 05/26] framework/summary.py: stop calculating totals at run time

2015-09-11 Thread Dylan Baker
Instead of calculating the totals in the Summary class, load the totals
from the json result, and use that.

Signed-off-by: Dylan Baker 
---
 framework/summary.py | 23 ---
 1 file changed, 4 insertions(+), 19 deletions(-)

diff --git a/framework/summary.py b/framework/summary.py
index bdbd6e2..b4aa053 100644
--- a/framework/summary.py
+++ b/framework/summary.py
@@ -305,7 +305,6 @@ class Summary:
 
 self.status = {}
 self.fractions = {}
-self.totals = {}
 self.tests = {'all': set(), 'changes': set(), 'problems': set(),
   'skipped': set(), 'regressions': set(), 'fixes': set(),
   'enabled': set(), 'disabled': set(), 'incomplete': set()}
@@ -425,18 +424,6 @@ class Summary:
 self.tests['fixes'].add(test)
 self.tests['changes'].add(test)
 
-def __find_totals(self, results):
-"""
-Private: Find the total number of pass, fail, crash, skip, and warn in
-the specified results.
-"""
-self.totals = {'pass': 0, 'fail': 0, 'crash': 0, 'skip': 0,
-   'timeout': 0, 'warn': 0, 'dmesg-warn': 0,
-   'dmesg-fail': 0, 'incomplete': 0,}
-
-for test in results.tests.itervalues():
-self.totals[str(test.result)] += 1
-
 def generate_html(self, destination, exclude):
 """
 Produce HTML summaries.
@@ -490,12 +477,10 @@ class Summary:
 else:
 time = None
 
-self.__find_totals(each)
-
 with open(path.join(destination, name, "index.html"), 'w') as out:
 out.write(testindex.render(
 name=each.name,
-totals=self.totals,
+totals=each.totals['root'],
 time=time,
 options=each.options,
 uname=each.uname,
@@ -569,7 +554,7 @@ class Summary:
 def generate_text(self, mode):
 """ Write summary information to the console """
 assert mode in ['summary', 'diff', 'incomplete', 'all'], mode
-self.__find_totals(self.results[-1])
+totals = self.results[-1].totals['root']
 
 def printer(list_):
 """Takes a list of test names to print and prints the name and
@@ -601,14 +586,14 @@ class Summary:
   "   warn: {warn}\n"
   " incomplete: {incomplete}\n"
   " dmesg-warn: {dmesg-warn}\n"
-  " dmesg-fail: {dmesg-fail}".format(**self.totals))
+  " dmesg-fail: {dmesg-fail}".format(**totals))
 if self.tests['changes']:
 print("changes: {changes}\n"
   "  fixes: {fixes}\n"
   "regressions: {regressions}".format(
   **{k: len(v) for k, v in self.tests.iteritems()}))
 
-print("  total: {}".format(sum(self.totals.itervalues(
+print("  total: {}".format(sum(totals.itervalues(
 
 # Print the name of the test and the status from each test run
 if mode == 'all':
-- 
2.5.1

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


[Piglit] [PATCH 02/26] framework/results.py: Add a to_json method to the TestrunResults

2015-09-11 Thread Dylan Baker
The piglit_encoder knows how to convert an object with a to_json method
into it's json representation. By using this approach we can add special
hints to the json for converting it back into it's python object
representation, which can also be removed easily by using a from*
method.

Signed-off-by: Dylan Baker 
---
 framework/backends/json.py   |  5 +---
 framework/results.py | 13 ++
 framework/tests/results_tests.py | 53 
 3 files changed, 67 insertions(+), 4 deletions(-)

diff --git a/framework/backends/json.py b/framework/backends/json.py
index e88c9c8..fc816f7 100644
--- a/framework/backends/json.py
+++ b/framework/backends/json.py
@@ -326,10 +326,7 @@ def _update_results(results, filepath):
 def _write(results, file_):
 """WRite the values of the results out to a file."""
 with write_compressed(file_) as f:
-json.dump({k: v for k, v in results.__dict__.iteritems()},
-  f,
-  default=piglit_encoder,
-  indent=INDENT)
+json.dump(results, f, default=piglit_encoder, indent=INDENT)
 
 
 def _update_zero_to_one(result):
diff --git a/framework/results.py b/framework/results.py
index 7bfc2fd..dd7fdc0 100644
--- a/framework/results.py
+++ b/framework/results.py
@@ -24,6 +24,7 @@
 from __future__ import print_function, absolute_import
 
 import collections
+import copy
 
 from framework import status, exceptions, grouptools
 
@@ -197,6 +198,12 @@ class Totals(dict):
 return True
 return False
 
+def to_json(self):
+"""Convert totals to a json object."""
+result = copy.copy(self)
+result['__type__'] = 'Totals'
+return result
+
 
 class TestrunResult(object):
 """The result of a single piglit run."""
@@ -233,3 +240,9 @@ class TestrunResult(object):
 self.totals[name][res] += 1
 self.totals['root'][res] += 1
 
+def to_json(self):
+if not self.totals:
+self.calculate_group_totals()
+rep = copy.copy(self.__dict__)
+rep['__type__'] = 'TestrunResult'
+return rep
diff --git a/framework/tests/results_tests.py b/framework/tests/results_tests.py
index d2c4206..9a4b358 100644
--- a/framework/tests/results_tests.py
+++ b/framework/tests/results_tests.py
@@ -445,3 +445,56 @@ def test_totals_true():
 test = results.Totals()
 test[key] += 1
 nt.ok_(bool(test), msg='Returns false with status {}'.format(key))
+
+
+class TestTestrunResultToJson(object):
+"""results.TestrunResult.to_json: returns expected values"""
+@classmethod
+def setup_class(cls):
+test = results.TestrunResult()
+test.name = 'name'
+test.uname = 'this is uname'
+test.options = {'some': 'option'}
+test.glxinfo = 'glxinfo'
+test.wglinfo = 'wglinfo'
+test.lspci = 'this is lspci'
+test.time_elapsed = 1.23
+test.tests = {'a test': results.TestResult('pass')}
+
+cls.test = test.to_json()
+
+def test_name(self):
+"""results.TestrunResult.to_json: name is properly encoded"""
+nt.eq_(self.test['name'], 'name')
+
+def test_uname(self):
+"""results.TestrunResult.to_json: uname is properly encoded"""
+nt.eq_(self.test['uname'], 'this is uname')
+
+def test_options(self):
+"""results.TestrunResult.to_json: options is properly encoded"""
+nt.assert_dict_equal(self.test['options'], {'some': 'option'})
+
+def test_glxinfo(self):
+"""results.TestrunResult.to_json: glxinfo is properly encoded"""
+nt.eq_(self.test['glxinfo'], 'glxinfo')
+
+def test_wglinfo(self):
+"""results.TestrunResult.to_json: wglinfo is properly encoded"""
+nt.eq_(self.test['wglinfo'], 'wglinfo')
+
+def test_lspci(self):
+"""results.TestrunResult.to_json: lspci is properly encoded"""
+nt.eq_(self.test['lspci'], 'this is lspci')
+
+def test_time(self):
+"""results.TestrunResult.to_json: time_elapsed is properly encoded"""
+nt.eq_(self.test['time_elapsed'], 1.23)
+
+def test_tests(self):
+"""results.TestrunResult.to_json: tests is properly encoded"""
+nt.eq_(self.test['tests']['a test'].result, 'pass')
+
+def test_type(self):
+"""results.TestrunResult.to_json: __type__ is added"""
+nt.eq_(self.test['__type__'], 'TestrunResult')
-- 
2.5.1

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


[Piglit] [PATCH 01/26] framework/results.py: Add a method to TestrunResult to calculate totals

2015-09-11 Thread Dylan Baker
Currently this is done in the summary code, and is very complicated.
This change has a couple of advantages. First, having it in the
TestrunResult object seems a more obvious place for it. Second, this
will allows us to store the data in the json, removing the need to
calculate the data again and again.

Signed-off-by: Dylan Baker 
---
 framework/results.py |  45 -
 framework/tests/results_tests.py | 101 ++-
 2 files changed, 144 insertions(+), 2 deletions(-)

diff --git a/framework/results.py b/framework/results.py
index 2753fd5..7bfc2fd 100644
--- a/framework/results.py
+++ b/framework/results.py
@@ -23,7 +23,9 @@
 
 from __future__ import print_function, absolute_import
 
-from framework import status, exceptions
+import collections
+
+from framework import status, exceptions, grouptools
 
 __all__ = [
 'TestrunResult',
@@ -180,7 +182,24 @@ class TestResult(object):
 self.subtests.update(dict_['subtest'])
 
 
+class Totals(dict):
+def __init__(self, *args, **kwargs):
+super(Totals, self).__init__(*args, **kwargs)
+for each in status.ALL:
+self[str(each)] = 0
+
+def __nonzero__(self):
+# Since totals are prepopulated, calling 'if not '
+# will always result in True, this will cause it to return True only if
+# one of the values is not zero
+for each in self.itervalues():
+if each != 0:
+return True
+return False
+
+
 class TestrunResult(object):
+"""The result of a single piglit run."""
 def __init__(self):
 self.name = None
 self.uname = None
@@ -190,3 +209,27 @@ class TestrunResult(object):
 self.lspci = None
 self.time_elapsed = None
 self.tests = {}
+self.totals = collections.defaultdict(Totals)
+
+def calculate_group_totals(self):
+"""Calculate the number of pases, fails, etc at each level."""
+for name, result in self.tests.iteritems():
+# If there are subtests treat the test as if it is a group instead
+# of a test.
+if result.subtests:
+for res in result.subtests.itervalues():
+res = str(res)
+temp = name
+
+self.totals[temp][res] += 1
+while temp:
+temp = grouptools.groupname(temp)
+self.totals[temp][res] += 1
+self.totals['root'][res] += 1
+else:
+res = str(result.result)
+while name:
+name = grouptools.groupname(name)
+self.totals[name][res] += 1
+self.totals['root'][res] += 1
+
diff --git a/framework/tests/results_tests.py b/framework/tests/results_tests.py
index 143ab09..d2c4206 100644
--- a/framework/tests/results_tests.py
+++ b/framework/tests/results_tests.py
@@ -25,7 +25,7 @@ from __future__ import print_function, absolute_import
 
 import nose.tools as nt
 
-from framework import results, status, exceptions
+from framework import results, status, exceptions, grouptools
 import framework.tests.utils as utils
 
 
@@ -346,3 +346,102 @@ class TestStringDescriptor(object):
 def test_delete(self):
 """results.StringDescriptor.__delete__: raises NotImplementedError"""
 del self.test.val
+
+
+class TestTestrunResultTotals(object):
+"""Test the totals generated by TestrunResult.calculate_group_totals()."""
+@classmethod
+def setup_class(cls):
+pass_ = results.TestResult('pass')
+fail = results.TestResult('fail')
+#warn = results.TestResult('warn')
+crash = results.TestResult('crash')
+skip = results.TestResult('skip')
+tr = results.TestrunResult()
+tr.tests = {
+'oink': pass_,
+grouptools.join('foo', 'bar'): fail,
+grouptools.join('foo', 'foo', 'bar'): crash,
+grouptools.join('foo', 'foo', 'oink'): skip,
+}
+
+tr.calculate_group_totals()
+cls.test = tr.totals
+
+def test_root(self):
+"""results.TestrunResult.totals: The root is correct"""
+root = results.Totals()
+root['pass'] += 1
+root['fail'] += 1
+root['crash'] += 1
+root['skip'] += 1
+
+nt.assert_dict_equal(self.test['root'], root)
+
+def test_recurse(self):
+"""results.TestrunResult.totals: Recurses correctly"""
+expected = results.Totals()
+expected['fail'] += 1
+expected['crash'] += 1
+expected['skip'] += 1
+nt.assert_dict_equal(self.test['foo'], expected)
+
+def test_two_parents(self):
+"""results.TestrunResult.totals: Handles multiple parents correctly"""
+expected = results.Totals()
+expected['crash'] += 1
+expected['skip'] += 1
+nt.assert_dict_equal(self.test[grouptools.join

[Piglit] [PATCH 03/32] framework/backends/json.py: call set_meta() on resume

2015-09-11 Thread Dylan Baker
This is needed to make aggregate work correctly.

Signed-off-by: Dylan Baker 
---
 framework/backends/json.py | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/framework/backends/json.py b/framework/backends/json.py
index b747e29..12a5ac7 100644
--- a/framework/backends/json.py
+++ b/framework/backends/json.py
@@ -232,6 +232,7 @@ def _load(results_file):
 
 def _resume(results_dir):
 """Loads a partially completed json results directory."""
+# TODO: could probably use TestrunResult.from_dict here
 # Pylint can't infer that the json being loaded is a dict
 # pylint: disable=maybe-no-member
 assert os.path.isdir(results_dir), \
@@ -250,6 +251,8 @@ def _resume(results_dir):
 testrun.glxinfo = meta.get('glxinfo')
 testrun.lspci = meta.get('lspci')
 
+set_meta(testrun)
+
 # Load all of the test names and added them to the test list
 for file_ in os.listdir(os.path.join(results_dir, 'tests')):
 with open(os.path.join(results_dir, 'tests', file_), 'r') as f:
-- 
2.5.1

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


[Piglit] [PATCH 00/32] Rework summary

2015-09-11 Thread Dylan Baker
This is a pretty substantial patch series, much larger than what I
really wanted to produce, but at this point I don't see any way to
split it in a practical matter.

To sum of the changes of this series:
1) Replace the TestResult dict with an Object derived class, this allows
   us two advantages. First, it allows us to use Descriptors to create
   getters/setters. Second, it allows us to limit the memory consumption
   using __slots__
2) Replace the Summary class with several different classes. This uses
   more composition, which is nice. And also makes extensive use of lazy
   data creation. It also removes several data structures that are
   created, but really don't need to be stored, since their data is only
   used once.
3) Store the group totals in the json. This speeds up loading results by
   moving more of the code to one time use, and with compression it
   doesn't hurt too much
4) Fix the console generator. This generator was always a little weird,
   it now generates nice columns out of each result it's passed and
   generates proper comparisons. It also counts subtests now.

This is available at my github:
https://github.com/dcbaker/piglit submit/summary-rework

Dylan Baker (32):
  framework/programs/summary.py: Fix summaries compression when updating
  framework/grouptools: fix commonprefix to handle non-overlapping
values
  framework/backends/json.py: call set_meta() on resume
  framework: replace TestResult dict with an object
  framework/results: make the result of a test the worst of its subtests
  framework: move unicode conversion handling to TestResult
  framework/results.py: Add a method to TestrunResult to calculate
totals
  framework/results.py: Add a to_json method to the TestrunResults
  framework/results.py: add TestrunResult.from_dict method
  framework/backends/json.py: store totals data in json
  framework/summary.py: stop calculating totals at run time
  framework/summary.py: Make the text mode less weird
  framework/summary.py: make text columns width variable
  framework/summary.py: split diff generating code into toplevel
function
  framework/summary.py: Add a class to summary for calculating
categories
  framework/summary.py: split console generator from Summary object
  framework/summary.py: sort tests in console output
  framework/summary.py: calculate fractions and colors for html on the
fly
  framework/summary.py: simplify templates by using a TemplateLookup
  framework/summary.py: remove the Summary object.
  framework/summary.py: add helper to turn times into time deltas
  framework/summary.py: drop HTMLIndex class
  framework/summary.py: add a module docstring
  framework/summary.py: update copyright header
  framework/status.py: Speed up status_lookup
  framework/tests/summary_tests.py: Add a few additional tests
  framework/summary.py: split summary module into a package
  framework/summary/console_.py: split summary printer out
  framework/summary/console_.py: split the code print tests out
  framework/summary/html_.py: split the html function
  framework/backends.json.py: dont resume if results.json. exists
  framework/backends.json.py: use TestrunResult.from_dict for resume

 framework/backends/abstract.py   |   2 +-
 framework/backends/json.py   | 114 +++--
 framework/backends/junit.py  |  30 +-
 framework/core.py|  21 +
 framework/dmesg.py   |   9 +-
 framework/grouptools.py  |   6 +-
 framework/programs/run.py|   2 +-
 framework/programs/summary.py|  29 +-
 framework/results.py | 258 +--
 framework/status.py  |  30 +-
 framework/summary.py | 620 ---
 framework/summary/__init__.py|  29 ++
 framework/summary/common.py  | 317 ++
 framework/summary/console_.py| 113 +
 framework/summary/html_.py   | 165 +++
 framework/test/base.py   |  73 ++--
 framework/test/deqp.py   |  10 +-
 framework/test/gleantest.py  |   6 +-
 framework/test/gtest.py  |   8 +-
 framework/test/oclconform.py |   6 +-
 framework/test/piglit_test.py|   7 +-
 framework/tests/base_tests.py|  38 +-
 framework/tests/compressed_backend_tests.py  |   3 +-
 framework/tests/deqp_tests.py|  16 +-
 framework/tests/dmesg_tests.py   |  51 ++-
 framework/tests/gleantest_tests.py   |   4 +-
 framework/tests/grouptools_tests.py  |   5 +
 framework/tests/json_backend_tests.py|  66 +--
 framework/tests/json_results_update_tests.py | 134 +-
 framework/tests/json_tests.py|   4 +-
 framework/tests/junit_backends_tests.py  |  89 ++--
 framework/tests/piglit_tes

[Piglit] [PATCH 02/32] framework/grouptools: fix commonprefix to handle non-overlapping values

2015-09-11 Thread Dylan Baker
Currently if commonprefix is passed ['foo', 'bar'] it will pass an empty
list to join, which requires at least one argument to work. This will
cause an exception to be raised. Rather than doing that, we should check
that there are common values, and just return '' if there isn't.

Signed-off-by: Dylan Baker 
---
 framework/grouptools.py | 6 +-
 framework/tests/grouptools_tests.py | 5 +
 2 files changed, 10 insertions(+), 1 deletion(-)

diff --git a/framework/grouptools.py b/framework/grouptools.py
index b223bf4..62d3f9c 100644
--- a/framework/grouptools.py
+++ b/framework/grouptools.py
@@ -94,7 +94,11 @@ def commonprefix(args):
 else:
 break
 
-return join(*common)
+# Join needs at least one element to join
+if common:
+return join(*common)
+else:
+return ''
 
 
 def join(first, *args):
diff --git a/framework/tests/grouptools_tests.py 
b/framework/tests/grouptools_tests.py
index f36e350..acab7ed 100644
--- a/framework/tests/grouptools_tests.py
+++ b/framework/tests/grouptools_tests.py
@@ -114,3 +114,8 @@ def test_join_empty():
 expected = 'spec'
 test = grouptools.join('', 'spec')
 nt.eq_(expected, test)
+
+
+def test_commonprefix_none():
+"""grouptools.commonprefix: returns '' when no values are the same"""
+nt.eq_('', grouptools.commonprefix(['foo', 'bar']))
-- 
2.5.1

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


[Piglit] [PATCH 01/32] framework/programs/summary.py: Fix summaries compression when updating

2015-09-11 Thread Dylan Baker
This fixes a bug where updating a json results version via any summary
except aggregate will new honor the value set in piglit.conf. This patch
corrects this by copying the code from aggregate.

Signed-off-by: Dylan Baker 
---
 framework/programs/summary.py | 23 +--
 1 file changed, 17 insertions(+), 6 deletions(-)

diff --git a/framework/programs/summary.py b/framework/programs/summary.py
index 716614b..939bfd9 100644
--- a/framework/programs/summary.py
+++ b/framework/programs/summary.py
@@ -45,7 +45,11 @@ def html(input_):
 statuses = set(str(s) for s in status.ALL)
 statuses.add('all')
 
-parser = argparse.ArgumentParser()
+"""Combine files in a tests/ directory into a single results file."""
+unparsed = parsers.parse_config(input_)[1]
+
+# Adding the parent is necissary to get the help options
+parser = argparse.ArgumentParser(parents=[parsers.CONFIG])
 parser.add_argument("-o", "--overwrite",
 action="store_true",
 help="Overwrite existing directories")
@@ -70,7 +74,7 @@ def html(input_):
 metavar="",
 nargs="*",
 help="Results files to include in HTML")
-args = parser.parse_args(input_)
+args = parser.parse_args(unparsed)
 
 # If args.list and args.resultsFiles are empty, then raise an error
 if not args.list and not args.resultsFiles:
@@ -105,7 +109,11 @@ def html(input_):
 
 @exceptions.handler
 def console(input_):
-parser = argparse.ArgumentParser()
+"""Combine files in a tests/ directory into a single results file."""
+unparsed = parsers.parse_config(input_)[1]
+
+# Adding the parent is necissary to get the help options
+parser = argparse.ArgumentParser(parents=[parsers.CONFIG])
 
 # Set the -d and -s options as exclusive, since it's silly to call for diff
 # and then call for only summary
@@ -135,7 +143,7 @@ def console(input_):
 nargs="+",
 help="Space seperated paths to at least one results "
  "file")
-args = parser.parse_args(input_)
+args = parser.parse_args(unparsed)
 
 # Throw an error if -d/--diff is called, but only one results file is
 # provided
@@ -154,7 +162,10 @@ def console(input_):
 
 @exceptions.handler
 def csv(input_):
-parser = argparse.ArgumentParser()
+unparsed = parsers.parse_config(input_)[1]
+
+# Adding the parent is necissary to get the help options
+parser = argparse.ArgumentParser(parents=[parsers.CONFIG])
 parser.add_argument("-o", "--output",
 metavar="",
 action="store",
@@ -164,7 +175,7 @@ def csv(input_):
 parser.add_argument("testResults",
 metavar="",
 help="JSON results file to be converted")
-args = parser.parse_args(input_)
+args = parser.parse_args(unparsed)
 
 testrun = backends.load(args.testResults)
 
-- 
2.5.1

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


[Piglit] [PATCH 4/4] arb_copy_image-formats: add code to test GL_DEPTH32F_STENCIL8

2015-09-11 Thread Brian Paul
This internal depth/stencil format was added in GL 3.0
We need to handle a few things specially for this format:
1. The random float data must be in the range [0,1].
2. When we compare pixels, we must skip the 3 unused bytes in the pixel.

This patch also simplifies the array indexing code in check_texture().

Note: This format fails with NVIDIA's 352.21 driver (at least).
It passes with Mesa softpipe with the proposed GL_ARB_copy_image patch
series.
---
 tests/spec/arb_copy_image/formats.c | 59 +
 1 file changed, 54 insertions(+), 5 deletions(-)

diff --git a/tests/spec/arb_copy_image/formats.c 
b/tests/spec/arb_copy_image/formats.c
index eb0f314..1ecc411 100644
--- a/tests/spec/arb_copy_image/formats.c
+++ b/tests/spec/arb_copy_image/formats.c
@@ -172,6 +172,10 @@ struct texture_format formats[] = {
FORMAT(GL_COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT, GL_RGB, GL_BYTE, true, 
16, 4, 4),
 #endif
 
+#ifdef GL_DEPTH32F_STENCIL8
+FORMAT(GL_DEPTH32F_STENCIL8, GL_DEPTH_STENCIL, 
GL_FLOAT_32_UNSIGNED_INT_24_8_REV, false, 8, 1, 1),
+#endif
+
 #undef FORMAT
 };
 
@@ -256,6 +260,8 @@ is_format_supported(struct texture_format *format)
 #endif
case GL_STENCIL_INDEX8:
return piglit_is_extension_supported("GL_ARB_texture_stencil8");
+   case GL_DEPTH32F_STENCIL8:
+   return piglit_get_gl_version() >= 30;
}
 
return true;
@@ -409,6 +415,24 @@ setup_test_data(struct texture_format *src_format,
rand_int = (int *)(rand_data + data_size);
for (i = 0; i < data_size / sizeof(float); ++i)
dst_float[i] = rand_int[i] / (float)INT16_MAX;
+   }
+   else if (src_format->data_type == GL_FLOAT_32_UNSIGNED_INT_24_8_REV ||
+dst_format->data_type == GL_FLOAT_32_UNSIGNED_INT_24_8_REV) {
+   /* Use float values in [0,1].  The stencil values will
+* be the least significant 8 bits in the dwords at odd
+* offsets. */
+   float *src_float = (float *)src_data;
+   float *dst_float = (float *)dst_data;
+   rand_int = (int *)rand_data;
+   for (i = 0; i < data_size / sizeof(float); ++i) {
+   src_float[i] = (rand_int[i] & 0x) / 65535.0f;
+   assert(src_float[i] <= 1.0f);
+   }
+   rand_int = (int *)(rand_data + data_size);
+   for (i = 0; i < data_size / sizeof(float); ++i) {
+   dst_float[i] = (rand_int[i] & 0x) / 65535.0f;
+   assert(dst_float[i] <= 1.0f);
+   }
} else {
memcpy(src_data, rand_data, data_size);
memcpy(dst_data, rand_data + data_size, data_size);
@@ -708,6 +732,32 @@ run_multisample_test(struct texture_format *src_format,
return pass ? PIGLIT_PASS : PIGLIT_FAIL;
 }
 
+
+/** test if two pixels are equal, according to the format */
+static bool
+pixels_equal(const void *p1, const void *p2,
+const struct texture_format *format)
+{
+   if (format->data_type == GL_FLOAT_32_UNSIGNED_INT_24_8_REV) {
+   /* don't compare the 3 unused bytes which pad the
+* stencil value.
+*/
+   const float *f1 = (const float *) p1;
+   const float *f2 = (const float *) p2;
+   const GLuint *b1 = (const GLuint *) p1;
+   const GLuint *b2 = (const GLuint *) p2;
+   if (f1[0] != f2[0])
+   return false;
+   if ((b1[1] & 0xff) != (b2[1] & 0xff))
+   return false;
+   return true;
+   }
+   else {
+   return memcmp(p1, p2, format->bytes) == 0;
+   }
+}
+
+
 static bool
 check_texture(GLuint texture, unsigned level,
  const struct texture_format *format, const unsigned char *data)
@@ -731,19 +781,18 @@ check_texture(GLuint texture, unsigned level,
passrate = 0;
for (j = 0; j < TEX_SIZE; ++j) {
for (i = 0; i < TEX_SIZE; ++i) {
-   if (memcmp(tex_data + ((j * TEX_SIZE) + i) * 
format->bytes,
-  data + ((j * TEX_SIZE) + i) * format->bytes,
-  format->bytes) == 0) {
+   int pos = ((j * TEX_SIZE) + i) * format->bytes;
+   if (pixels_equal(tex_data + pos, data + pos, format)) {
passrate += 1;
} else {
fprintf(stdout, "texel mismatch at (%d, %d); 
expected 0x",
i, j);
for (k = format->bytes - 1; k >= 0; --k)
-   fprintf(stdout, "%02x", data[((j * 
TEX_SIZE) + i) * format->bytes + k]);
+   fprintf(stdout, "%02x", data[po

[Piglit] [PATCH 3/4] arb_copy_image-formats: exit loops upon pixel mismatch

2015-09-11 Thread Brian Paul
Instead of printing potentially a thousand error messages when
there's a failure.

Also, some minor code reformatting.
---
 tests/spec/arb_copy_image/formats.c | 9 +++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/tests/spec/arb_copy_image/formats.c 
b/tests/spec/arb_copy_image/formats.c
index 787194b..eb0f314 100644
--- a/tests/spec/arb_copy_image/formats.c
+++ b/tests/spec/arb_copy_image/formats.c
@@ -747,6 +747,7 @@ check_texture(GLuint texture, unsigned level,
fprintf(stdout, ".\n");
 
pass = false;
+   i = j = TEX_SIZE; /* exit loops upon error */
}
}
}
@@ -803,7 +804,9 @@ run_test(struct texture_format *src_format, struct 
texture_format *dst_format)
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
pass &= piglit_check_gl_error(GL_NO_ERROR);
-   if (!pass) goto cleanup;
+   if (!pass)
+   goto cleanup;
+
warn |= !check_texture(texture[0], src_level, src_format, src_data);
 
dst_width = TEX_SIZE * dst_format->block_width;
@@ -839,7 +842,9 @@ run_test(struct texture_format *src_format, struct 
texture_format *dst_format)
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
pass &= piglit_check_gl_error(GL_NO_ERROR);
-   if (!pass) goto cleanup;
+   if (!pass)
+   goto cleanup;
+
warn |= !check_texture(texture[1], dst_level, dst_format, dst_data);
 
glCopyImageSubData(texture[0], GL_TEXTURE_2D, src_level,
-- 
1.9.1

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


[Piglit] [PATCH 1/4] arb_texture_view: alphabetize program list

2015-09-11 Thread Brian Paul
---
 tests/spec/arb_texture_view/CMakeLists.gl.txt | 28 +--
 1 file changed, 14 insertions(+), 14 deletions(-)

diff --git a/tests/spec/arb_texture_view/CMakeLists.gl.txt 
b/tests/spec/arb_texture_view/CMakeLists.gl.txt
index 88489ad..19994a6 100644
--- a/tests/spec/arb_texture_view/CMakeLists.gl.txt
+++ b/tests/spec/arb_texture_view/CMakeLists.gl.txt
@@ -9,26 +9,26 @@ link_libraries(
${OPENGL_glu_LIBRARY}
)
 
+piglit_add_executable(arb_texture_view-clear-into-view-2d-array 
clear-into-view-2d-array.c common.c)
+piglit_add_executable(arb_texture_view-clear-into-view-2d clear-into-view-2d.c 
common.c)
+piglit_add_executable(arb_texture_view-clear-into-view-layered 
clear-into-view-layered.c common.c)
+piglit_add_executable(arb_texture_view-copytexsubimage-layers 
copytexsubimage-layers.c common.c)
 piglit_add_executable(arb_texture_view-cubemap-view cubemap-view.c)
+piglit_add_executable(arb_texture_view-formats formats.c common.c)
 piglit_add_executable(arb_texture_view-getteximage-srgb getteximage-srgb.c)
-piglit_add_executable(arb_texture_view-texture-immutable-levels 
texture-immutable-levels.c)
+piglit_add_executable(arb_texture_view-lifetime-format lifetime_format.c 
common.c)
 piglit_add_executable(arb_texture_view-max-level max-level.c)
 piglit_add_executable(arb_texture_view-params params.c)
-piglit_add_executable(arb_texture_view-formats formats.c common.c)
-piglit_add_executable(arb_texture_view-targets targets.c common.c)
 piglit_add_executable(arb_texture_view-queries queries.c)
-piglit_add_executable(arb_texture_view-rendering-target rendering_target.c 
common.c)
-piglit_add_executable(arb_texture_view-rendering-levels rendering_levels.c 
common.c)
-piglit_add_executable(arb_texture_view-rendering-layers rendering_layers.c 
common.c)
-piglit_add_executable(arb_texture_view-lifetime-format lifetime_format.c 
common.c)
-piglit_add_executable(arb_texture_view-texsubimage-levels texsubimage-levels.c 
common.c)
-piglit_add_executable(arb_texture_view-texsubimage-layers texsubimage-layers.c 
common.c)
-piglit_add_executable(arb_texture_view-clear-into-view-2d clear-into-view-2d.c 
common.c)
-piglit_add_executable(arb_texture_view-clear-into-view-2d-array 
clear-into-view-2d-array.c common.c)
-piglit_add_executable(arb_texture_view-clear-into-view-layered 
clear-into-view-layered.c common.c)
 piglit_add_executable(arb_texture_view-rendering-formats rendering-formats.c)
-piglit_add_executable(arb_texture_view-copytexsubimage-layers 
copytexsubimage-layers.c common.c)
-piglit_add_executable(arb_texture_view-sampling-2d-array-as-cubemap 
sampling-2d-array-as-cubemap.c)
+piglit_add_executable(arb_texture_view-rendering-layers rendering_layers.c 
common.c)
+piglit_add_executable(arb_texture_view-rendering-levels rendering_levels.c 
common.c)
+piglit_add_executable(arb_texture_view-rendering-target rendering_target.c 
common.c)
 piglit_add_executable(arb_texture_view-sampling-2d-array-as-cubemap-array 
sampling-2d-array-as-cubemap-array.c)
+piglit_add_executable(arb_texture_view-sampling-2d-array-as-cubemap 
sampling-2d-array-as-cubemap.c)
+piglit_add_executable(arb_texture_view-targets targets.c common.c)
+piglit_add_executable(arb_texture_view-texsubimage-layers texsubimage-layers.c 
common.c)
+piglit_add_executable(arb_texture_view-texsubimage-levels texsubimage-levels.c 
common.c)
+piglit_add_executable(arb_texture_view-texture-immutable-levels 
texture-immutable-levels.c)
 
 # vim: ft=cmake:
-- 
1.9.1

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


[Piglit] [PATCH 2/4] arb_copy_image: alphabetize program list

2015-09-11 Thread Brian Paul
---
 tests/spec/arb_copy_image/CMakeLists.gl.txt | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/tests/spec/arb_copy_image/CMakeLists.gl.txt 
b/tests/spec/arb_copy_image/CMakeLists.gl.txt
index 90e9270..3b36b45 100644
--- a/tests/spec/arb_copy_image/CMakeLists.gl.txt
+++ b/tests/spec/arb_copy_image/CMakeLists.gl.txt
@@ -8,11 +8,11 @@ link_libraries (
${OPENGL_gl_LIBRARY}
 )
 
-piglit_add_executable (arb_copy_image-simple simple.c)
 piglit_add_executable (arb_copy_image-api_errors api_errors.c)
-piglit_add_executable (arb_copy_image-targets targets.c)
-piglit_add_executable (arb_copy_image-formats formats.c)
 piglit_add_executable (arb_copy_image-format-swizzle format-swizzle.c)
+piglit_add_executable (arb_copy_image-formats formats.c)
+piglit_add_executable (arb_copy_image-simple simple.c)
 piglit_add_executable (arb_copy_image-srgb-copy srgb-copy.c)
+piglit_add_executable (arb_copy_image-targets targets.c)
 
 # vim: ft=cmake:
-- 
1.9.1

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


[Piglit] [PATCH 02/32] framework/grouptools: fix commonprefix to handle non-overlapping values

2015-09-11 Thread Dylan Baker
Currently if commonprefix is passed ['foo', 'bar'] it will pass an empty
list to join, which requires at least one argument to work. This will
cause an exception to be raised. Rather than doing that, we should check
that there are common values, and just return '' if there isn't.

Signed-off-by: Dylan Baker 
---
 framework/grouptools.py | 6 +-
 framework/tests/grouptools_tests.py | 5 +
 2 files changed, 10 insertions(+), 1 deletion(-)

diff --git a/framework/grouptools.py b/framework/grouptools.py
index b223bf4..62d3f9c 100644
--- a/framework/grouptools.py
+++ b/framework/grouptools.py
@@ -94,7 +94,11 @@ def commonprefix(args):
 else:
 break
 
-return join(*common)
+# Join needs at least one element to join
+if common:
+return join(*common)
+else:
+return ''
 
 
 def join(first, *args):
diff --git a/framework/tests/grouptools_tests.py 
b/framework/tests/grouptools_tests.py
index f36e350..acab7ed 100644
--- a/framework/tests/grouptools_tests.py
+++ b/framework/tests/grouptools_tests.py
@@ -114,3 +114,8 @@ def test_join_empty():
 expected = 'spec'
 test = grouptools.join('', 'spec')
 nt.eq_(expected, test)
+
+
+def test_commonprefix_none():
+"""grouptools.commonprefix: returns '' when no values are the same"""
+nt.eq_('', grouptools.commonprefix(['foo', 'bar']))
-- 
2.5.1

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


[Piglit] [PATCH 01/32] framework/programs/summary.py: Fix summaries compression when updating

2015-09-11 Thread Dylan Baker
This fixes a bug where updating a json results version via any summary
except aggregate will new honor the value set in piglit.conf. This patch
corrects this by copying the code from aggregate.

Signed-off-by: Dylan Baker 
---
 framework/programs/summary.py | 23 +--
 1 file changed, 17 insertions(+), 6 deletions(-)

diff --git a/framework/programs/summary.py b/framework/programs/summary.py
index 716614b..939bfd9 100644
--- a/framework/programs/summary.py
+++ b/framework/programs/summary.py
@@ -45,7 +45,11 @@ def html(input_):
 statuses = set(str(s) for s in status.ALL)
 statuses.add('all')
 
-parser = argparse.ArgumentParser()
+"""Combine files in a tests/ directory into a single results file."""
+unparsed = parsers.parse_config(input_)[1]
+
+# Adding the parent is necissary to get the help options
+parser = argparse.ArgumentParser(parents=[parsers.CONFIG])
 parser.add_argument("-o", "--overwrite",
 action="store_true",
 help="Overwrite existing directories")
@@ -70,7 +74,7 @@ def html(input_):
 metavar="",
 nargs="*",
 help="Results files to include in HTML")
-args = parser.parse_args(input_)
+args = parser.parse_args(unparsed)
 
 # If args.list and args.resultsFiles are empty, then raise an error
 if not args.list and not args.resultsFiles:
@@ -105,7 +109,11 @@ def html(input_):
 
 @exceptions.handler
 def console(input_):
-parser = argparse.ArgumentParser()
+"""Combine files in a tests/ directory into a single results file."""
+unparsed = parsers.parse_config(input_)[1]
+
+# Adding the parent is necissary to get the help options
+parser = argparse.ArgumentParser(parents=[parsers.CONFIG])
 
 # Set the -d and -s options as exclusive, since it's silly to call for diff
 # and then call for only summary
@@ -135,7 +143,7 @@ def console(input_):
 nargs="+",
 help="Space seperated paths to at least one results "
  "file")
-args = parser.parse_args(input_)
+args = parser.parse_args(unparsed)
 
 # Throw an error if -d/--diff is called, but only one results file is
 # provided
@@ -154,7 +162,10 @@ def console(input_):
 
 @exceptions.handler
 def csv(input_):
-parser = argparse.ArgumentParser()
+unparsed = parsers.parse_config(input_)[1]
+
+# Adding the parent is necissary to get the help options
+parser = argparse.ArgumentParser(parents=[parsers.CONFIG])
 parser.add_argument("-o", "--output",
 metavar="",
 action="store",
@@ -164,7 +175,7 @@ def csv(input_):
 parser.add_argument("testResults",
 metavar="",
 help="JSON results file to be converted")
-args = parser.parse_args(input_)
+args = parser.parse_args(unparsed)
 
 testrun = backends.load(args.testResults)
 
-- 
2.5.1

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


[Piglit] [PATCH 03/32] framework/backends/json.py: call set_meta() on resume

2015-09-11 Thread Dylan Baker
This is needed to make aggregate work correctly.

Signed-off-by: Dylan Baker 
---
 framework/backends/json.py | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/framework/backends/json.py b/framework/backends/json.py
index b747e29..12a5ac7 100644
--- a/framework/backends/json.py
+++ b/framework/backends/json.py
@@ -232,6 +232,7 @@ def _load(results_file):
 
 def _resume(results_dir):
 """Loads a partially completed json results directory."""
+# TODO: could probably use TestrunResult.from_dict here
 # Pylint can't infer that the json being loaded is a dict
 # pylint: disable=maybe-no-member
 assert os.path.isdir(results_dir), \
@@ -250,6 +251,8 @@ def _resume(results_dir):
 testrun.glxinfo = meta.get('glxinfo')
 testrun.lspci = meta.get('lspci')
 
+set_meta(testrun)
+
 # Load all of the test names and added them to the test list
 for file_ in os.listdir(os.path.join(results_dir, 'tests')):
 with open(os.path.join(results_dir, 'tests', file_), 'r') as f:
-- 
2.5.1

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


[Piglit] (no subject)

2015-09-11 Thread Dylan Baker
From a805e233404e731467e469745d926f05997643ea Mon Sep 17 00:00:00 2001
From: Dylan Baker 
Date: Fri, 11 Sep 2015 14:59:27 -0700
Subject: [PATCH 00/32] Rework summary

This is a pretty substantial patch series, much larger than what I
really wanted to produce, but at this point I don't see any way to
split it in a practical matter.

To sum of the changes of this series:
1) Replace the TestResult dict with an Object derived class, this allows
   us two advantages. First, it allows us to use Descriptors to create
   getters/setters. Second, it allows us to limit the memory consumption
   using __slots__
2) Replace the Summary class with several different classes. This uses
   more composition, which is nice. And also makes extensive use of lazy
   data creation. It also removes several data structures that are
   created, but really don't need to be stored, since their data is only
   used once.
3) Store the group totals in the json. This speeds up loading results by
   moving more of the code to one time use, and with compression it
   doesn't hurt too much
4) Fix the console generator. This generator was always a little weird,
   it now generates nice columns out of each result it's passed and
   generates proper comparisons. It also counts subtests now.

This is available at my github:
https://github.com/dcbaker/piglit submit/summary-rework

Dylan Baker (32):
  framework/programs/summary.py: Fix summaries compression when updating
  framework/grouptools: fix commonprefix to handle non-overlapping
values
  framework/backends/json.py: call set_meta() on resume
  framework: replace TestResult dict with an object
  framework/results: make the result of a test the worst of its subtests
  framework: move unicode conversion handling to TestResult
  framework/results.py: Add a method to TestrunResult to calculate
totals
  framework/results.py: Add a to_json method to the TestrunResults
  framework/results.py: add TestrunResult.from_dict method
  framework/backends/json.py: store totals data in json
  framework/summary.py: stop calculating totals at run time
  framework/summary.py: Make the text mode less weird
  framework/summary.py: make text columns width variable
  framework/summary.py: split diff generating code into toplevel
function
  framework/summary.py: Add a class to summary for calculating
categories
  framework/summary.py: split console generator from Summary object
  framework/summary.py: sort tests in console output
  framework/summary.py: calculate fractions and colors for html on the
fly
  framework/summary.py: simplify templates by using a TemplateLookup
  framework/summary.py: remove the Summary object.
  framework/summary.py: add helper to turn times into time deltas
  framework/summary.py: drop HTMLIndex class
  framework/summary.py: add a module docstring
  framework/summary.py: update copyright header
  framework/status.py: Speed up status_lookup
  framework/tests/summary_tests.py: Add a few additional tests
  framework/summary.py: split summary module into a package
  framework/summary/console_.py: split summary printer out
  framework/summary/console_.py: split the code print tests out
  framework/summary/html_.py: split the html function
  framework/backends.json.py: dont resume if results.json. exists
  framework/backends.json.py: use TestrunResult.from_dict for resume

 framework/backends/abstract.py   |   2 +-
 framework/backends/json.py   | 114 +++--
 framework/backends/junit.py  |  30 +-
 framework/core.py|  21 +
 framework/dmesg.py   |   9 +-
 framework/grouptools.py  |   6 +-
 framework/programs/run.py|   2 +-
 framework/programs/summary.py|  29 +-
 framework/results.py | 258 +--
 framework/status.py  |  30 +-
 framework/summary.py | 620 ---
 framework/summary/__init__.py|  29 ++
 framework/summary/common.py  | 317 ++
 framework/summary/console_.py| 113 +
 framework/summary/html_.py   | 165 +++
 framework/test/base.py   |  73 ++--
 framework/test/deqp.py   |  10 +-
 framework/test/gleantest.py  |   6 +-
 framework/test/gtest.py  |   8 +-
 framework/test/oclconform.py |   6 +-
 framework/test/piglit_test.py|   7 +-
 framework/tests/base_tests.py|  38 +-
 framework/tests/compressed_backend_tests.py  |   3 +-
 framework/tests/deqp_tests.py|  16 +-
 framework/tests/dmesg_tests.py   |  51 ++-
 framework/tests/gleantest_tests.py   |   4 +-
 framework/tests/grouptools_tests.py  |   5 +
 framework/tests/json_backend_tests.py|  66 +--
 framework/tests/json_results_u

Re: [Piglit] [PATCH v3] Port arb occlusion query conformance tests from Glean to Piglit

2015-09-11 Thread Brian Paul

On 09/11/2015 12:44 PM, Juliet Fru wrote:

This test replaces the original glean toccluqry.cpp test.
---
  tests/all.py   |   1 +
  tests/spec/arb_occlusion_query/CMakeLists.gl.txt   |   1 +
  .../arb_occlusion_query/occlusion_query_conform.c  | 587 +
  3 files changed, 589 insertions(+)
  create mode 100644 tests/spec/arb_occlusion_query/occlusion_query_conform.c

diff --git a/tests/all.py b/tests/all.py
index fe088f5..748165f 100644
--- a/tests/all.py
+++ b/tests/all.py
@@ -2115,6 +2115,7 @@ with profile.group_manager(
  PiglitGLTest,
  grouptools.join('spec', 'ARB_occlusion_query')) as g:
  g(['occlusion_query'])
+g(['occlusion_query_conformance'])
  g(['occlusion_query_lifetime'])
  g(['occlusion_query_meta_fragments'])
  g(['occlusion_query_meta_no_fragments'])
diff --git a/tests/spec/arb_occlusion_query/CMakeLists.gl.txt 
b/tests/spec/arb_occlusion_query/CMakeLists.gl.txt
index 01a499d..23a19e4 100644
--- a/tests/spec/arb_occlusion_query/CMakeLists.gl.txt
+++ b/tests/spec/arb_occlusion_query/CMakeLists.gl.txt
@@ -10,6 +10,7 @@ link_libraries (
  )

  piglit_add_executable (occlusion_query occlusion_query.c)
+piglit_add_executable (occlusion_query_conformance occlusion_query_conform.c)
  piglit_add_executable (occlusion_query_lifetime occlusion_query_lifetime.c)
  piglit_add_executable (occlusion_query_meta_no_fragments 
occlusion_query_meta_no_fragments.c)
  piglit_add_executable (occlusion_query_meta_fragments 
occlusion_query_meta_fragments.c)
diff --git a/tests/spec/arb_occlusion_query/occlusion_query_conform.c 
b/tests/spec/arb_occlusion_query/occlusion_query_conform.c
new file mode 100644
index 000..d6d5ea4
--- /dev/null
+++ b/tests/spec/arb_occlusion_query/occlusion_query_conform.c
@@ -0,0 +1,587 @@
+/*  BEGIN_COPYRIGHT -*- glean -*-
+ *
+ *  Copyright (C) 1999  Allen Akin   All Rights Reserved.
+ *  Copyright (C) 2015  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.
+ *
+ * END_COPYRIGHT
+ */
+
+/** @file occlusion_query_conform.c
+ *
+ * Conformance test on ARB_occlusion_query extension.
+ *
+ * Authors:
+ * Wei Wang 
+ * Adapted to Piglit by Juliet Fru , September 2015
+ */
+
+#include "piglit-util-gl.h"
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+PIGLIT_GL_TEST_CONFIG_BEGIN config.supports_gl_compat_version = 10;
+
+
+config.window_width = 160;
+config.window_height = 160;
+config.window_visual =
+   PIGLIT_GL_VISUAL_RGB | PIGLIT_GL_VISUAL_DOUBLE |
+   PIGLIT_GL_VISUAL_DEPTH;
+
+PIGLIT_GL_TEST_CONFIG_END static GLuint
+find_unused_id(void)
+{


Looks like the formatting got really messed up there.  It should be 
something like:


...
PIGLIT_GL_TEST_CONFIG_END


static GLuint
find_unused_id(void)
{
...






+   GLuint id;
+   glGenQueries(1, &id);
+   return id;
+
+}
+
+/* If multiple queries are issued on the same target and id prior to calling
+ * GetQueryObject[u]iVARB, the result returned will always be from the last
+ * query issued.  The results from any queries before the last one will be lost
+ * if the results are not retrieved before starting a new query on the same
+ * target and id.
+ */
+static bool
+conformOQ_GetObjivAval_multi1(GLuint id)
+{
+   GLint ready;
+   GLuint passed = 0;
+
+   glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
+
+   glMatrixMode(GL_PROJECTION);
+   glPushMatrix();
+   glLoadIdentity();
+   glOrtho(-1.0, 1.0, -1.0, 1.0, 0.0, 25.0);
+
+   glMatrixMode(GL_MODELVIEW);
+   glPushMatrix();
+   glLoadIdentity();
+   glTranslatef(0.0, 0.0, -10.0);
+
+   /* draw the occluder (red) */
+   glColorMask(1, 1, 1, 1);
+   glDepthMask(GL_TRUE);
+   glColor3f(1, 0, 0);
+   piglit_draw_rect(-0.5, 0.5, 0.5, -0.5);
+
+   glPushMatrix();
+   glTranslatef(0.0, 0.0, 

Re: [Piglit] [PATCH v7] Port basic GL rendering test from Glean to Piglit

2015-09-11 Thread Brian Paul

On 09/11/2015 12:55 PM, Juliet Fru wrote:

This test replaces the original glean tpaths.cpp test.
---
  tests/all.py|   1 +
  tests/spec/gl-1.0/CMakeLists.gl.txt |   1 +
  tests/spec/gl-1.0/no-op-paths.c | 294 
  3 files changed, 296 insertions(+)
  create mode 100644 tests/spec/gl-1.0/no-op-paths.c

diff --git a/tests/all.py b/tests/all.py
index fcfc5cd..85973d6 100644
--- a/tests/all.py
+++ b/tests/all.py
@@ -1000,6 +1000,7 @@ with profile.group_manager(
  g(['gl-1.0-ortho-pos'])
  g(['gl-1.0-readpixsanity'])
  g(['gl-1.0-logicop'])
+g(['gl-1.0-no-op-paths'])

  with profile.group_manager(
  PiglitGLTest,
diff --git a/tests/spec/gl-1.0/CMakeLists.gl.txt 
b/tests/spec/gl-1.0/CMakeLists.gl.txt
index d04b835..7a7f508 100644
--- a/tests/spec/gl-1.0/CMakeLists.gl.txt
+++ b/tests/spec/gl-1.0/CMakeLists.gl.txt
@@ -22,6 +22,7 @@ piglit_add_executable (gl-1.0-front-invalidate-back 
front-invalidate-back.c)
  piglit_add_executable (gl-1.0-logicop logicop.c)
  piglit_add_executable (gl-1.0-long-dlist long-dlist.c)
  piglit_add_executable (gl-1.0-ortho-pos orthpos.c)
+piglit_add_executable (gl-1.0-no-op-paths no-op-paths.c)
  piglit_add_executable (gl-1.0-polygon-line-aa polygon-line-aa.c)
  piglit_add_executable (gl-1.0-push-no-attribs push-no-attribs.c)
  piglit_add_executable (gl-1.0-readpixsanity readpix.c)
diff --git a/tests/spec/gl-1.0/no-op-paths.c b/tests/spec/gl-1.0/no-op-paths.c
new file mode 100644
index 000..a573b07
--- /dev/null
+++ b/tests/spec/gl-1.0/no-op-paths.c
@@ -0,0 +1,294 @@
+/*  BEGIN_COPYRIGHT -*- glean -*-
+ *
+ *  Copyright (C) 1999  Allen Akin   All Rights Reserved.
+ *  Copyright (C) 2015  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.
+ *
+ *  END_COPYRIGHT
+ */
+/** @file paths.c
+ *
+ *  Test basic GL rendering paths.
+ *
+ *
+ * Based on the original Glean tpaths.cpp test, this test verifies
+ * that basic, trival OpenGL paths work as expected. For example,
+ * glAlphaFunc(GL_GEQUAL, 0.0) should always pass and
+ * glAlphaFunc(GL_LESS, 0.0) should always fail.  We setup trivial
+ * pass and fail conditions for each of alpha test, blending, color mask,
+ * depth test, logic ops, scissor, stencil, stipple, and texture and
+ * make sure they work as expected.  We also setup trival-pass for all
+ * these paths simultaneously and test that as well.
+ *
+ * To test for pass/fail we examine the color buffer for white or black,
+ * respectively.
+ *
+ * Authors:
+ * Brian Paul 
+ * Adapted to Piglit by Juliet Fru , August 2015.
+ */
+
+#include "piglit-util-gl.h"
+
+PIGLIT_GL_TEST_CONFIG_BEGIN config.supports_gl_compat_version = 10;
+
+config.window_visual = PIGLIT_GL_VISUAL_RGBA |
+   PIGLIT_GL_VISUAL_DOUBLE | PIGLIT_GL_VISUAL_DEPTH |
+   PIGLIT_GL_VISUAL_STENCIL;
+
+PIGLIT_GL_TEST_CONFIG_END enum path
+{
+   ALPHA,
+   BLEND,
+   COLOR_MASK,
+   DEPTH,
+   LOGIC,
+   SCISSOR,
+   STENCIL,
+   STIPPLE,
+   TEXTURE,
+   NUM_PATHS   /* end-of-list token */
+};
+
+enum state
+{
+   DISABLE,
+   ALWAYS_PASS,
+   ALWAYS_FAIL
+};
+
+const char *
+path_name(enum path paths)
+{
+   switch (paths) {
+   case ALPHA:
+   return "Alpha Test";
+   case BLEND:
+   return "Blending";
+   case COLOR_MASK:
+   return "Color Mask";
+   case DEPTH:
+   return "Depth Test";
+   case LOGIC:
+   return "LogicOp";
+   case SCISSOR:
+   return "Scissor Test";
+   case STENCIL:
+   return "Stencil Test";
+   case STIPPLE:
+   return "Polygon Stipple";
+   case TEXTURE:
+   return "Modulated Texture";
+   case NUM_PATHS:
+   return "paths";
+   }
+}
+
+void
+s

[Piglit] [PATCH v7] Port basic GL rendering test from Glean to Piglit

2015-09-11 Thread Juliet Fru
This test replaces the original glean tpaths.cpp test.
---
 tests/all.py|   1 +
 tests/spec/gl-1.0/CMakeLists.gl.txt |   1 +
 tests/spec/gl-1.0/no-op-paths.c | 294 
 3 files changed, 296 insertions(+)
 create mode 100644 tests/spec/gl-1.0/no-op-paths.c

diff --git a/tests/all.py b/tests/all.py
index fcfc5cd..85973d6 100644
--- a/tests/all.py
+++ b/tests/all.py
@@ -1000,6 +1000,7 @@ with profile.group_manager(
 g(['gl-1.0-ortho-pos'])
 g(['gl-1.0-readpixsanity'])
 g(['gl-1.0-logicop'])
+g(['gl-1.0-no-op-paths'])
 
 with profile.group_manager(
 PiglitGLTest,
diff --git a/tests/spec/gl-1.0/CMakeLists.gl.txt 
b/tests/spec/gl-1.0/CMakeLists.gl.txt
index d04b835..7a7f508 100644
--- a/tests/spec/gl-1.0/CMakeLists.gl.txt
+++ b/tests/spec/gl-1.0/CMakeLists.gl.txt
@@ -22,6 +22,7 @@ piglit_add_executable (gl-1.0-front-invalidate-back 
front-invalidate-back.c)
 piglit_add_executable (gl-1.0-logicop logicop.c)
 piglit_add_executable (gl-1.0-long-dlist long-dlist.c)
 piglit_add_executable (gl-1.0-ortho-pos orthpos.c)
+piglit_add_executable (gl-1.0-no-op-paths no-op-paths.c)
 piglit_add_executable (gl-1.0-polygon-line-aa polygon-line-aa.c)
 piglit_add_executable (gl-1.0-push-no-attribs push-no-attribs.c)
 piglit_add_executable (gl-1.0-readpixsanity readpix.c)
diff --git a/tests/spec/gl-1.0/no-op-paths.c b/tests/spec/gl-1.0/no-op-paths.c
new file mode 100644
index 000..a573b07
--- /dev/null
+++ b/tests/spec/gl-1.0/no-op-paths.c
@@ -0,0 +1,294 @@
+/*  BEGIN_COPYRIGHT -*- glean -*-
+ *
+ *  Copyright (C) 1999  Allen Akin   All Rights Reserved.
+ *  Copyright (C) 2015  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.
+ *
+ *  END_COPYRIGHT
+ */
+/** @file paths.c
+ *
+ *  Test basic GL rendering paths.
+ *
+ *
+ * Based on the original Glean tpaths.cpp test, this test verifies
+ * that basic, trival OpenGL paths work as expected. For example,
+ * glAlphaFunc(GL_GEQUAL, 0.0) should always pass and
+ * glAlphaFunc(GL_LESS, 0.0) should always fail.  We setup trivial
+ * pass and fail conditions for each of alpha test, blending, color mask,
+ * depth test, logic ops, scissor, stencil, stipple, and texture and
+ * make sure they work as expected.  We also setup trival-pass for all
+ * these paths simultaneously and test that as well.
+ *
+ * To test for pass/fail we examine the color buffer for white or black,
+ * respectively.
+ *
+ * Authors:
+ * Brian Paul 
+ * Adapted to Piglit by Juliet Fru , August 2015.
+ */
+
+#include "piglit-util-gl.h"
+
+PIGLIT_GL_TEST_CONFIG_BEGIN config.supports_gl_compat_version = 10;
+
+config.window_visual = PIGLIT_GL_VISUAL_RGBA |
+   PIGLIT_GL_VISUAL_DOUBLE | PIGLIT_GL_VISUAL_DEPTH |
+   PIGLIT_GL_VISUAL_STENCIL;
+
+PIGLIT_GL_TEST_CONFIG_END enum path
+{
+   ALPHA,
+   BLEND,
+   COLOR_MASK,
+   DEPTH,
+   LOGIC,
+   SCISSOR,
+   STENCIL,
+   STIPPLE,
+   TEXTURE,
+   NUM_PATHS   /* end-of-list token */
+};
+
+enum state
+{
+   DISABLE,
+   ALWAYS_PASS,
+   ALWAYS_FAIL
+};
+
+const char *
+path_name(enum path paths)
+{
+   switch (paths) {
+   case ALPHA:
+   return "Alpha Test";
+   case BLEND:
+   return "Blending";
+   case COLOR_MASK:
+   return "Color Mask";
+   case DEPTH:
+   return "Depth Test";
+   case LOGIC:
+   return "LogicOp";
+   case SCISSOR:
+   return "Scissor Test";
+   case STENCIL:
+   return "Stencil Test";
+   case STIPPLE:
+   return "Polygon Stipple";
+   case TEXTURE:
+   return "Modulated Texture";
+   case NUM_PATHS:
+   return "paths";
+   }
+}
+
+void
+set_path_state(enum path paths, enum state states)
+{
+ 

[Piglit] [PATCH v3] Port arb occlusion query conformance tests from Glean to Piglit

2015-09-11 Thread Juliet Fru
This test replaces the original glean toccluqry.cpp test.
---
 tests/all.py   |   1 +
 tests/spec/arb_occlusion_query/CMakeLists.gl.txt   |   1 +
 .../arb_occlusion_query/occlusion_query_conform.c  | 587 +
 3 files changed, 589 insertions(+)
 create mode 100644 tests/spec/arb_occlusion_query/occlusion_query_conform.c

diff --git a/tests/all.py b/tests/all.py
index fe088f5..748165f 100644
--- a/tests/all.py
+++ b/tests/all.py
@@ -2115,6 +2115,7 @@ with profile.group_manager(
 PiglitGLTest,
 grouptools.join('spec', 'ARB_occlusion_query')) as g:
 g(['occlusion_query'])
+g(['occlusion_query_conformance'])
 g(['occlusion_query_lifetime'])
 g(['occlusion_query_meta_fragments'])
 g(['occlusion_query_meta_no_fragments'])
diff --git a/tests/spec/arb_occlusion_query/CMakeLists.gl.txt 
b/tests/spec/arb_occlusion_query/CMakeLists.gl.txt
index 01a499d..23a19e4 100644
--- a/tests/spec/arb_occlusion_query/CMakeLists.gl.txt
+++ b/tests/spec/arb_occlusion_query/CMakeLists.gl.txt
@@ -10,6 +10,7 @@ link_libraries (
 )
 
 piglit_add_executable (occlusion_query occlusion_query.c)
+piglit_add_executable (occlusion_query_conformance occlusion_query_conform.c)
 piglit_add_executable (occlusion_query_lifetime occlusion_query_lifetime.c)
 piglit_add_executable (occlusion_query_meta_no_fragments 
occlusion_query_meta_no_fragments.c)
 piglit_add_executable (occlusion_query_meta_fragments 
occlusion_query_meta_fragments.c)
diff --git a/tests/spec/arb_occlusion_query/occlusion_query_conform.c 
b/tests/spec/arb_occlusion_query/occlusion_query_conform.c
new file mode 100644
index 000..d6d5ea4
--- /dev/null
+++ b/tests/spec/arb_occlusion_query/occlusion_query_conform.c
@@ -0,0 +1,587 @@
+/*  BEGIN_COPYRIGHT -*- glean -*-
+ * 
+ *  Copyright (C) 1999  Allen Akin   All Rights Reserved.
+ *  Copyright (C) 2015  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.
+ *
+ * END_COPYRIGHT
+ */
+
+/** @file occlusion_query_conform.c
+ *
+ * Conformance test on ARB_occlusion_query extension.
+ *
+ * Authors:
+ * Wei Wang 
+ * Adapted to Piglit by Juliet Fru , September 2015
+ */
+
+#include "piglit-util-gl.h"
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+PIGLIT_GL_TEST_CONFIG_BEGIN config.supports_gl_compat_version = 10;
+
+
+config.window_width = 160;
+config.window_height = 160;
+config.window_visual =
+   PIGLIT_GL_VISUAL_RGB | PIGLIT_GL_VISUAL_DOUBLE |
+   PIGLIT_GL_VISUAL_DEPTH;
+
+PIGLIT_GL_TEST_CONFIG_END static GLuint
+find_unused_id(void)
+{
+   GLuint id;
+   glGenQueries(1, &id);
+   return id;
+
+}
+
+/* If multiple queries are issued on the same target and id prior to calling
+ * GetQueryObject[u]iVARB, the result returned will always be from the last
+ * query issued.  The results from any queries before the last one will be lost
+ * if the results are not retrieved before starting a new query on the same
+ * target and id.
+ */
+static bool
+conformOQ_GetObjivAval_multi1(GLuint id)
+{
+   GLint ready;
+   GLuint passed = 0;
+
+   glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
+
+   glMatrixMode(GL_PROJECTION);
+   glPushMatrix();
+   glLoadIdentity();
+   glOrtho(-1.0, 1.0, -1.0, 1.0, 0.0, 25.0);
+
+   glMatrixMode(GL_MODELVIEW);
+   glPushMatrix();
+   glLoadIdentity();
+   glTranslatef(0.0, 0.0, -10.0);
+
+   /* draw the occluder (red) */
+   glColorMask(1, 1, 1, 1);
+   glDepthMask(GL_TRUE);
+   glColor3f(1, 0, 0);
+   piglit_draw_rect(-0.5, 0.5, 0.5, -0.5);
+
+   glPushMatrix();
+   glTranslatef(0.0, 0.0, -5.0);
+   glColorMask(0, 0, 0, 0);
+   glDepthMask(GL_FALSE);
+
+   /* draw the 1st box (gren) which is occluded by the occluder partly */
+   glColor3f(0, 1, 0);
+   piglit_draw_rect(-0.51, 0.51, 0.51, 

[Piglit] [RFC PATCH 0/2] Add ARB_program_interface_query support to shader_runner

2015-09-11 Thread Samuel Iglesias Gonsalvez
Hello,

Recently, I have been working on enabling std430 support to Mesa. During the
review of the patches, I have been told to take a look at Ian's Stochastic
Search-Based Testing for Uniform Block Layouts [0] to improve the testing of
the std430 changes

Thanks Ian for your work! I found some bugs in my std430 code with this
testing :-)

I did some quick changes [1] to have it working for shader storage buffers and
std430. During that process, I found that we don't support
ARB_program_interface_query extension [2] queries in shader_runner.
Shader runner supports similar queries but only for uniforms.

These patches are the result of implementing buffer variable support to
that queries, but I think it is interesting to have a more generic API that
includes the rest of program interfaces (GL_UNIFORM, GL_PROGRAM_INPUT...).

So, I would like to reach a consensus with piglit community about the
format of the commands. My idea is to take the uniform queries as an example
but adapting the format to our needs. For example:

- Format of the command:
 active program_interface GL_INTERFACE_TYPE_ENUM var_name GL_PROPS_ENUM integer
 
or, if we include the GL type enum:

 active program_interface GL_INTERFACE_TYPE_ENUM var_name GL_PROPS_ENUM 
GL_TYPE_ENUM

So in practice you would add to the [test] section some code like this:

active program_interface GL_BUFFER_VARIABLE foo_name GL_ARRAY_SIZE 1
active program_interface GL_UNIFORM bar_name GL_TYPE GL_FLOAT_VEC4

What do you think?

Sam

[0] 
http://www.paranormal-entertainment.com/idr/blog/posts/2014-10-08T13:28:09Z-Stochastic_Search-Based_Testing_for_Uniform_Block_Layouts/
[1] Repo with latest code: g...@github.com:Igalia/piglit.git
Branch: ssbo-random-tests-std430-v2
[2] https://www.opengl.org/registry/specs/ARB/program_interface_query.txt


Samuel Iglesias Gonsalvez (2):
  shader_runner: make active_uniforms's all_types variable be global
  shader_runner: Add ARB_program_interface_query support to buffer
variables

 tests/shaders/shader_runner.c | 292 +++---
 1 file changed, 214 insertions(+), 78 deletions(-)

-- 
2.1.4

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


[Piglit] [RFC PATCH 1/2] shader_runner: make active_uniforms's all_types variable be global

2015-09-11 Thread Samuel Iglesias Gonsalvez
Signed-off-by: Samuel Iglesias Gonsalvez 
---
 tests/shaders/shader_runner.c | 156 +-
 1 file changed, 78 insertions(+), 78 deletions(-)

diff --git a/tests/shaders/shader_runner.c b/tests/shaders/shader_runner.c
index 0614c7f..7a647a1 100644
--- a/tests/shaders/shader_runner.c
+++ b/tests/shaders/shader_runner.c
@@ -158,6 +158,84 @@ enum comparison {
less_equal
 };
 
+static const struct string_to_enum all_types[] = {
+   ENUM_STRING(GL_FLOAT),
+   ENUM_STRING(GL_FLOAT_VEC2),
+   ENUM_STRING(GL_FLOAT_VEC3),
+   ENUM_STRING(GL_FLOAT_VEC4),
+   ENUM_STRING(GL_DOUBLE),
+   ENUM_STRING(GL_DOUBLE_VEC2),
+   ENUM_STRING(GL_DOUBLE_VEC3),
+   ENUM_STRING(GL_DOUBLE_VEC4),
+   ENUM_STRING(GL_INT),
+   ENUM_STRING(GL_INT_VEC2),
+   ENUM_STRING(GL_INT_VEC3),
+   ENUM_STRING(GL_INT_VEC4),
+   ENUM_STRING(GL_UNSIGNED_INT),
+   ENUM_STRING(GL_UNSIGNED_INT_VEC2),
+   ENUM_STRING(GL_UNSIGNED_INT_VEC3),
+   ENUM_STRING(GL_UNSIGNED_INT_VEC4),
+   ENUM_STRING(GL_BOOL),
+   ENUM_STRING(GL_BOOL_VEC2),
+   ENUM_STRING(GL_BOOL_VEC3),
+   ENUM_STRING(GL_BOOL_VEC4),
+   ENUM_STRING(GL_FLOAT_MAT2),
+   ENUM_STRING(GL_FLOAT_MAT3),
+   ENUM_STRING(GL_FLOAT_MAT4),
+   ENUM_STRING(GL_FLOAT_MAT2x3),
+   ENUM_STRING(GL_FLOAT_MAT2x4),
+   ENUM_STRING(GL_FLOAT_MAT3x2),
+   ENUM_STRING(GL_FLOAT_MAT3x4),
+   ENUM_STRING(GL_FLOAT_MAT4x2),
+   ENUM_STRING(GL_FLOAT_MAT4x3),
+   ENUM_STRING(GL_DOUBLE_MAT2),
+   ENUM_STRING(GL_DOUBLE_MAT3),
+   ENUM_STRING(GL_DOUBLE_MAT4),
+   ENUM_STRING(GL_DOUBLE_MAT2x3),
+   ENUM_STRING(GL_DOUBLE_MAT2x4),
+   ENUM_STRING(GL_DOUBLE_MAT3x2),
+   ENUM_STRING(GL_DOUBLE_MAT3x4),
+   ENUM_STRING(GL_DOUBLE_MAT4x2),
+   ENUM_STRING(GL_DOUBLE_MAT4x3),
+   ENUM_STRING(GL_SAMPLER_1D),
+   ENUM_STRING(GL_SAMPLER_2D),
+   ENUM_STRING(GL_SAMPLER_3D),
+   ENUM_STRING(GL_SAMPLER_CUBE),
+   ENUM_STRING(GL_SAMPLER_1D_SHADOW),
+   ENUM_STRING(GL_SAMPLER_2D_SHADOW),
+   ENUM_STRING(GL_SAMPLER_1D_ARRAY),
+   ENUM_STRING(GL_SAMPLER_2D_ARRAY),
+   ENUM_STRING(GL_SAMPLER_1D_ARRAY_SHADOW),
+   ENUM_STRING(GL_SAMPLER_2D_ARRAY_SHADOW),
+   ENUM_STRING(GL_SAMPLER_2D_MULTISAMPLE),
+   ENUM_STRING(GL_SAMPLER_2D_MULTISAMPLE_ARRAY),
+   ENUM_STRING(GL_SAMPLER_CUBE_SHADOW),
+   ENUM_STRING(GL_SAMPLER_BUFFER),
+   ENUM_STRING(GL_SAMPLER_2D_RECT),
+   ENUM_STRING(GL_SAMPLER_2D_RECT_SHADOW),
+   ENUM_STRING(GL_INT_SAMPLER_1D),
+   ENUM_STRING(GL_INT_SAMPLER_2D),
+   ENUM_STRING(GL_INT_SAMPLER_3D),
+   ENUM_STRING(GL_INT_SAMPLER_CUBE),
+   ENUM_STRING(GL_INT_SAMPLER_1D_ARRAY),
+   ENUM_STRING(GL_INT_SAMPLER_2D_ARRAY),
+   ENUM_STRING(GL_INT_SAMPLER_2D_MULTISAMPLE),
+   ENUM_STRING(GL_INT_SAMPLER_2D_MULTISAMPLE_ARRAY),
+   ENUM_STRING(GL_INT_SAMPLER_BUFFER),
+   ENUM_STRING(GL_INT_SAMPLER_2D_RECT),
+   ENUM_STRING(GL_UNSIGNED_INT_SAMPLER_1D),
+   ENUM_STRING(GL_UNSIGNED_INT_SAMPLER_2D),
+   ENUM_STRING(GL_UNSIGNED_INT_SAMPLER_3D),
+   ENUM_STRING(GL_UNSIGNED_INT_SAMPLER_CUBE),
+   ENUM_STRING(GL_UNSIGNED_INT_SAMPLER_1D_ARRAY),
+   ENUM_STRING(GL_UNSIGNED_INT_SAMPLER_2D_ARRAY),
+   ENUM_STRING(GL_UNSIGNED_INT_SAMPLER_2D_MULTISAMPLE),
+   ENUM_STRING(GL_UNSIGNED_INT_SAMPLER_2D_MULTISAMPLE_ARRAY),
+   ENUM_STRING(GL_UNSIGNED_INT_SAMPLER_BUFFER),
+   ENUM_STRING(GL_UNSIGNED_INT_SAMPLER_2D_RECT),
+   { NULL, 0 }
+};
+
 GLenum
 lookup_enum_string(const struct string_to_enum *table, const char **line,
   const char *error_desc)
@@ -1860,84 +1938,6 @@ active_uniform(const char *line)
{ NULL, 0 }
};
 
-   static const struct string_to_enum all_types[] = {
-   ENUM_STRING(GL_FLOAT),
-   ENUM_STRING(GL_FLOAT_VEC2),
-   ENUM_STRING(GL_FLOAT_VEC3),
-   ENUM_STRING(GL_FLOAT_VEC4),
-   ENUM_STRING(GL_DOUBLE),
-   ENUM_STRING(GL_DOUBLE_VEC2),
-   ENUM_STRING(GL_DOUBLE_VEC3),
-   ENUM_STRING(GL_DOUBLE_VEC4),
-   ENUM_STRING(GL_INT),
-   ENUM_STRING(GL_INT_VEC2),
-   ENUM_STRING(GL_INT_VEC3),
-   ENUM_STRING(GL_INT_VEC4),
-   ENUM_STRING(GL_UNSIGNED_INT),
-   ENUM_STRING(GL_UNSIGNED_INT_VEC2),
-   ENUM_STRING(GL_UNSIGNED_INT_VEC3),
-   ENUM_STRING(GL_UNSIGNED_INT_VEC4),
-   ENUM_STRING(GL_BOOL),
-   ENUM_STRING(GL_BOOL_VEC2),
-   ENUM_STRING(GL_BOOL_VEC3),
-   ENUM_STRING(GL_BOOL_VEC4),
-   ENUM_STRING(GL_FLOAT_MAT2),
-   ENUM_STRING(GL_FLOAT_MAT3),
-   ENUM_STRING(GL_FLOAT_MAT4),
-   ENUM_STRING(GL_FLOAT_MAT2x3),
-   ENUM_STRING(GL_FLOAT_MAT2x4),
-   ENUM_STRING(GL_FLOAT_MA

[Piglit] [RFC PATCH 2/2] shader_runner: Add ARB_program_interface_query support to buffer variables

2015-09-11 Thread Samuel Iglesias Gonsalvez
Signed-off-by: Samuel Iglesias Gonsalvez 
---
 tests/shaders/shader_runner.c | 136 ++
 1 file changed, 136 insertions(+)

diff --git a/tests/shaders/shader_runner.c b/tests/shaders/shader_runner.c
index 7a647a1..81d694c 100644
--- a/tests/shaders/shader_runner.c
+++ b/tests/shaders/shader_runner.c
@@ -2046,6 +2046,140 @@ active_uniform(const char *line)
return;
 }
 
+/**
+ * Query a uniform using glGetActiveUniformsiv
+ *
+ * Format of the command:
+ *
+ * active buffer_variable buffer_var_name GL_PNAME_ENUM integer
+ *
+ * or
+ *
+ * active buffer_variable buffer_var_name GL_PNAME_ENUM GL_TYPE_ENUM
+ */
+void
+active_buffer_variable(const char *line)
+{
+   static const struct string_to_enum all_props[] = {
+   ENUM_STRING(GL_TYPE),
+   ENUM_STRING(GL_ARRAY_SIZE),
+   ENUM_STRING(GL_NAME_LENGTH),
+   ENUM_STRING(GL_BLOCK_INDEX),
+   ENUM_STRING(GL_OFFSET),
+   ENUM_STRING(GL_ARRAY_STRIDE),
+   ENUM_STRING(GL_MATRIX_STRIDE),
+   ENUM_STRING(GL_IS_ROW_MAJOR),
+   ENUM_STRING(GL_ATOMIC_COUNTER_BUFFER_INDEX),
+   ENUM_STRING(GL_BUFFER_BINDING),
+   ENUM_STRING(GL_BUFFER_DATA_SIZE),
+   ENUM_STRING(GL_NUM_ACTIVE_VARIABLES),
+   ENUM_STRING(GL_REFERENCED_BY_VERTEX_SHADER),
+   ENUM_STRING(GL_REFERENCED_BY_TESS_CONTROL_SHADER),
+   ENUM_STRING(GL_REFERENCED_BY_TESS_EVALUATION_SHADER),
+   ENUM_STRING(GL_REFERENCED_BY_GEOMETRY_SHADER),
+   ENUM_STRING(GL_REFERENCED_BY_FRAGMENT_SHADER),
+   ENUM_STRING(GL_REFERENCED_BY_COMPUTE_SHADER),
+   ENUM_STRING(GL_TOP_LEVEL_ARRAY_SIZE),
+   ENUM_STRING(GL_TOP_LEVEL_ARRAY_STRIDE),
+   ENUM_STRING(GL_LOCATION),
+   ENUM_STRING(GL_LOCATION_INDEX),
+   ENUM_STRING(GL_IS_PER_PATCH),
+   ENUM_STRING(GL_NUM_COMPATIBLE_SUBROUTINES),
+   ENUM_STRING(GL_COMPATIBLE_SUBROUTINES),
+   { NULL, 0 }
+   };
+
+   char name[512];
+   char name_buf[512];
+   char prop_string[512];
+   GLenum prop;
+   GLint expected;
+   int i;
+   int num_active_buffers;
+
+   if (!piglit_is_extension_supported("GL_ARB_program_interface_query") &&
+   piglit_get_gl_version() < 43) {
+   fprintf(stderr,
+   "GL_ARB_program_interface_query not supported or "
+   "OpenGL version < 4.3\n")
+   return;
+   }
+
+   line = strcpy_to_space(name, eat_whitespace(line));
+
+   strcpy_to_space(prop_string, eat_whitespace(line));
+   prop = lookup_enum_string(all_props, &line, "glGetProgramResourceiv 
pname");
+
+   line = eat_whitespace(line);
+   if (isdigit(line[0])) {
+   expected = strtol(line, NULL, 0);
+   } else {
+   expected = lookup_enum_string(all_types, &line, "type enum");
+   }
+
+   glGetProgramInterfaceiv(prog, GL_BUFFER_VARIABLE,
+   GL_ACTIVE_RESOURCES, &num_active_buffers);
+   for (i = 0; i < num_active_buffers; i++) {
+   GLint got;
+   GLint length;
+   GLsizei name_len;
+   bool pass = true;
+
+   glGetProgramResourceName(prog, GL_BUFFER_VARIABLE,
+i, 512, &name_len, name_buf);
+
+   if (!piglit_check_gl_error(GL_NO_ERROR)) {
+   fprintf(stderr, "glGetProgramResourceName error\n");
+   piglit_report_result(PIGLIT_FAIL);
+   }
+
+   if (strcmp(name, name_buf) != 0)
+   continue;
+
+   if (prop == GL_NAME_LENGTH && name_len != expected) {
+   fprintf(stderr,
+   "glGetProgramResourceName(%s, %s): "
+   "expected %d (0x%04x), got %d (0x%04x)\n",
+   name, prop_string,
+   expected, expected, got, got);
+   pass = false;
+   }
+
+   /* Set 'got' to some value in case glGetActiveUniformsiv
+* doesn't write to it.  That should only be able to occur
+* when the function raises a GL error, but "should" is kind
+* of a funny word.
+*/
+   got = ~expected;
+   glGetProgramResourceiv(prog, GL_BUFFER_VARIABLE,
+  i, 1, &prop, 1,
+  &length, &got);
+
+   if (!piglit_check_gl_error(GL_NO_ERROR)) {
+   fprintf(stderr, "glGetProgramResourceiv error\n");
+   piglit_report_result(PIGLIT_FAIL);
+   }
+
+   if (got != expected) {
+