[Piglit] [PATCH v2 2/3] framework: Drop support for JSON formats < 7

2016-10-11 Thread Dylan Baker
Most of these are pretty old at this point (over a year), and it seems
unlikely anyone still has results in those formats. The biggest problem
with them is that some of them (especially the early ones) are complex
transformations with a lot of validation needed, and some of the middle
ones rely on the class representations to do the transformations, which
is what this series is trying to change, since the tight coupling makes
changes to the schema difficult, or nearly impossible in other cases.

If there is compelling reason I could push support back a bit more, but
I really want to drop some of the versions we support since it
simplifies the code considerably.

This also drops support for the older "main" file, and only supports
results.json and results.json.
---
 framework/backends/json.py   | 266 +--
 unittests/framework/backends/test_json.py|   9 +-
 unittests/framework/backends/test_json_update.py | 738 +
 3 files changed, 10 insertions(+), 1003 deletions(-)

diff --git a/framework/backends/json.py b/framework/backends/json.py
index cf7f119..7181841 100644
--- a/framework/backends/json.py
+++ b/framework/backends/json.py
@@ -55,6 +55,9 @@ __all__ = [
 # The current version of the JSON results
 CURRENT_JSON_VERSION = 9
 
+# The minimum JSON format supported
+MINIMUM_SUPPORTED_VERSION = 7
+
 # The level to indent a final file
 INDENT = 4
 
@@ -242,9 +245,7 @@ def load_results(filename, compression_):
 else:
 # Look for a compressed result first, then a bare result, finally for
 # an old main file
-for name in ['results.json.{}'.format(compression_),
- 'results.json',
- 'main']:
+for name in ['results.json.{}'.format(compression_), 'results.json']:
 if os.path.exists(os.path.join(filename, name)):
 filepath = os.path.join(filename, name)
 break
@@ -331,13 +332,6 @@ def _update_results(results, filepath):
 # Python lacks a switch statement, the workaround is to use a
 # dictionary
 updates = {
-0: _update_zero_to_one,
-1: _update_one_to_two,
-2: _update_two_to_three,
-3: _update_three_to_four,
-4: _update_four_to_five,
-5: _update_five_to_six,
-6: _update_six_to_seven,
 7: _update_seven_to_eight,
 8: _update_eight_to_nine,
 }
@@ -347,10 +341,11 @@ def _update_results(results, filepath):
 
 return results
 
-# If there is no version, then set it to 0, this will trigger a full
-# update.
-if not hasattr(results, 'results_version'):
-results.results_version = 0
+if results.results_version < MINIMUM_SUPPORTED_VERSION:
+raise exceptions.PiglitFatalError(
+'Unsupported version "{}", '
+'minimum supported version is "{}"'.format(
+results.results_version, MINIMUM_SUPPORTED_VERSION))
 
 # If the results version is the current version there is no need to
 # update, just return the results
@@ -376,247 +371,6 @@ def _write(results, file_):
 json.dump(results, f, default=piglit_encoder, indent=INDENT)
 
 
-def _update_zero_to_one(result):
-""" Update version zero results to version 1 results
-
-Changes from version 0 to version 1
-
-- dmesg is sometimes stored as a list, sometimes stored as a string. In
-  version 1 it is always stored as a string
-- in version 0 subtests are sometimes stored as duplicates, sometimes 
stored
-  only with a single entry, in version 1 tests with subtests are only
-  recorded once, always.
-- Version 0 can have an info entry, or returncode, out, and err entries,
-  Version 1 will only have the latter
-- version 0 results are called 'main', while version 1 results are called
-  'results.json' (This is not handled internally, it's either handled by
-  update_results() which will write the file back to disk, or needs to be
-  handled manually by the user)
-
-"""
-updated_results = {}
-remove = set()
-
-for name, test in six.iteritems(result.tests):
-assert not isinstance(test, results.TestResult), \
-'Test was erroniaously turned into a TestResult'
-
-# fix dmesg errors if any
-if isinstance(test.get('dmesg'), list):
-test['dmesg'] = '\n'.join(test['dmesg'])
-
-# If a test as an info attribute, we want to remove it, if it doesn't
-# have a returncode, out, or attribute we'll want to get those out of
-# info first
-#
-# This expects that the order of info is roughly returncode, errors,
-# output, *extra it can handle having extra information in the middle,
-if (None in [test.get('out'), test.get('err'),
- test.get('returncode')] and test.get('info')):
-
-# This attempts to split everything 

[Piglit] [PATCH v2 0/3] Decouple JSON loading and python classes

2016-10-11 Thread Dylan Baker
Currently piglit's JSON format loading is tightly integrated with it's class
representations of result data. This has the advantage of reducing code
duplication, and making it easy to ensure that all data is correctly translated
to it's types. However, there is a drawback, the tight coupling makes changing
the JSON format difficult, and small changes have a tendency to break things.

This rather small series decouples the internal representation and the JSON
representation, which will allow makes changes to the format easier, but it does
have a bit of a cost: it drops support for older JSON results formats. This may
not be a big deal, most of these formats were quite old, and none of them had
formal schemas, but they may still exist.

I can add some of the formats back if they're really needed, but I like the fact
that getting rid of them removes 1000 lines of code from piglit.

This is available at my github:
https://github.com/dcbaker/piglit wip/detangle-json-load

v2: - remove support for '' extension for the JSON backend along with
  support for "main" files.
- Fix result version being set to 9 instead of 8 in tests.

Dylan Baker (3):
  framework/backends/json: replace str() with six.text_type()
  framework: Drop support for JSON formats < 7
  framework/backends/json: Don't convert to TestrunResult while updating

 framework/backends/json.py   | 301 +--
 unittests/framework/backends/test_json.py|  16 +-
 unittests/framework/backends/test_json_update.py | 793 +
 3 files changed, 57 insertions(+), 1053 deletions(-)

-- 
git-series 0.8.10
___
Piglit mailing list
Piglit@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/piglit


Re: [Piglit] [PATCH v5] cl: Add a test for the predefined macros

2016-10-11 Thread Jan Vesely
On Sun, 2016-10-09 at 11:10 +0200, Niels Ole Salscheider wrote:
> v5: Use sscanf, fix CL_DEVICE_OPENCL_C_VERSION include guard, fix logic
> v4: Test against env->version instead of opencl_version and never
> report PIGLIT_SKIP for the values of IMAGE_SUPPORT and ENDIAN_LITTLE
> v3: Fix alignment and typos
> v2: Check the values of the defines and add more checks
> 
> Signed-off-by: Niels Ole Salscheider 
> Reviewed-by: Jan Vesely 
> ---
>  tests/cl.py  |   1 +
>  tests/cl/program/CMakeLists.cl.txt   |   1 +
>  tests/cl/program/predefined-macros.c | 459 
> +++
>  3 files changed, 461 insertions(+)
>  create mode 100644 tests/cl/program/predefined-macros.c
> 
> diff --git a/tests/cl.py b/tests/cl.py
> index 353ab05..73fba0d 100644
> --- a/tests/cl.py
> +++ b/tests/cl.py
> @@ -96,6 +96,7 @@ with profile.group_manager(PiglitCLTest, 'program') as g:
>  g(['cl-program-max-work-item-sizes'],
>'Run kernel with max work item sizes')
>  g(['cl-program-bitcoin-phatk'], 'Bitcoin: phatk kernel')
> +g(['cl-program-predefined-macros'], 'Check predefined preprocessor 
> macros')
>  
>  with profile.group_manager(PiglitCLTest, 'interop') as g:
>  g(['cl-interop-egl_khr_cl_event2'], 'EGL_KHR_cl_event2')
> diff --git a/tests/cl/program/CMakeLists.cl.txt 
> b/tests/cl/program/CMakeLists.cl.txt
> index 82dc675..c8d7307 100644
> --- a/tests/cl/program/CMakeLists.cl.txt
> +++ b/tests/cl/program/CMakeLists.cl.txt
> @@ -1,3 +1,4 @@
>  piglit_cl_add_program_test (tester program-tester.c)
>  piglit_cl_add_program_test (max-work-item-sizes max-work-item-sizes.c)
>  piglit_cl_add_program_test (bitcoin-phatk bitcoin-phatk.c)
> +piglit_cl_add_program_test (predefined-macros predefined-macros.c)
> diff --git a/tests/cl/program/predefined-macros.c 
> b/tests/cl/program/predefined-macros.c
> new file mode 100644
> index 000..e08c76b
> --- /dev/null
> +++ b/tests/cl/program/predefined-macros.c
> @@ -0,0 +1,459 @@
> +/*
> + * Copyright © 2016 Niels Ole Salscheider 
> + *
> + * 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-framework-cl-program.h"
> +
> +char *program_source =
> +"kernel void test(global int* file_defined, global int* line_defined, \n"
> +" global int* opencl_version_defined, global int* 
> opencl_version, \n"
> +" global int* opencl_c_version_defined, global int* 
> opencl_c_version, \n"
> +" global int* cl_version_defined, global int* cl_version, \n"
> +" global int* endian_little_defined, global int* 
> endian_little, \n"
> +" global int* image_support_defined, global int* 
> image_support) \n"
> +"{ \n"
> +"#ifdef __FILE__ \n"
> +"*file_defined = 1; \n"
> +"#else \n"
> +"*file_defined = 0; \n"
> +"#endif \n"
> +"\n"
> +"#ifdef __LINE__ \n"
> +"*line_defined = 1; \n"
> +"#else \n"
> +"*line_defined = 0; \n"
> +"#endif \n"
> +"\n"
> +"#ifdef __OPENCL_VERSION__ \n"
> +"*opencl_version_defined = 1; \n"
> +"*opencl_version = __OPENCL_VERSION__; \n"
> +"#else \n"
> +"*opencl_version_defined = 0; \n"
> +"#endif \n"
> +"\n"
> +"#ifdef __OPENCL_C_VERSION__ \n"
> +"*opencl_c_version_defined = 1; \n"
> +"*opencl_c_version = __OPENCL_C_VERSION__; \n"
> +"#else \n"
> +"*opencl_c_version_defined = 0; \n"
> +"#endif \n"
> +"\n"
> +"#ifdef CL_VERSION_1_0 \n"
> +"cl_version_defined[0] = 1; \n"
> +"cl_version[0] = CL_VERSION_1_0; \n"
> +"#else \n"
> +"cl_version_defined[0] = 0; \n"
> +"#endif \n"
> +"\n"
> +"#ifdef CL_VERSION_1_1 \n"
> +"cl_version_defined[1] = 1; \n"
> +"cl_version[1] = CL_VERSION_1_1; \n"
> +"#else \n"
> +"cl_version_defined[1] = 0; \n"
> +"#endif \n"
> +"\n"
> +"#ifdef CL_VERSION_1_2 

Re: [Piglit] [PATCH] glsl-1.10/fs-texture-select: new test for a radeonsi bug

2016-10-11 Thread Tapani Pälli

Reviewed-by: Tapani Pälli 

On 10/04/2016 06:36 PM, Marek Olšák wrote:

From: Marek Olšák 

---
 .../execution/fs-texture-select.shader_test| 34 ++
 1 file changed, 34 insertions(+)
 create mode 100644 tests/spec/glsl-1.10/execution/fs-texture-select.shader_test

diff --git a/tests/spec/glsl-1.10/execution/fs-texture-select.shader_test 
b/tests/spec/glsl-1.10/execution/fs-texture-select.shader_test
new file mode 100644
index 000..4fd57c6
--- /dev/null
+++ b/tests/spec/glsl-1.10/execution/fs-texture-select.shader_test
@@ -0,0 +1,34 @@
+# Even columns fetch from tex0 (black), while odd columns fetch from tex1 
(white).
+# The shader inverts the color of even collumns to get make them white,
+# so the final image should be completely white.
+#
+# At the moment, radeonsi miscompiles this shader and only fetches from tex0
+# in both cases.
+
+[require]
+GLSL >= 1.10
+
+[vertex shader passthrough]
+
+[fragment shader]
+uniform sampler2D tex0, tex1;
+
+void main()
+{
+bool pat = fract(gl_FragCoord.x / 2.0) < 0.5;
+gl_FragColor = pat ?
+ texture2D(tex0, gl_TexCoord[0].xy) :
+ texture2D(tex1, gl_TexCoord[0].xy);
+
+if (pat)
+gl_FragColor = vec4(1.0) - gl_FragColor;
+}
+
+[test]
+texture checkerboard 0 0 (8, 8) (0, 0, 0, 0) (0, 0, 0, 0)
+texture checkerboard 1 0 (8, 8) (1, 1, 1, 1) (1, 1, 1, 1)
+
+uniform int tex0 0
+uniform int tex1 1
+draw rect -1 -1 2 2
+probe all rgba 1.0 1.0 1.0 1.0


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