[Piglit] subtests overwriting one another in results file?

2014-07-02 Thread Ilia Mirkin
Dylan, looks like with your latest json-ification changes:

$ bin/arb_viewport_array-bounds -fbo -auto
Mesa: User error: GL_INVALID_VALUE in glViewportArrayv: index (0)
width or height  0 (-10.30, 0.00)
Mesa: User error: GL_INVALID_VALUE in glViewportIndexedf: index (1)
width or height  0 (-10.30, 0.00)
Mesa: User error: GL_INVALID_VALUE in glViewportIndexedfv: index (2)
width or height  0 (-10.30, 0.00)
Mesa: User error: GL_INVALID_VALUE in glViewportArrayv: index (0)
width or height  0 (5.00, -12345.700195)
Mesa: User error: GL_INVALID_VALUE in glViewportIndexedf: index (1)
width or height  0 (5.00, -12345.700195)
Mesa: User error: GL_INVALID_VALUE in glViewportIndexedfv: index (2)
width or height  0 (5.00, -12345.700195)
PIGLIT: {subtest: {Viewport x, y, width, height validity : pass}}
PIGLIT: {subtest: {DepthRange near, far validity : pass}}
Mesa: User error: GL_INVALID_VALUE in glScissorArrayv: index (0) width
or height  0 (-10, 0)
Mesa: User error: GL_INVALID_VALUE in glScissorIndexd: index (1) width
or height  0 (-10, 0)
Mesa: User error: GL_INVALID_VALUE in glScissorIndexdv: index (2)
width or height  0 (-10, 0)
Mesa: User error: GL_INVALID_VALUE in glScissorArrayv: index (0) width
or height  0 (5, -12345)
Mesa: User error: GL_INVALID_VALUE in glScissorIndexd: index (1) width
or height  0 (5, -12345)
Mesa: User error: GL_INVALID_VALUE in glScissorIndexdv: index (2)
width or height  0 (5, -12345)
PIGLIT: {subtest: {Scissor left, bottom, width, height validity : pass}}
PIGLIT: {result: pass }

Results in

subtest: {
Scissor left, bottom, width, height validity: pass
},

being recorded in the results.json file. Probably because it is the
last one, and we are just using dict.update directly on the overall
dict, but I didn't look at the code carefully.

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


[Piglit] [PATCH 1/2] exectest_test.py: Add test for PiglitTest.interpret_result() clobbering

2014-07-02 Thread Dylan Baker
This test demonstrates a bug in which PiglitTest clobbers subtest
results.

Signed-off-by: Dylan Baker baker.dyla...@gmail.com
---
 framework/tests/exectest_test.py | 15 +++
 1 file changed, 15 insertions(+)

diff --git a/framework/tests/exectest_test.py b/framework/tests/exectest_test.py
index b9ad0bf..d6d31af 100644
--- a/framework/tests/exectest_test.py
+++ b/framework/tests/exectest_test.py
@@ -20,6 +20,7 @@
 
  Tests for the exectest module 
 
+import nose.tools as nt
 from framework.exectest import PiglitTest, Test
 
 
@@ -75,3 +76,17 @@ def test_piglittest_interpret_result_subtest():
   'PIGLIT: {subtest: {subtest: pass}}\n')
 test.interpret_result()
 assert test.result['subtest']['subtest'] == 'pass'
+
+
+def test_piglitest_no_clobber():
+ PiglitTest.interpret_result() does not clobber subtest entires 
+test = PiglitTest(['a', 'command'])
+test.result['out'] = (
+'PIGLIT: {result: pass}\n'
+'PIGLIT: {subtest: {test1: pass}}\n'
+'PIGLIT: {subtest: {test2: pass}}\n'
+)
+test.interpret_result()
+
+nt.assert_dict_equal(test.result['subtest'],
+ {'test1': 'pass', 'test2': 'pass'})
-- 
2.0.0

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


[Piglit] [PATCH 2/2] results.py: Add update_recursive method to TestResult

2014-07-02 Thread Dylan Baker
This method is used during PiglitTest.interpret_result() to update
subtest entries safely. I chose this approach since it is robust,
reusable, and it felt more natural as a part of TestResult than putting
it in PiglitTest.interpret_result()

Signed-off-by: Dylan Baker baker.dyla...@gmail.com
---
 framework/exectest.py |  2 +-
 framework/results.py  | 32 
 2 files changed, 33 insertions(+), 1 deletion(-)

diff --git a/framework/exectest.py b/framework/exectest.py
index e4a2344..fcc29af 100644
--- a/framework/exectest.py
+++ b/framework/exectest.py
@@ -279,6 +279,6 @@ class PiglitTest(Test):
 outpiglit = (s[7:] for s in outlines if s.startswith('PIGLIT:'))
 
 for piglit in outpiglit:
-self.result.update(json.loads(piglit))
+self.result.recursive_update(json.loads(piglit))
 self.result['out'] = '\n'.join(
 s for s in outlines if not s.startswith('PIGLIT:'))
diff --git a/framework/results.py b/framework/results.py
index a715b29..88d962d 100644
--- a/framework/results.py
+++ b/framework/results.py
@@ -248,6 +248,38 @@ class TestResult(dict):
 # normally
 pass
 
+def recursive_update(self, dictionary):
+ Recursively update the TestResult
+
+The problem with using self.update() is this:
+ t = TestResult()
+ t.update({'subtest': {'test1': 'pass'}})
+ t.update({'subtest': {'test2': 'pass'}})
+ t['subtest']
+{'test2': 'pass'}
+
+This function is different, because it recursively updates self, it
+doesn't clobber existing entires in the same way
+ t = TestResult()
+ t.recursive_update({'subtest': {'test1': 'pass'}})
+ t.recursive_update({'subtest': {'test2': 'pass'}})
+ t['subtest']
+{'test1': 'pass', 'test2': 'pass'}
+
+Arguments:
+dictionary -- a dictionary instance to update the TestResult with
+
+
+def update(d, u):
+for k, v in u.iteritems():
+if isinstance(v, dict):
+d[k] = update(d.get(k, {}), v)
+else:
+d[k] = u[k]
+return d
+
+update(self, dictionary)
+
 
 class TestrunResult(object):
 def __init__(self, resultfile=None):
-- 
2.0.0

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


Re: [Piglit] [PATCH 2/2] results.py: Add update_recursive method to TestResult

2014-07-02 Thread Ilia Mirkin
On Wed, Jul 2, 2014 at 4:02 AM, Dylan Baker baker.dyla...@gmail.com wrote:
 This method is used during PiglitTest.interpret_result() to update
 subtest entries safely. I chose this approach since it is robust,
 reusable, and it felt more natural as a part of TestResult than putting
 it in PiglitTest.interpret_result()

 Signed-off-by: Dylan Baker baker.dyla...@gmail.com

Subject talks about update_recursive, but the method is called
recursive_update. Seems easier to just fix the subject, but I don't
really care which way you go as long as they line up.

 ---
  framework/exectest.py |  2 +-
  framework/results.py  | 32 
  2 files changed, 33 insertions(+), 1 deletion(-)

 diff --git a/framework/exectest.py b/framework/exectest.py
 index e4a2344..fcc29af 100644
 --- a/framework/exectest.py
 +++ b/framework/exectest.py
 @@ -279,6 +279,6 @@ class PiglitTest(Test):
  outpiglit = (s[7:] for s in outlines if s.startswith('PIGLIT:'))

  for piglit in outpiglit:
 -self.result.update(json.loads(piglit))
 +self.result.recursive_update(json.loads(piglit))
  self.result['out'] = '\n'.join(
  s for s in outlines if not s.startswith('PIGLIT:'))
 diff --git a/framework/results.py b/framework/results.py
 index a715b29..88d962d 100644
 --- a/framework/results.py
 +++ b/framework/results.py
 @@ -248,6 +248,38 @@ class TestResult(dict):
  # normally
  pass

 +def recursive_update(self, dictionary):
 + Recursively update the TestResult
 +
 +The problem with using self.update() is this:
 + t = TestResult()
 + t.update({'subtest': {'test1': 'pass'}})
 + t.update({'subtest': {'test2': 'pass'}})
 + t['subtest']
 +{'test2': 'pass'}
 +
 +This function is different, because it recursively updates self, it
 +doesn't clobber existing entires in the same way
 + t = TestResult()
 + t.recursive_update({'subtest': {'test1': 'pass'}})
 + t.recursive_update({'subtest': {'test2': 'pass'}})
 + t['subtest']
 +{'test1': 'pass', 'test2': 'pass'}
 +
 +Arguments:
 +dictionary -- a dictionary instance to update the TestResult with
 +
 +
 +def update(d, u):
 +for k, v in u.iteritems():
 +if isinstance(v, dict):
 +d[k] = update(d.get(k, {}), v)
 +else:
 +d[k] = u[k]

Why not

d[k] = v

With that fixed, series is

Reviewed-by: Ilia Mirkin imir...@alum.mit.edu

Thanks for the quick fix!

 +return d
 +
 +update(self, dictionary)
 +

  class TestrunResult(object):
  def __init__(self, resultfile=None):
 --
 2.0.0

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


Re: [Piglit] [PATCH 2/2] results.py: Add update_recursive method to TestResult

2014-07-02 Thread Dylan Baker
Oops, that's what I get for writing and sending a patch at 1AM

On Wednesday, July 02, 2014 10:36:53 AM Ilia Mirkin wrote:
 On Wed, Jul 2, 2014 at 4:02 AM, Dylan Baker baker.dyla...@gmail.com wrote:
  This method is used during PiglitTest.interpret_result() to update
  subtest entries safely. I chose this approach since it is robust,
  reusable, and it felt more natural as a part of TestResult than putting
  it in PiglitTest.interpret_result()
  
  Signed-off-by: Dylan Baker baker.dyla...@gmail.com
 
 Subject talks about update_recursive, but the method is called
 recursive_update. Seems easier to just fix the subject, but I don't
 really care which way you go as long as they line up.
 
  ---
  
   framework/exectest.py |  2 +-
   framework/results.py  | 32 
   2 files changed, 33 insertions(+), 1 deletion(-)
  
  diff --git a/framework/exectest.py b/framework/exectest.py
  index e4a2344..fcc29af 100644
  --- a/framework/exectest.py
  +++ b/framework/exectest.py
  
  @@ -279,6 +279,6 @@ class PiglitTest(Test):
   outpiglit = (s[7:] for s in outlines if s.startswith('PIGLIT:'))
  
   for piglit in outpiglit:
  -self.result.update(json.loads(piglit))
  +self.result.recursive_update(json.loads(piglit))
  
   self.result['out'] = '\n'.join(
   
   s for s in outlines if not s.startswith('PIGLIT:'))
  
  diff --git a/framework/results.py b/framework/results.py
  index a715b29..88d962d 100644
  --- a/framework/results.py
  +++ b/framework/results.py
  
  @@ -248,6 +248,38 @@ class TestResult(dict):
   # normally
   pass
  
  +def recursive_update(self, dictionary):
  + Recursively update the TestResult
  +
  +The problem with using self.update() is this:
  + t = TestResult()
  + t.update({'subtest': {'test1': 'pass'}})
  + t.update({'subtest': {'test2': 'pass'}})
  + t['subtest']
  +{'test2': 'pass'}
  +
  +This function is different, because it recursively updates self,
  it +doesn't clobber existing entires in the same way
  + t = TestResult()
  + t.recursive_update({'subtest': {'test1': 'pass'}})
  + t.recursive_update({'subtest': {'test2': 'pass'}})
  + t['subtest']
  +{'test1': 'pass', 'test2': 'pass'}
  +
  +Arguments:
  +dictionary -- a dictionary instance to update the TestResult with
  +
  +
  +def update(d, u):
  +for k, v in u.iteritems():
  +if isinstance(v, dict):
  +d[k] = update(d.get(k, {}), v)
  +else:
  +d[k] = u[k]
 
 Why not
 
 d[k] = v
 
 With that fixed, series is
 
 Reviewed-by: Ilia Mirkin imir...@alum.mit.edu
 
 Thanks for the quick fix!
 
  +return d
  +
  +update(self, dictionary)
  +
  
   class TestrunResult(object):
   def __init__(self, resultfile=None):
  --
  2.0.0


signature.asc
Description: This is a digitally signed message part.
___
Piglit mailing list
Piglit@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/piglit


[Piglit] [Patch v2 2/2] results.py: Add recursive_update method to TestResult

2014-07-02 Thread Dylan Baker
This method is used during PiglitTest.interpret_result() to update
subtest entries safely. I chose this approach since it is robust,
reusable, and it felt more natural as a part of TestResult than putting
it in PiglitTest.interpret_result()

v2: - Fix commit message

Signed-off-by: Dylan Baker baker.dyla...@gmail.com
---
 framework/exectest.py |  2 +-
 framework/results.py  | 32 
 2 files changed, 33 insertions(+), 1 deletion(-)

diff --git a/framework/exectest.py b/framework/exectest.py
index e4a2344..fcc29af 100644
--- a/framework/exectest.py
+++ b/framework/exectest.py
@@ -279,6 +279,6 @@ class PiglitTest(Test):
 outpiglit = (s[7:] for s in outlines if s.startswith('PIGLIT:'))
 
 for piglit in outpiglit:
-self.result.update(json.loads(piglit))
+self.result.recursive_update(json.loads(piglit))
 self.result['out'] = '\n'.join(
 s for s in outlines if not s.startswith('PIGLIT:'))
diff --git a/framework/results.py b/framework/results.py
index a715b29..88d962d 100644
--- a/framework/results.py
+++ b/framework/results.py
@@ -248,6 +248,38 @@ class TestResult(dict):
 # normally
 pass
 
+def recursive_update(self, dictionary):
+ Recursively update the TestResult
+
+The problem with using self.update() is this:
+ t = TestResult()
+ t.update({'subtest': {'test1': 'pass'}})
+ t.update({'subtest': {'test2': 'pass'}})
+ t['subtest']
+{'test2': 'pass'}
+
+This function is different, because it recursively updates self, it
+doesn't clobber existing entires in the same way
+ t = TestResult()
+ t.recursive_update({'subtest': {'test1': 'pass'}})
+ t.recursive_update({'subtest': {'test2': 'pass'}})
+ t['subtest']
+{'test1': 'pass', 'test2': 'pass'}
+
+Arguments:
+dictionary -- a dictionary instance to update the TestResult with
+
+
+def update(d, u):
+for k, v in u.iteritems():
+if isinstance(v, dict):
+d[k] = update(d.get(k, {}), v)
+else:
+d[k] = u[k]
+return d
+
+update(self, dictionary)
+
 
 class TestrunResult(object):
 def __init__(self, resultfile=None):
-- 
2.0.0

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


[Piglit] [Patch v2 1/2] exectest_test.py: Add test for PiglitTest.interpret_result() clobbering

2014-07-02 Thread Dylan Baker
This test demonstrates a bug in which PiglitTest clobbers subtest
results.

Signed-off-by: Dylan Baker baker.dyla...@gmail.com
---
 framework/tests/exectest_test.py | 15 +++
 1 file changed, 15 insertions(+)

diff --git a/framework/tests/exectest_test.py b/framework/tests/exectest_test.py
index b9ad0bf..d6d31af 100644
--- a/framework/tests/exectest_test.py
+++ b/framework/tests/exectest_test.py
@@ -20,6 +20,7 @@
 
  Tests for the exectest module 
 
+import nose.tools as nt
 from framework.exectest import PiglitTest, Test
 
 
@@ -75,3 +76,17 @@ def test_piglittest_interpret_result_subtest():
   'PIGLIT: {subtest: {subtest: pass}}\n')
 test.interpret_result()
 assert test.result['subtest']['subtest'] == 'pass'
+
+
+def test_piglitest_no_clobber():
+ PiglitTest.interpret_result() does not clobber subtest entires 
+test = PiglitTest(['a', 'command'])
+test.result['out'] = (
+'PIGLIT: {result: pass}\n'
+'PIGLIT: {subtest: {test1: pass}}\n'
+'PIGLIT: {subtest: {test2: pass}}\n'
+)
+test.interpret_result()
+
+nt.assert_dict_equal(test.result['subtest'],
+ {'test1': 'pass', 'test2': 'pass'})
-- 
2.0.0

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


Re: [Piglit] [Patch v2 2/2] results.py: Add recursive_update method to TestResult

2014-07-02 Thread Ilia Mirkin
On Wed, Jul 2, 2014 at 1:17 PM, Dylan Baker baker.dyla...@gmail.com wrote:
 This method is used during PiglitTest.interpret_result() to update
 subtest entries safely. I chose this approach since it is robust,
 reusable, and it felt more natural as a part of TestResult than putting
 it in PiglitTest.interpret_result()

 v2: - Fix commit message

 Signed-off-by: Dylan Baker baker.dyla...@gmail.com
 ---
  framework/exectest.py |  2 +-
  framework/results.py  | 32 
  2 files changed, 33 insertions(+), 1 deletion(-)

 diff --git a/framework/exectest.py b/framework/exectest.py
 index e4a2344..fcc29af 100644
 --- a/framework/exectest.py
 +++ b/framework/exectest.py
 @@ -279,6 +279,6 @@ class PiglitTest(Test):
  outpiglit = (s[7:] for s in outlines if s.startswith('PIGLIT:'))

  for piglit in outpiglit:
 -self.result.update(json.loads(piglit))
 +self.result.recursive_update(json.loads(piglit))
  self.result['out'] = '\n'.join(
  s for s in outlines if not s.startswith('PIGLIT:'))
 diff --git a/framework/results.py b/framework/results.py
 index a715b29..88d962d 100644
 --- a/framework/results.py
 +++ b/framework/results.py
 @@ -248,6 +248,38 @@ class TestResult(dict):
  # normally
  pass

 +def recursive_update(self, dictionary):
 + Recursively update the TestResult
 +
 +The problem with using self.update() is this:
 + t = TestResult()
 + t.update({'subtest': {'test1': 'pass'}})
 + t.update({'subtest': {'test2': 'pass'}})
 + t['subtest']
 +{'test2': 'pass'}
 +
 +This function is different, because it recursively updates self, it
 +doesn't clobber existing entires in the same way
 + t = TestResult()
 + t.recursive_update({'subtest': {'test1': 'pass'}})
 + t.recursive_update({'subtest': {'test2': 'pass'}})
 + t['subtest']
 +{'test1': 'pass', 'test2': 'pass'}
 +
 +Arguments:
 +dictionary -- a dictionary instance to update the TestResult with
 +
 +
 +def update(d, u):
 +for k, v in u.iteritems():
 +if isinstance(v, dict):
 +d[k] = update(d.get(k, {}), v)
 +else:
 +d[k] = u[k]

What about this? Why not d[k] = v? [Perhaps you missed that comment in
my response to the original?]

 +return d
 +
 +update(self, dictionary)
 +

  class TestrunResult(object):
  def __init__(self, resultfile=None):
 --
 2.0.0

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


[Piglit] [PATCH] amd_vertex_shader_viewport_index: add render test

2014-07-02 Thread Ilia Mirkin
This is a copy of the render_viewport ARB_viewport_array test. I didn't
think that it was worth it to copy the scissor/depth tests, since they
basically test the same thing but making sure that scissor/depth are
applied correctly. If that works for ARB_viewport_array, it really
should work here too.

Signed-off-by: Ilia Mirkin imir...@alum.mit.edu
---

Untested, mesa has no support for this and it's not extremely easy to
add to things I have access to since softpipe doesn't have viewports
and llvmpipe doesn't support writing from vs.

I do have r600g patches at:

https://github.com/imirkin/mesa/commits/flv

but they are also untested :) But hopefully this test should help
validate them.

 tests/all.py   |   4 +
 tests/spec/CMakeLists.txt  |   1 +
 .../CMakeLists.gl.txt  |  12 ++
 .../CMakeLists.txt |   1 +
 .../spec/amd_vertex_shader_viewport_index/render.c | 150 +
 5 files changed, 168 insertions(+)
 create mode 100644 
tests/spec/amd_vertex_shader_viewport_index/CMakeLists.gl.txt
 create mode 100644 tests/spec/amd_vertex_shader_viewport_index/CMakeLists.txt
 create mode 100644 tests/spec/amd_vertex_shader_viewport_index/render.c

diff --git a/tests/all.py b/tests/all.py
index c0f41dc..7ce90d8 100644
--- a/tests/all.py
+++ b/tests/all.py
@@ -3026,6 +3026,10 @@ spec['AMD_vertex_shader_layer'] = amd_vertex_shader_layer
 add_plain_test(amd_vertex_shader_layer, 
'amd_vertex_shader_layer-layered-2d-texture-render')
 add_plain_test(amd_vertex_shader_layer, 
'amd_vertex_shader_layer-layered-depth-texture-render')
 
+amd_vertex_shader_viewport_index = {}
+spec['AMD_vertex_shader_viewport_index'] = amd_vertex_shader_viewport_index
+add_concurrent_test(amd_vertex_shader_viewport_index, 
'amd_vertex_shader_viewport_index-render')
+
 ext_fog_coord = {}
 spec['EXT_fog_coord'] = ext_fog_coord
 add_plain_test(ext_fog_coord, 'ext_fog_coord-modes')
diff --git a/tests/spec/CMakeLists.txt b/tests/spec/CMakeLists.txt
index 489ff0c..c7001f1 100644
--- a/tests/spec/CMakeLists.txt
+++ b/tests/spec/CMakeLists.txt
@@ -32,6 +32,7 @@ add_subdirectory (arb_sampler_objects)
 add_subdirectory (arb_seamless_cube_map)
 add_subdirectory (amd_seamless_cubemap_per_texture)
 add_subdirectory (amd_vertex_shader_layer)
+add_subdirectory (amd_vertex_shader_viewport_index)
 add_subdirectory (arb_separate_shader_objects)
 add_subdirectory (arb_shader_texture_lod/execution)
 add_subdirectory (arb_shader_atomic_counters)
diff --git a/tests/spec/amd_vertex_shader_viewport_index/CMakeLists.gl.txt 
b/tests/spec/amd_vertex_shader_viewport_index/CMakeLists.gl.txt
new file mode 100644
index 000..a3da135
--- /dev/null
+++ b/tests/spec/amd_vertex_shader_viewport_index/CMakeLists.gl.txt
@@ -0,0 +1,12 @@
+include_directories(
+   ${GLEXT_INCLUDE_DIR}
+   ${OPENGL_INCLUDE_PATH}
+)
+
+link_libraries (
+   piglitutil_${piglit_target_api}
+   ${OPENGL_gl_LIBRARY}
+   ${OPENGL_glu_LIBRARY}
+)
+
+piglit_add_executable (amd_vertex_shader_viewport_index-render render.c)
diff --git a/tests/spec/amd_vertex_shader_viewport_index/CMakeLists.txt 
b/tests/spec/amd_vertex_shader_viewport_index/CMakeLists.txt
new file mode 100644
index 000..144a306
--- /dev/null
+++ b/tests/spec/amd_vertex_shader_viewport_index/CMakeLists.txt
@@ -0,0 +1 @@
+piglit_include_target_api()
diff --git a/tests/spec/amd_vertex_shader_viewport_index/render.c 
b/tests/spec/amd_vertex_shader_viewport_index/render.c
new file mode 100644
index 000..d6a51e6
--- /dev/null
+++ b/tests/spec/amd_vertex_shader_viewport_index/render.c
@@ -0,0 +1,150 @@
+/*
+ * Copyright © 2013 LunarG, 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.
+ *
+ * Author: Jon Ashburn j...@lunarg.com
+ */
+
+/**
+ * Tests rendering into a single framebuffer surface with multiple viewports
+ * via a 

Re: [Piglit] [Patch v2 2/2] results.py: Add recursive_update method to TestResult

2014-07-02 Thread Dylan Baker
On Wednesday, July 02, 2014 10:39:57 AM Dylan Baker wrote:
 On Wednesday, July 02, 2014 01:28:09 PM Ilia Mirkin wrote:
  On Wed, Jul 2, 2014 at 1:17 PM, Dylan Baker baker.dyla...@gmail.com 
wrote:
   This method is used during PiglitTest.interpret_result() to update
   subtest entries safely. I chose this approach since it is robust,
   reusable, and it felt more natural as a part of TestResult than putting
   it in PiglitTest.interpret_result()
   
   v2: - Fix commit message
   
   Signed-off-by: Dylan Baker baker.dyla...@gmail.com
   ---
   
framework/exectest.py |  2 +-
framework/results.py  | 32 
2 files changed, 33 insertions(+), 1 deletion(-)
   
   diff --git a/framework/exectest.py b/framework/exectest.py
   index e4a2344..fcc29af 100644
   --- a/framework/exectest.py
   +++ b/framework/exectest.py
   
   @@ -279,6 +279,6 @@ class PiglitTest(Test):
outpiglit = (s[7:] for s in outlines if
s.startswith('PIGLIT:'))
   
for piglit in outpiglit:
   -self.result.update(json.loads(piglit))
   +self.result.recursive_update(json.loads(piglit))
   
self.result['out'] = '\n'.join(

s for s in outlines if not s.startswith('PIGLIT:'))
   
   diff --git a/framework/results.py b/framework/results.py
   index a715b29..88d962d 100644
   --- a/framework/results.py
   +++ b/framework/results.py
   
   @@ -248,6 +248,38 @@ class TestResult(dict):
# normally
pass
   
   +def recursive_update(self, dictionary):
   + Recursively update the TestResult
   +
   +The problem with using self.update() is this:
   + t = TestResult()
   + t.update({'subtest': {'test1': 'pass'}})
   + t.update({'subtest': {'test2': 'pass'}})
   + t['subtest']
   +{'test2': 'pass'}
   +
   +This function is different, because it recursively updates
   self,
   it +doesn't clobber existing entires in the same way
   + t = TestResult()
   + t.recursive_update({'subtest': {'test1': 'pass'}})
   + t.recursive_update({'subtest': {'test2': 'pass'}})
   + t['subtest']
   +{'test1': 'pass', 'test2': 'pass'}
   +
   +Arguments:
   +dictionary -- a dictionary instance to update the TestResult
   with
   +
   +
   +def update(d, u):
   +for k, v in u.iteritems():
   +if isinstance(v, dict):
   +d[k] = update(d.get(k, {}), v)
   +else:
   +d[k] = u[k]
  
  What about this? Why not d[k] = v? [Perhaps you missed that comment in
  my response to the original?]
 
 whoops, yes, yes I did. You're right, that should be v.
 
   +return d
   +
   +update(self, dictionary)
   +
   
class TestrunResult(object):
def __init__(self, resultfile=None):
   --
   2.0.0
   
   ___
   Piglit mailing list
   Piglit@lists.freedesktop.org
   http://lists.freedesktop.org/mailman/listinfo/piglit

I made corrections and pushed

signature.asc
Description: This is a digitally signed message part.
___
Piglit mailing list
Piglit@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/piglit


[Piglit] [PATCH 3/4] cl: Add tests for cos builtin

2014-07-02 Thread Tom Stellard
---
 generated_tests/generate-cl-math-builtins.py | 12 +++-
 1 file changed, 11 insertions(+), 1 deletion(-)

diff --git a/generated_tests/generate-cl-math-builtins.py 
b/generated_tests/generate-cl-math-builtins.py
index edf93da..d93f09f 100644
--- a/generated_tests/generate-cl-math-builtins.py
+++ b/generated_tests/generate-cl-math-builtins.py
@@ -27,10 +27,11 @@
 import os
 
 from genclbuiltins import gen
-from math import atan, pi
+from math import atan, pi, cos
 
 CLC_VERSION_MIN = {
 'atan' : 10,
+'cos' : 10,
 'mix' : 10,
 'nextafter' : 10,
 'sign' : 10
@@ -52,6 +53,15 @@ tests = {
 ],
 'tolerance' : 2
  },
+'cos' : {
+'arg_types' : [F, F],
+'function_type': 'ttt',
+'values' : [
+[1.0, 0.0,-1.0, 0.0,1.0,cos(1.12345)], # Result
+[0.0, pi / 2, pi,   3 * pi / 2, 2 * pi, 1.12345] # Arg0
+],
+'tolerance' : 2
+},
 'mix' : { #x + (y - x) * a
 'arg_types': [F, F, F, F],
 'function_type': 'tts',
-- 
1.8.1.4

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


[Piglit] [PATCH 2/4] cl: Add tests for atan builtin

2014-07-02 Thread Tom Stellard
---
 generated_tests/genclbuiltins.py |  7 +--
 generated_tests/generate-cl-math-builtins.py | 11 +++
 tests/cl/program/program-tester.c|  1 -
 3 files changed, 16 insertions(+), 3 deletions(-)

diff --git a/generated_tests/genclbuiltins.py b/generated_tests/genclbuiltins.py
index 9173cdb..da4af5a 100644
--- a/generated_tests/genclbuiltins.py
+++ b/generated_tests/genclbuiltins.py
@@ -311,6 +311,7 @@ def print_test(f, fnName, argType, functionDef, tests, 
testIdx, vecSize, tss):
 
 argTypes = getArgTypes(argType, functionDef['arg_types'])
 argCount = len(argTypes)
+tolerance = functionDef['tolerance'] if 'tolerance' in functionDef else 0
 
 # For each argument, write a line containing its type, index, and values
 for arg in range(0, argCount):
@@ -326,9 +327,11 @@ def print_test(f, fnName, argType, functionDef, tests, 
testIdx, vecSize, tss):
 # width
 if (arg  2 or not tss):
 f.write(argInOut + str(arg) + ' buffer ' + argTypes[arg] +
-'[' + str(vecSize) + '] ' + ' '.join([argVal]*vecSize) +
-'\n'
+'[' + str(vecSize) + '] ' + ' '.join([argVal]*vecSize)
 )
+if arg == 0:
+f.write(' tolerance {} ulp'.format(tolerance))
+f.write('\n')
 else:
 argInOut = 'arg_in: '
 f.write(argInOut + str(arg) + ' buffer ' + argTypes[arg] + '[1] ' +
diff --git a/generated_tests/generate-cl-math-builtins.py 
b/generated_tests/generate-cl-math-builtins.py
index 47752e8..edf93da 100644
--- a/generated_tests/generate-cl-math-builtins.py
+++ b/generated_tests/generate-cl-math-builtins.py
@@ -27,8 +27,10 @@
 import os
 
 from genclbuiltins import gen
+from math import atan, pi
 
 CLC_VERSION_MIN = {
+'atan' : 10,
 'mix' : 10,
 'nextafter' : 10,
 'sign' : 10
@@ -41,6 +43,15 @@ F = {
 }
 
 tests = {
+'atan' : {
+'arg_types' : [F, F],
+'function_type': 'ttt',
+'values' : [
+[atan(0.0), atan(0.12345), atan(3567147.0)], # Result
+[0.0,   0.12345,   3567147.0]# Arg0
+],
+'tolerance' : 2
+ },
 'mix' : { #x + (y - x) * a
 'arg_types': [F, F, F, F],
 'function_type': 'tts',
diff --git a/tests/cl/program/program-tester.c 
b/tests/cl/program/program-tester.c
index 51a692b..0e35826 100644
--- a/tests/cl/program/program-tester.c
+++ b/tests/cl/program/program-tester.c
@@ -903,7 +903,6 @@ get_test_arg_tolerance(struct test_arg* test_arg, const 
char* tolerance_str)
regmatch_t pmatch[2];
char* value_str = NULL;
 
-fprintf(stderr, tolerance = %s\n, tolerance_str);
 if(regex_get_matches(tolerance_str,
 REGEX_ARG_TOLERANCE_ULP,
 pmatch,
-- 
1.8.1.4

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


[Piglit] [PATCH 3/4] Move piglit_get_luminance_intensity_bits to GL common code

2014-07-02 Thread Josh Triplett
This doesn't need to remain in the GL-specific utility library.

Signed-off-by: Josh Triplett j...@joshtriplett.org
---
 tests/util/piglit-util-gl-common.c | 102 +
 tests/util/piglit-util-gl.c| 102 -
 2 files changed, 102 insertions(+), 102 deletions(-)

diff --git a/tests/util/piglit-util-gl-common.c 
b/tests/util/piglit-util-gl-common.c
index f4b2192..a0be726 100644
--- a/tests/util/piglit-util-gl-common.c
+++ b/tests/util/piglit-util-gl-common.c
@@ -833,3 +833,105 @@ piglit_num_components(GLenum base_format)
return 0;
}
 }
+
+/* This function only handles formats not supported by the OpenGL framebuffer
+ * size queries, which only support querying the R,G,B,A sizes.
+ *
+ * The function doesn't change the bits for formats it doesn't handle.
+ *
+ * The returned number of bits is an approximation but should be no less than
+ * the actual number of bits for the format chosen by OpenGL.
+ *
+ * The combination of the OpenGL framebuffer queries size and calling
+ * this function without checking the return value should give you reasonable
+ * values for any format.
+ */
+bool
+piglit_get_luminance_intensity_bits(GLenum internalformat, int *bits)
+{
+   switch (internalformat) {
+   case GL_LUMINANCE4:
+   bits[0] = bits[1] = bits[2] = 4;
+   bits[3] = 0;
+   return true;
+
+   case GL_LUMINANCE:
+   case GL_LUMINANCE_SNORM:
+   case GL_LUMINANCE8:
+   case GL_LUMINANCE8_SNORM:
+   case GL_LUMINANCE8I_EXT:
+   case GL_LUMINANCE8UI_EXT:
+   bits[0] = bits[1] = bits[2] = 8;
+   bits[3] = 0;
+   return true;
+
+   case GL_LUMINANCE12:
+   bits[0] = bits[1] = bits[2] = 12;
+   bits[3] = 0;
+   return true;
+
+   case GL_LUMINANCE16:
+   case GL_LUMINANCE16_SNORM:
+   case GL_LUMINANCE16I_EXT:
+   case GL_LUMINANCE16UI_EXT:
+   case GL_LUMINANCE16F_ARB:
+   bits[0] = bits[1] = bits[2] = 16;
+   bits[3] = 0;
+   return true;
+
+   case GL_LUMINANCE32I_EXT:
+   case GL_LUMINANCE32UI_EXT:
+   case GL_LUMINANCE32F_ARB:
+   bits[0] = bits[1] = bits[2] = 32;
+   bits[3] = 0;
+   return true;
+
+   case GL_LUMINANCE4_ALPHA4:
+   case GL_INTENSITY4:
+   bits[0] = bits[1] = bits[2] = bits[3] = 4;
+   return true;
+
+   case GL_LUMINANCE_ALPHA:
+   case GL_LUMINANCE_ALPHA_SNORM:
+   case GL_LUMINANCE8_ALPHA8:
+   case GL_LUMINANCE8_ALPHA8_SNORM:
+   case GL_LUMINANCE_ALPHA8I_EXT:
+   case GL_LUMINANCE_ALPHA8UI_EXT:
+   case GL_INTENSITY:
+   case GL_INTENSITY_SNORM:
+   case GL_INTENSITY8:
+   case GL_INTENSITY8_SNORM:
+   case GL_INTENSITY8I_EXT:
+   case GL_INTENSITY8UI_EXT:
+   bits[0] = bits[1] = bits[2] = bits[3] = 8;
+   return true;
+
+   case GL_LUMINANCE12_ALPHA12:
+   case GL_INTENSITY12:
+   bits[0] = bits[1] = bits[2] = bits[3] = 12;
+   return true;
+
+   case GL_LUMINANCE16_ALPHA16:
+   case GL_LUMINANCE16_ALPHA16_SNORM:
+   case GL_LUMINANCE_ALPHA16I_EXT:
+   case GL_LUMINANCE_ALPHA16UI_EXT:
+   case GL_LUMINANCE_ALPHA16F_ARB:
+   case GL_INTENSITY16:
+   case GL_INTENSITY16_SNORM:
+   case GL_INTENSITY16I_EXT:
+   case GL_INTENSITY16UI_EXT:
+   case GL_INTENSITY16F_ARB:
+   bits[0] = bits[1] = bits[2] = bits[3] = 16;
+   return true;
+
+   case GL_LUMINANCE_ALPHA32I_EXT:
+   case GL_LUMINANCE_ALPHA32UI_EXT:
+   case GL_LUMINANCE_ALPHA32F_ARB:
+   case GL_INTENSITY32I_EXT:
+   case GL_INTENSITY32UI_EXT:
+   case GL_INTENSITY32F_ARB:
+   bits[0] = bits[1] = bits[2] = bits[3] = 32;
+   return true;
+   }
+   return false;
+}
diff --git a/tests/util/piglit-util-gl.c b/tests/util/piglit-util-gl.c
index ac3489d..773e09f 100644
--- a/tests/util/piglit-util-gl.c
+++ b/tests/util/piglit-util-gl.c
@@ -38,108 +38,6 @@
 
 GLint piglit_ARBfp_pass_through = 0;
 
-/* This function only handles formats not supported by the OpenGL framebuffer
- * size queries, which only support querying the R,G,B,A sizes.
- *
- * The function doesn't change the bits for formats it doesn't handle.
- *
- * The returned number of bits is an approximation but should be no less than
- * the actual number of bits for the format chosen by OpenGL.
- *
- * The combination of the OpenGL framebuffer queries size and calling
- * this function without checking the return value should give you reasonable
- * values for any format.
- */
-bool
-piglit_get_luminance_intensity_bits(GLenum internalformat, int *bits)
-{
-   switch (internalformat) {
-   case GL_LUMINANCE4:
-   bits[0] = bits[1] = bits[2] = 4;
-   bits[3] = 0;
-