[Piglit] [PATCH] Revert python: change she-bang to python2

2014-06-20 Thread Dylan Baker
This reverts commit 40b5d5288991fec2cc76ea4af7050555be467126.

The patch to be reverted breaks users of *BSD, solaris, and OSX which
don't provide a python2 symlink, making it a regression.

The patch however, fixes python for arch users whos python executable
incorrectly is python3. This is a bug that Arch is not willing to fix.

bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=80261
---
 generate-glean-tests.py  | 2 +-
 piglit   | 2 +-
 piglit-merge-results.py  | 2 +-
 piglit-print-commands.py | 2 +-
 piglit-resume.py | 2 +-
 piglit-run.py| 2 +-
 piglit-summary-html.py   | 2 +-
 piglit-summary-junit.py  | 2 +-
 piglit-summary.py| 2 +-
 9 files changed, 9 insertions(+), 9 deletions(-)

diff --git a/generate-glean-tests.py b/generate-glean-tests.py
index aafe256..df08ede 100755
--- a/generate-glean-tests.py
+++ b/generate-glean-tests.py
@@ -1,4 +1,4 @@
-#!/usr/bin/env python2
+#!/usr/bin/env python
 # -*- coding: utf-8 -*-
 #
 # Copyright © 2010 Intel Corporation
diff --git a/piglit b/piglit
index 616e408..ea73268 100755
--- a/piglit
+++ b/piglit
@@ -1,4 +1,4 @@
-#!/usr/bin/env python2
+#!/usr/bin/env python
 
 # Copyright (c) 2014 Intel Corporation
 
diff --git a/piglit-merge-results.py b/piglit-merge-results.py
index a6c0065..e78a5d0 100755
--- a/piglit-merge-results.py
+++ b/piglit-merge-results.py
@@ -1,4 +1,4 @@
-#!/usr/bin/env python2
+#!/usr/bin/env python
 #
 # Permission is hereby granted, free of charge, to any person
 # obtaining a copy of this software and associated documentation
diff --git a/piglit-print-commands.py b/piglit-print-commands.py
index d88ab1c..635d27c 100755
--- a/piglit-print-commands.py
+++ b/piglit-print-commands.py
@@ -1,4 +1,4 @@
-#!/usr/bin/env python2
+#!/usr/bin/env python
 #
 # Permission is hereby granted, free of charge, to any person
 # obtaining a copy of this software and associated documentation
diff --git a/piglit-resume.py b/piglit-resume.py
index 6b78529..195a5db 100755
--- a/piglit-resume.py
+++ b/piglit-resume.py
@@ -1,4 +1,4 @@
-#!/usr/bin/env python2
+#!/usr/bin/env python
 
 # Copyright (c) 2014 Intel Corporation
 
diff --git a/piglit-run.py b/piglit-run.py
index 4c0f878..7c2d71a 100755
--- a/piglit-run.py
+++ b/piglit-run.py
@@ -1,4 +1,4 @@
-#!/usr/bin/env python2
+#!/usr/bin/env python
 
 # Copyright (c) 2014 Intel Corporation
 
diff --git a/piglit-summary-html.py b/piglit-summary-html.py
index 4b5278e..078c7cb 100755
--- a/piglit-summary-html.py
+++ b/piglit-summary-html.py
@@ -1,4 +1,4 @@
-#!/usr/bin/env python2
+#!/usr/bin/env python
 
 # Copyright (c) 2014 Intel Corporation
 
diff --git a/piglit-summary-junit.py b/piglit-summary-junit.py
index 5c40a73..5aa1969 100755
--- a/piglit-summary-junit.py
+++ b/piglit-summary-junit.py
@@ -1,4 +1,4 @@
-#!/usr/bin/env python2
+#!/usr/bin/env python
 
 # Copyright (c) 2014 Intel Corporation
 
diff --git a/piglit-summary.py b/piglit-summary.py
index d1294be..c5a3923 100755
--- a/piglit-summary.py
+++ b/piglit-summary.py
@@ -1,4 +1,4 @@
-#!/usr/bin/env python2
+#!/usr/bin/env python
 
 # Copyright (c) 2014 Intel Corporation
 
-- 
2.0.0

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


[Piglit] [PATCH 2/3] arb_gpu_shader5: Add linker tests to verify 'stream' layout qualifier

2014-06-20 Thread Samuel Iglesias Gonsalvez
Signed-off-by: Samuel Iglesias Gonsalvez sigles...@igalia.com
---
 tests/all.py   |   2 +
 tests/spec/arb_gpu_shader5/CMakeLists.txt  |   3 +-
 .../spec/arb_gpu_shader5/linker/CMakeLists.gl.txt  |  13 ++
 tests/spec/arb_gpu_shader5/linker/CMakeLists.txt   |   1 +
 .../linker/emitstreamvertex_stream_too_large.c | 133 +
 .../linker/stream-different-zero-gs-fs.shader_test |  50 
 .../linker/stream-invalid-prim-output.shader_test  |  54 +
 .../linker/stream-negative-value.shader_test   |  38 ++
 .../arb_gpu_shader5/linker/tf-wrong-stream-value.c | 116 ++
 9 files changed, 409 insertions(+), 1 deletion(-)
 create mode 100644 tests/spec/arb_gpu_shader5/linker/CMakeLists.gl.txt
 create mode 100644 tests/spec/arb_gpu_shader5/linker/CMakeLists.txt
 create mode 100644 
tests/spec/arb_gpu_shader5/linker/emitstreamvertex_stream_too_large.c
 create mode 100644 
tests/spec/arb_gpu_shader5/linker/stream-different-zero-gs-fs.shader_test
 create mode 100644 
tests/spec/arb_gpu_shader5/linker/stream-invalid-prim-output.shader_test
 create mode 100644 
tests/spec/arb_gpu_shader5/linker/stream-negative-value.shader_test
 create mode 100644 tests/spec/arb_gpu_shader5/linker/tf-wrong-stream-value.c

diff --git a/tests/all.py b/tests/all.py
index 30e0e83..a40998b 100644
--- a/tests/all.py
+++ b/tests/all.py
@@ -1693,6 +1693,8 @@ add_concurrent_test(arb_gpu_shader5, 
'arb_gpu_shader5-invocation-id')
 add_concurrent_test(arb_gpu_shader5, 
'arb_gpu_shader5-invocations_count_too_large')
 add_concurrent_test(arb_gpu_shader5, 'arb_gpu_shader5-xfb-streams')
 add_concurrent_test(arb_gpu_shader5, 'arb_gpu_shader5-stream_value_too_large')
+add_concurrent_test(arb_gpu_shader5, 
'arb_gpu_shader5-emitstreamvertex_stream_too_large')
+add_concurrent_test(arb_gpu_shader5, 'arb_gpu_shader5-tf-wrong-stream-value')
 
 arb_texture_query_levels = {}
 spec['ARB_texture_query_levels'] = arb_texture_query_levels
diff --git a/tests/spec/arb_gpu_shader5/CMakeLists.txt 
b/tests/spec/arb_gpu_shader5/CMakeLists.txt
index f41c000..60d83cb 100644
--- a/tests/spec/arb_gpu_shader5/CMakeLists.txt
+++ b/tests/spec/arb_gpu_shader5/CMakeLists.txt
@@ -1,3 +1,4 @@
 add_subdirectory (compiler)
 add_subdirectory (execution)
-piglit_include_target_api()
\ No newline at end of file
+add_subdirectory (linker)
+piglit_include_target_api()
diff --git a/tests/spec/arb_gpu_shader5/linker/CMakeLists.gl.txt 
b/tests/spec/arb_gpu_shader5/linker/CMakeLists.gl.txt
new file mode 100644
index 000..f955e83
--- /dev/null
+++ b/tests/spec/arb_gpu_shader5/linker/CMakeLists.gl.txt
@@ -0,0 +1,13 @@
+include_directories(
+   ${GLEXT_INCLUDE_DIR}
+   ${OPENGL_INCLUDE_PATH}
+)
+
+link_libraries (
+   piglitutil_${piglit_target_api}
+   ${OPENGL_gl_LIBRARY}
+   ${OPENGL_glu_LIBRARY}
+)
+
+piglit_add_executable (arb_gpu_shader5-emitstreamvertex_stream_too_large 
emitstreamvertex_stream_too_large.c)
+piglit_add_executable (arb_gpu_shader5-tf-wrong-stream-value 
tf-wrong-stream-value.c)
diff --git a/tests/spec/arb_gpu_shader5/linker/CMakeLists.txt 
b/tests/spec/arb_gpu_shader5/linker/CMakeLists.txt
new file mode 100644
index 000..144a306
--- /dev/null
+++ b/tests/spec/arb_gpu_shader5/linker/CMakeLists.txt
@@ -0,0 +1 @@
+piglit_include_target_api()
diff --git 
a/tests/spec/arb_gpu_shader5/linker/emitstreamvertex_stream_too_large.c 
b/tests/spec/arb_gpu_shader5/linker/emitstreamvertex_stream_too_large.c
new file mode 100644
index 000..a478055
--- /dev/null
+++ b/tests/spec/arb_gpu_shader5/linker/emitstreamvertex_stream_too_large.c
@@ -0,0 +1,133 @@
+/*
+ * Copyright (c) 2014 Igalia S.L.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the Software),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the next
+ * paragraph) shall be included in all copies or substantial portions of the
+ * Software.
+ *
+ * THE SOFTWARE IS PROVIDED AS IS, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
+ */
+
+/**
+ * @file emitstreamvertex_stream_too_large.c
+ *
+ * Test that exceeding the implementation's maximum streams
+ * value (GL_MAX_VERTEX_STREAMS) when calling 

[Piglit] [PATCH 1/3] arb_gpu_shader5: add some compiler tests for stream qualifier

2014-06-20 Thread Samuel Iglesias Gonsalvez
Signed-off-by: Samuel Iglesias Gonsalvez sigles...@igalia.com
---
 tests/all.py   |   1 +
 tests/spec/arb_gpu_shader5/compiler/CMakeLists.txt |   3 +-
 .../compiler/stream-qualifier/CMakeLists.gl.txt|  12 ++
 .../compiler/stream-qualifier/CMakeLists.txt   |   1 +
 .../correct-multiple-layout-qualifier-stream.geom  |  40 +
 .../incorrect-in-layout-qualifier-stream.geom  |  19 ++
 ...ect-multiple-block-layout-qualifier-stream.geom |  32 
 ...incorrect-negative-layout-qualifier-stream.geom |  24 +++
 .../stream-qualifier/stream_value_too_large.c  | 193 +
 9 files changed, 324 insertions(+), 1 deletion(-)
 create mode 100644 
tests/spec/arb_gpu_shader5/compiler/stream-qualifier/CMakeLists.gl.txt
 create mode 100644 
tests/spec/arb_gpu_shader5/compiler/stream-qualifier/CMakeLists.txt
 create mode 100644 
tests/spec/arb_gpu_shader5/compiler/stream-qualifier/correct-multiple-layout-qualifier-stream.geom
 create mode 100644 
tests/spec/arb_gpu_shader5/compiler/stream-qualifier/incorrect-in-layout-qualifier-stream.geom
 create mode 100644 
tests/spec/arb_gpu_shader5/compiler/stream-qualifier/incorrect-multiple-block-layout-qualifier-stream.geom
 create mode 100644 
tests/spec/arb_gpu_shader5/compiler/stream-qualifier/incorrect-negative-layout-qualifier-stream.geom
 create mode 100644 
tests/spec/arb_gpu_shader5/compiler/stream-qualifier/stream_value_too_large.c

diff --git a/tests/all.py b/tests/all.py
index 9dd5379..30e0e83 100644
--- a/tests/all.py
+++ b/tests/all.py
@@ -1692,6 +1692,7 @@ add_concurrent_test(arb_gpu_shader5, 
'arb_gpu_shader5-minmax')
 add_concurrent_test(arb_gpu_shader5, 'arb_gpu_shader5-invocation-id')
 add_concurrent_test(arb_gpu_shader5, 
'arb_gpu_shader5-invocations_count_too_large')
 add_concurrent_test(arb_gpu_shader5, 'arb_gpu_shader5-xfb-streams')
+add_concurrent_test(arb_gpu_shader5, 'arb_gpu_shader5-stream_value_too_large')
 
 arb_texture_query_levels = {}
 spec['ARB_texture_query_levels'] = arb_texture_query_levels
diff --git a/tests/spec/arb_gpu_shader5/compiler/CMakeLists.txt 
b/tests/spec/arb_gpu_shader5/compiler/CMakeLists.txt
index 4a012b9..ec80122 100644
--- a/tests/spec/arb_gpu_shader5/compiler/CMakeLists.txt
+++ b/tests/spec/arb_gpu_shader5/compiler/CMakeLists.txt
@@ -1 +1,2 @@
-piglit_include_target_api()
\ No newline at end of file
+add_subdirectory (stream-qualifier)
+piglit_include_target_api()
diff --git 
a/tests/spec/arb_gpu_shader5/compiler/stream-qualifier/CMakeLists.gl.txt 
b/tests/spec/arb_gpu_shader5/compiler/stream-qualifier/CMakeLists.gl.txt
new file mode 100644
index 000..11b3110
--- /dev/null
+++ b/tests/spec/arb_gpu_shader5/compiler/stream-qualifier/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 (arb_gpu_shader5-stream_value_too_large 
stream_value_too_large.c)
diff --git 
a/tests/spec/arb_gpu_shader5/compiler/stream-qualifier/CMakeLists.txt 
b/tests/spec/arb_gpu_shader5/compiler/stream-qualifier/CMakeLists.txt
new file mode 100644
index 000..144a306
--- /dev/null
+++ b/tests/spec/arb_gpu_shader5/compiler/stream-qualifier/CMakeLists.txt
@@ -0,0 +1 @@
+piglit_include_target_api()
diff --git 
a/tests/spec/arb_gpu_shader5/compiler/stream-qualifier/correct-multiple-layout-qualifier-stream.geom
 
b/tests/spec/arb_gpu_shader5/compiler/stream-qualifier/correct-multiple-layout-qualifier-stream.geom
new file mode 100644
index 000..46c0644
--- /dev/null
+++ 
b/tests/spec/arb_gpu_shader5/compiler/stream-qualifier/correct-multiple-layout-qualifier-stream.geom
@@ -0,0 +1,40 @@
+// [config]
+// expect_result: pass
+// glsl_version: 1.50
+// require_extensions: GL_ARB_gpu_shader5
+// check_link: false
+// [end config]
+//
+// ARB_gpu_shader5 spec says:
+//   A default stream number may be declared at global
+//scope by qualifying interface qualifier out as in this example:
+//
+//  layout(stream = 1) out;
+//
+//The stream number specified in such a declaration replaces any previous
+//default and applies to all subsequent block and variable declarations
+//until a new default is established.  The initial default stream number is
+//zero.
+//
+// Tests for multiple declarations of layout qualifier 'stream'.
+//
+
+#version 150
+#extension GL_ARB_gpu_shader5 : enable
+
+layout(points) in;
+layout(points) out;
+
+out vec4 var1;
+layout(stream=1) out;
+out vec4 var2;
+layout(stream=2) out vec3 var3;
+
+layout(stream=3) out Block1 {
+   float var4;
+   layout(stream=3) vec4 var5;
+};
+
+void main()
+{
+}
diff --git 
a/tests/spec/arb_gpu_shader5/compiler/stream-qualifier/incorrect-in-layout-qualifier-stream.geom
 
b/tests/spec/arb_gpu_shader5/compiler/stream-qualifier/incorrect-in-layout-qualifier-stream.geom
new file mode 100644
index 

Re: [Piglit] [PATCH] cl: Add signbit(float) relational tests

2014-06-20 Thread Tom Stellard
On Fri, Jun 20, 2014 at 11:29:13AM -0500, Aaron Watry wrote:
 Also, while doing this, needed to add a NEGNAN define to genclbuiltins.py 
 because
 python just prints nan for float(-nan) when generating tests.
 
 cl-program-tester can handle -nan as an input correctly, so just pass the 
 value
 through as a string without python attempting to handle it.
 
 v2: Add nan and -nan tests
 

Reviewed-by: Tom Stellard thomas.stell...@amd.com

 Signed-off-by: Aaron Watry awa...@gmail.com
 CC: Tom Stellard thomas.stell...@amd.com
 ---
  generated_tests/genclbuiltins.py   |  3 +++
  generated_tests/generate-cl-relational-builtins.py | 11 ++-
  2 files changed, 13 insertions(+), 1 deletion(-)
 
 diff --git a/generated_tests/genclbuiltins.py 
 b/generated_tests/genclbuiltins.py
 index 2d2b322..9173cdb 100644
 --- a/generated_tests/genclbuiltins.py
 +++ b/generated_tests/genclbuiltins.py
 @@ -56,6 +56,7 @@ UMAX = 'unsigned_max_for_type'
  TYPE = 'TYPE'
  SIZE = 'SIZE'
  TRUE = 'true_value_for_type' #1 for scalar, -1 for vector
 +NEGNAN = 'Negative NAN as a string, because float(-nan) just produces nan'
  
  # Identity type list
  T = {
 @@ -234,6 +235,8 @@ def getValue(type, val, isVector):
  return -1
  else:
  return 1
 +elif (val == NEGNAN):
 +return '-nan' #cl-program-tester translates this for us
  else:
  print('Unknown string value: ' + val + '\n')
  elif (isinstance(val, list)):
 diff --git a/generated_tests/generate-cl-relational-builtins.py 
 b/generated_tests/generate-cl-relational-builtins.py
 index dd9bc35..db7b7f5 100644
 --- a/generated_tests/generate-cl-relational-builtins.py
 +++ b/generated_tests/generate-cl-relational-builtins.py
 @@ -27,7 +27,7 @@
  
  import os
  
 -from genclbuiltins import gen, TRUE
 +from genclbuiltins import gen, TRUE, NEGNAN
  
  CLC_VERSION_MIN = {
  'isnan' : 10,
 @@ -35,6 +35,7 @@ CLC_VERSION_MIN = {
  'isgreater' : 10,
  'isgreaterequal' : 10,
  'isnotequal' : 10,
 +'signbit' : 10
  }
  
  DATA_TYPES = ['float']
 @@ -91,6 +92,14 @@ tests = {
  [0.0,  float(nan), 1.0,  1,float(nan), 
 float(inf), 1.0,  0.5 ], # Arg0
  [0.0,  float(nan), 1.0,  float(nan), 1,
 float(inf), 0.5,  1.0 ]  # Arg1
  ]
 +},
 +'signbit' : {
 +'arg_types': [I, F],
 +'function_type': 'ttt',
 +'values': [
 +[0,   TRUE,0,   0, TRUE,  0,TRUE, 0  
  , TRUE], # Result
 +[0.0, float(0)*-1, 1.0, 1, float(-inf), float(inf), -1.0, 
 float(nan), NEGNAN ]  # Arg0
 +]
  }
  }
  
 -- 
 1.9.1
 
 ___
 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 v3 08/13] results.py: Modernize some things

2014-06-20 Thread Dylan Baker
Use super() instead of an explicit call to the parent class in one case,
and make all classes descend from object (make them new-style classes)

Signed-off-by: Dylan Baker baker.dyla...@gmail.com
---
 framework/results.py | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/framework/results.py b/framework/results.py
index 7762d39..356aefb 100644
--- a/framework/results.py
+++ b/framework/results.py
@@ -53,7 +53,7 @@ def _piglit_encoder(obj):
 return obj
 
 
-class JSONWriter:
+class JSONWriter(object):
 '''
 Writes to a JSON file stream
 
@@ -181,7 +181,7 @@ class JSONWriter:
 
 class TestResult(dict):
 def __init__(self, *args):
-dict.__init__(self, *args)
+super(TestResult, self).__init__(*args)
 
 # Replace the result with a status object
 try:
@@ -192,7 +192,7 @@ class TestResult(dict):
 pass
 
 
-class TestrunResult:
+class TestrunResult(object):
 def __init__(self, resultfile=None):
 self.serialized_keys = ['options',
 'name',
-- 
2.0.0

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


[Piglit] [Patch v3 02/13] framework: Dont rely on os.environ so much

2014-06-20 Thread Dylan Baker
There are some problems with using os.environ, all of which are caused
shell child-variable relationships. Most of these problems are easy to
solve, since we don't actually need to have environment variables set
except during test execution, and that can be passed to Popen (or it's
helper wrappers). This gives us much better assurance that things are
happening in the way we expect.

Signed-off-by: Dylan Baker baker.dyla...@gmail.com
---
 framework/core.py | 23 ---
 framework/exectest.py | 15 +++
 framework/programs/run.py | 21 +
 piglit| 15 ++-
 4 files changed, 34 insertions(+), 40 deletions(-)

diff --git a/framework/core.py b/framework/core.py
index cd72956..84832cf 100644
--- a/framework/core.py
+++ b/framework/core.py
@@ -206,21 +206,6 @@ def checkDir(dirname, failifexists):
 if e.errno != errno.EEXIST:
 raise
 
-if 'PIGLIT_SOURCE_DIR' not in os.environ:
-p = os.path
-os.environ['PIGLIT_SOURCE_DIR'] = p.abspath(p.join(p.dirname(__file__),
-   '..'))
-
-# In debug builds, Mesa will by default log GL API errors to stderr.
-# This is useful for application developers or driver developers
-# trying to debug applications that should execute correctly.  But for
-# piglit we expect to generate errors regularly as part of testing,
-# and for exhaustive error-generation tests (particularly some in
-# khronos's conformance suite), it can end up ooming your system
-# trying to parse the strings.
-if 'MESA_DEBUG' not in os.environ:
-os.environ['MESA_DEBUG'] = 'silent'
-
 
 class TestResult(dict):
 def __init__(self, *args):
@@ -353,6 +338,14 @@ class Environment:
 self.valgrind = valgrind
 self.dmesg = dmesg
 self.verbose = verbose
+# env is used to set some base environment variables that are not going
+# to change across runs, without sending them to os.environ which is
+# fickle as easy to break
+self.env = {
+'PIGLIT_SOURCE_DIR': os.path.abspath(
+os.path.join(os.path.dirname(__file__), '..')),
+'MESA_DEBUG': 'silent',
+}
 
 
 The filter lists that are read in should be a list of string objects,
diff --git a/framework/exectest.py b/framework/exectest.py
index e55274e..ad6f2ae 100644
--- a/framework/exectest.py
+++ b/framework/exectest.py
@@ -136,7 +136,9 @@ class Test(object):
 
 self.result['command'] = ' '.join(self.command)
 self.result['environment'] =  .join(
-'{0}={1}'.format(k, v) for k, v in  self.env.iteritems())
+'{0}={1}'.format(k, v) for k, v in self.env.iteritems()) + \
+ .join(
+'{0}={1}'.format(k, v) for k, v in self.ENV.env.iteritems())
 
 if self.check_for_skip_scenario():
 self.result['result'] = 'skip'
@@ -188,9 +190,14 @@ class Test(object):
 return False
 
 def get_command_result(self):
-fullenv = os.environ.copy()
-for key, value in self.env.iteritems():
-fullenv[key] = str(value)
+# Set the environment for the tests. Use the default settings created
+# in the Environment constructor first, then use any user defined
+# variables, finally, use any variables set for the test in the test
+# profile
+fullenv = self.ENV.env.copy()
+for iterable in [os.environ, self.env]:
+for key, value in iterable.iteritems():
+fullenv[key] = str(value)
 
 try:
 proc = subprocess.Popen(self.command,
diff --git a/framework/programs/run.py b/framework/programs/run.py
index 16d4e1d..b99d884 100644
--- a/framework/programs/run.py
+++ b/framework/programs/run.py
@@ -116,10 +116,6 @@ def run(input_):
   |  SEM_NOOPENFILEERRORBOX
 ctypes.windll.kernel32.SetErrorMode(uMode)
 
-# Set the platform to pass to waffle
-if args.platform:
-os.environ['PIGLIT_PLATFORM'] = args.platform
-
 # If dmesg is requested we must have serial run, this is becasue dmesg
 # isn't reliable with threaded run
 if args.dmesg:
@@ -130,8 +126,8 @@ def run(input_):
 core.PIGLIT_CONFIG.readfp(args.config_file)
 args.config_file.close()
 else:
-core.PIGLIT_CONFIG.read(os.path.join(os.environ['PIGLIT_SOURCE_DIR'],
- 'piglit.conf'))
+core.PIGLIT_CONFIG.read(os.path.abspath(
+os.path.join(os.path.dirname(__file__), 'piglit.conf')))
 
 # Pass arguments into Environment
 env = core.Environment(concurrent=args.concurrency,
@@ -142,6 +138,11 @@ def run(input_):
dmesg=args.dmesg,
verbose=args.verbose)
 
+# Set the platform to pass to waffle
+if args.platform:
+env.env['PIGLIT_PLATFORM'] = args.platform
+
+
 

[Piglit] [Patch v3 04/13] core.py: Simplify Environment constructor

2014-06-20 Thread Dylan Baker
This replaces assignment followed by for loops with list comprehensions.
This is less code, simpler, and faster.

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

diff --git a/framework/core.py b/framework/core.py
index f61548d..6f476d0 100644
--- a/framework/core.py
+++ b/framework/core.py
@@ -332,8 +332,8 @@ class Environment:
  verbose=False):
 self.concurrent = concurrent
 self.execute = execute
-self.filter = []
-self.exclude_filter = []
+self.filter = [re.compile(x) for x in include_filter or []]
+self.exclude_filter = [re.compile(x) for x in exclude_filter or []]
 self.exclude_tests = set()
 self.valgrind = valgrind
 self.dmesg = dmesg
@@ -347,17 +347,6 @@ class Environment:
 'MESA_DEBUG': 'silent',
 }
 
-
-The filter lists that are read in should be a list of string objects,
-however, the filters need to be a list or regex object.
-
-This code uses re.compile to rebuild the lists and set self.filter
-
-for each in include_filter or []:
-self.filter.append(re.compile(each))
-for each in exclude_filter or []:
-self.exclude_filter.append(re.compile(each))
-
 def __iter__(self):
 for key, values in self.__dict__.iteritems():
 # If the values are regex compiled then yield their pattern
-- 
2.0.0

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


[Piglit] [Patch v3 07/13] results.py: Replace JSONEncoder subclass with default method

2014-06-20 Thread Dylan Baker
Both methods are equally viable solution when using the builtin json
module, but using defaults is superior when using simplejson (a C based
implementation of the json module providing an identical interface but
vastly better performance) which can be used with piglit if it's
installed.

Signed-off-by: Dylan Baker baker.dyla...@gmail.com
---
 framework/results.py   | 21 +
 framework/tests/dmesg_tests.py |  5 ++---
 2 files changed, 15 insertions(+), 11 deletions(-)

diff --git a/framework/results.py b/framework/results.py
index c9831f7..7762d39 100644
--- a/framework/results.py
+++ b/framework/results.py
@@ -40,13 +40,17 @@ __all__ = [
 ]
 
 
-class PiglitJSONEncoder(json.JSONEncoder):
-def default(self, o):
-if isinstance(o, status.Status):
-return str(o)
-elif isinstance(o, set):
-return list(o)
-return json.JSONEncoder.default(self, o)
+def _piglit_encoder(obj):
+ Encoder for piglit that can transform additional classes into json
+
+Adds support for status.Status objects and for set() instances
+
+
+if isinstance(obj, status.Status):
+return str(obj)
+elif isinstance(obj, set):
+return list(obj)
+return obj
 
 
 class JSONWriter:
@@ -98,7 +102,8 @@ class JSONWriter:
 self.file = file
 self.__indent_level = 0
 self.__inhibit_next_indent = False
-self.__encoder = PiglitJSONEncoder(indent=self.INDENT)
+self.__encoder = json.JSONEncoder(indent=self.INDENT,
+  default=_piglit_encoder)
 
 # self.__is_collection_empty
 #
diff --git a/framework/tests/dmesg_tests.py b/framework/tests/dmesg_tests.py
index ff70e2d..785edb8 100644
--- a/framework/tests/dmesg_tests.py
+++ b/framework/tests/dmesg_tests.py
@@ -27,7 +27,7 @@ import re
 import nose.tools as nt
 from nose.plugins.skip import SkipTest
 from framework.dmesg import DummyDmesg, LinuxDmesg, get_dmesg
-from framework.results import TestResult, PiglitJSONEncoder
+from framework.results import TestResult, _piglit_encoder
 from framework.exectest import PiglitTest
 from framework.gleantest import GleanTest
 from framework.shader_test import ShaderTest
@@ -258,9 +258,8 @@ def test_update_result_add_dmesg():
 
 def test_json_serialize_updated_result():
  Test that a TestResult that has been updated is json serializable 
-encoder = PiglitJSONEncoder()
 result = test_update_result_add_dmesg()
-encoded = encoder.encode(result)
+_piglit_encoder(result)
 
 
 def test_testclasses_dmesg():
-- 
2.0.0

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


[Piglit] [Patch v3 13/13] summary.py: Remove work-arounds for version 0 result bugs

2014-06-20 Thread Dylan Baker
These work-arounds are no longer necessary since they are handled by the
result format updater on load.

Signed-off-by: Dylan Baker baker.dyla...@gmail.com
---
 framework/summary.py | 3 ---
 1 file changed, 3 deletions(-)

diff --git a/framework/summary.py b/framework/summary.py
index fa98267..0db2a80 100644
--- a/framework/summary.py
+++ b/framework/summary.py
@@ -484,9 +484,6 @@ class Summary:
 if not path.exists(temp_path):
 os.makedirs(temp_path)
 
-if isinstance(value.get('dmesg'), list):
-value['dmesg'] = \n.join(value['dmesg'])
-
 if value.get('time') is not None:
 value['time'] = datetime.timedelta(0, value['time'])
 
-- 
2.0.0

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


[Piglit] [Patch v3 11/13] framework: consolidate boilerplate in JSNOWriter class

2014-06-20 Thread Dylan Baker
This moves all of the code for writing the name, the options, etc out of
run and resume and into a single method of JSONWriter. This should
reduce errors, code duplication, and help abstract a lot of problems
with future changes to the json away.

Signed-off-by: Dylan Baker baker.dyla...@gmail.com
---
 framework/programs/run.py | 36 
 framework/results.py  | 30 ++
 2 files changed, 38 insertions(+), 28 deletions(-)

diff --git a/framework/programs/run.py b/framework/programs/run.py
index 298f1e1..9255f64 100644
--- a/framework/programs/run.py
+++ b/framework/programs/run.py
@@ -160,28 +160,18 @@ def run(input_):
 result_filepath = path.join(args.results_path, 'main')
 result_file = open(result_filepath, 'w')
 json_writer = framework.results.JSONWriter(result_file)
-json_writer.open_dict()
 
-# Write out command line options for use in resuming.
-json_writer.write_dict_key('options')
-json_writer.open_dict()
-json_writer.write_dict_item('profile', args.test_profile)
-for key, value in env:
-json_writer.write_dict_item(key, value)
+# Create an dictionary to pass to initialize json, it needs the contents of
+# the env dictionary and profile and platform information
+options = {'profile': args.test_profile}
 if args.platform:
-json_writer.write_dict_item('platform', args.platform)
-json_writer.close_dict()
-
-json_writer.write_dict_item('name', results.name)
-
-for key, value in core.collect_system_info().iteritems():
-json_writer.write_dict_item(key, value)
+options['platform'] = args.platform
+json_writer.initialize_json(options, results.name,
+core.collect_system_info())
 
 profile = framework.profile.merge_test_profiles(args.test_profile)
 profile.results_dir = args.results_path
 
-json_writer.write_dict_key('tests')
-json_writer.open_dict()
 time_start = time.time()
 # Set the dmesg type
 if args.dmesg:
@@ -224,19 +214,9 @@ def resume(input_):
 
 results_path = path.join(args.results_path, main)
 json_writer = framework.results.JSONWriter(open(results_path, 'w+'))
-json_writer.open_dict()
-json_writer.write_dict_key(options)
-json_writer.open_dict()
-for key, value in results.options.iteritems():
-json_writer.write_dict_item(key, value)
-json_writer.close_dict()
-
-json_writer.write_dict_item('name', results.name)
-for key, value in core.collect_system_info().iteritems():
-json_writer.write_dict_item(key, value)
+json_writer.initialize_json(results.options, results.name,
+core.collect_system_info())
 
-json_writer.write_dict_key('tests')
-json_writer.open_dict()
 for key, value in results.tests.iteritems():
 json_writer.write_dict_item(key, value)
 env.exclude_tests.add(key)
diff --git a/framework/results.py b/framework/results.py
index 9823fc5..1edc423 100644
--- a/framework/results.py
+++ b/framework/results.py
@@ -118,6 +118,36 @@ class JSONWriter(object):
 #
 self.__is_collection_empty = []
 
+def initialize_json(self, options, name, env):
+ Write boilerplate json code 
+
+This writes all of the json except the actuall tests.
+
+Arguments:
+options -- any values to be put in the options dictionary, must be a
+   dict-like object
+name -- the name of the test
+env -- any environment information to be written into the results, must
+   be a dict-like object
+
+
+self.open_dict()
+self.write_dict_item('name', name)
+
+self.write_dict_key('options')
+self.open_dict()
+for key, value in options.iteritems():
+# Loading a NoneType will break resume, and are a bug
+assert value is not None, Value {} is NoneType.format(key)
+self.write_dict_item(key, value)
+self.close_dict()
+
+for key, value in env.iteritems():
+self.write_dict_item(key, value)
+
+self.write_dict_key('tests')
+self.open_dict()
+
 @synchronized_self
 def __write_indent(self):
 if self.__inhibit_next_indent:
-- 
2.0.0

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


[Piglit] [Patch v3 05/13] core.py: rename Environment to Options

2014-06-20 Thread Dylan Baker
Environment doesn't really describe what the class is (although,
honestly it's a pretty bad class design), but Options comes much closer
to what it is.

Signed-off-by: Dylan Baker baker.dyla...@gmail.com
---
 framework/core.py| 17 +++--
 framework/exectest.py|  6 +++---
 framework/profile.py |  4 ++--
 framework/programs/run.py| 30 +++---
 framework/tests/core_tests.py|  2 +-
 framework/tests/profile_tests.py |  8 
 6 files changed, 40 insertions(+), 27 deletions(-)

diff --git a/framework/core.py b/framework/core.py
index 6f476d0..2005a4e 100644
--- a/framework/core.py
+++ b/framework/core.py
@@ -40,7 +40,7 @@ import framework.status as status
 from .threads import synchronized_self
 
 __all__ = ['PIGLIT_CONFIG',
-   'Environment',
+   'Options',
'TestrunResult',
'TestResult',
'JSONWriter',
@@ -326,7 +326,20 @@ class TestrunResult:
 json.dump(raw_dict, file, indent=JSONWriter.INDENT)
 
 
-class Environment:
+class Options(object):
+ Contains options for a piglit run
+
+Options are as follows:
+concurrent -- True if concurrency is to be used
+execute -- False for dry run
+filter -- list of compiled regex which include exclusively tests that match
+exclude_filter -- list of compiled regex which exclude tests that match
+valgrind -- True if valgrind is to be used
+dmesg -- True if dmesg checking is desired. This forces concurrency off
+verbose -- verbosity level.
+env -- environment variables set for each test before run
+
+
 def __init__(self, concurrent=True, execute=True, include_filter=None,
  exclude_filter=None, valgrind=False, dmesg=False,
  verbose=False):
diff --git a/framework/exectest.py b/framework/exectest.py
index ad6f2ae..d7cad6e 100644
--- a/framework/exectest.py
+++ b/framework/exectest.py
@@ -28,7 +28,7 @@ import time
 import sys
 import traceback
 
-from .core import TestResult, Environment
+from .core import TestResult, Options
 
 
 __all__ = ['Test',
@@ -49,7 +49,7 @@ else:
 
 
 class Test(object):
-ENV = Environment()
+ENV = Options()
 __slots__ = ['ENV', 'run_concurrent', 'env', 'result', 'cwd', '_command',
  '_test_hook_execute_run']
 
@@ -191,7 +191,7 @@ class Test(object):
 
 def get_command_result(self):
 # Set the environment for the tests. Use the default settings created
-# in the Environment constructor first, then use any user defined
+# in the Options constructor first, then use any user defined
 # variables, finally, use any variables set for the test in the test
 # profile
 fullenv = self.ENV.env.copy()
diff --git a/framework/profile.py b/framework/profile.py
index affd4b6..ba481a3 100644
--- a/framework/profile.py
+++ b/framework/profile.py
@@ -121,7 +121,7 @@ class TestProfile(object):
 runs it's own filters plus the filters in the self.filters name
 
 Arguments:
-env - a core.Environment instance
+env - a core.Options instance
 
 
 self._flatten_group_hierarchy()
@@ -181,7 +181,7 @@ class TestProfile(object):
 Finally it will print a final summary of the tests
 
 Arguments:
-env -- a core.Environment instance
+env -- a core.Options instance
 json_writer -- a core.JSONWriter instance
 
 
diff --git a/framework/programs/run.py b/framework/programs/run.py
index 0189e48..6008eb5 100644
--- a/framework/programs/run.py
+++ b/framework/programs/run.py
@@ -129,14 +129,14 @@ def run(input_):
 core.PIGLIT_CONFIG.read(os.path.abspath(
 os.path.join(os.path.dirname(__file__), 'piglit.conf')))
 
-# Pass arguments into Environment
-env = core.Environment(concurrent=args.concurrency,
-   exclude_filter=args.exclude_tests,
-   include_filter=args.include_tests,
-   execute=args.execute,
-   valgrind=args.valgrind,
-   dmesg=args.dmesg,
-   verbose=args.verbose)
+# Pass arguments into Options
+env = core.Options(concurrent=args.concurrency,
+   exclude_filter=args.exclude_tests,
+   include_filter=args.include_tests,
+   execute=args.execute,
+   valgrind=args.valgrind,
+   dmesg=args.dmesg,
+   verbose=args.verbose)
 
 # Set the platform to pass to waffle
 if args.platform:
@@ -211,13 +211,13 @@ def resume(input_):
 args = parser.parse_args(input_)
 
 results = core.load_results(args.results_path)
-env = core.Environment(concurrent=results.options['concurrent'],
-   exclude_filter=results.options['exclude_filter'],
-   

[Piglit] [Patch v3 12/13] framework: Update results to use versioned numbers

2014-06-20 Thread Dylan Baker
This patch updates our json to version 1. Changes from version 0 to
version 1 are as follows:

- renamed 'main' to 'results.json'
- dmesg must be a string (It was stored a list in some version 0
  results)
- subtests are never stored as duplicate entries, a single instance of
  the test is recorded, (In version 0 both are possible)
- there is no info entry in version 1, err, out, and returncode are
  always split into seperate entries

This patch adds support to the results module for handling updates to
the results in a sane way. It does this by adding a result_version
attribute to the TestrunResult (which is stored as json), and
implementing the ability to incrementally update results between
versions.

It does this automatically on load, non-destructively, moving the old
results to results.json.old, but does write the updated results to disk,
making the cost of this update a one time cost.

v2: - Handle non-writable directories and files, this also fixes using
  file-descriptors as inputs

Signed-off-by: Dylan Baker baker.dyla...@gmail.com
---
 framework/programs/run.py|   4 +-
 framework/results.py | 131 +---
 framework/tests/results_tests.py | 157 +--
 framework/tests/utils.py |   2 +
 4 files changed, 278 insertions(+), 16 deletions(-)

diff --git a/framework/programs/run.py b/framework/programs/run.py
index 9255f64..ff13974 100644
--- a/framework/programs/run.py
+++ b/framework/programs/run.py
@@ -157,7 +157,7 @@ def run(input_):
 results.name = path.basename(args.results_path)
 
 # Begin json.
-result_filepath = path.join(args.results_path, 'main')
+result_filepath = path.join(args.results_path, 'results.json')
 result_file = open(result_filepath, 'w')
 json_writer = framework.results.JSONWriter(result_file)
 
@@ -212,7 +212,7 @@ def resume(input_):
 if results.options.get('platform'):
 env.env['PIGLIT_PLATFORM'] = results.options['platform']
 
-results_path = path.join(args.results_path, main)
+results_path = path.join(args.results_path, 'results.json')
 json_writer = framework.results.JSONWriter(open(results_path, 'w+'))
 json_writer.initialize_json(results.options, results.name,
 core.collect_system_info())
diff --git a/framework/results.py b/framework/results.py
index 1edc423..48d4fc9 100644
--- a/framework/results.py
+++ b/framework/results.py
@@ -23,6 +23,7 @@
 
 from __future__ import print_function
 import os
+import sys
 from cStringIO import StringIO
 try:
 import simplejson as json
@@ -39,6 +40,9 @@ __all__ = [
 'load_results',
 ]
 
+# The current version of the JSON results
+CURRENT_JSON_VERSION = 1
+
 
 def _piglit_encoder(obj):
  Encoder for piglit that can transform additional classes into json
@@ -119,7 +123,7 @@ class JSONWriter(object):
 self.__is_collection_empty = []
 
 def initialize_json(self, options, name, env):
- Write boilerplate json code 
+ Write boilerplate json code
 
 This writes all of the json except the actuall tests.
 
@@ -132,6 +136,7 @@ class JSONWriter(object):
 
 
 self.open_dict()
+self.write_dict_item('results_version', CURRENT_JSON_VERSION)
 self.write_dict_item('name', name)
 
 self.write_dict_key('options')
@@ -229,6 +234,7 @@ class TestrunResult(object):
 'wglinfo',
 'glxinfo',
 'lspci',
+'results_version',
 'time_elapsed']
 self.name = None
 self.uname = None
@@ -338,12 +344,119 @@ def load_results(filename):
 main
 
 
+# This will load any file or file-like thing. That would include pipes and
+# file descriptors
+if not os.path.isdir(filename):
+filepath = filename
+else:
+# If there are both old and new results in a directory pick the new
+# ones first
+if os.path.exists(os.path.join(filename, 'results.json')):
+filepath = os.path.join(filename, 'results.json')
+# Version 0 results are called 'main'
+elif os.path.exists(os.path.join(filename, 'main')):
+filepath = os.path.join(filename, 'main')
+else:
+raise Exception(No results found)
+
+with open(filepath, 'r') as f:
+testrun = TestrunResult(f)
+
+return update_results(testrun, filepath)
+
+
+def update_results(results, filepath):
+ Update results to the lastest version
+
+This function is a wraper for other update_* functions, providing
+incremental updates from one version to another.
+
+
+# If the results version is the current version there is no need to
+# update, just return the results
+if getattr(results, 'results_version', 0) == CURRENT_JSON_VERSION:
+return results
+
+# If there 

[Piglit] [PATCH 0/3] Verify gl_VertexID harder

2014-06-20 Thread Ian Romanick
OpenGL (desktop and ES) have the following expectations of gl_VertexID:

1. When used with BaseVertex drawing commands, gl_VertexID will include
the value of basevertex.  This differens from the other API, but the
change in OpenGL was based on feedback from application developers.
This only affects OpenGL 3.2+.

2. When used with DrawArrays drawing commands, gl_VertexID will count
from the 'start' value instead of zero.  This affects OpenGL 3.0+ and
OpenGL ES 3.0+.

At the very least, the i965 driver in Mesa doesn't implement either of
these behaviors.

These tests are almost identical.  The main differences:

gl-3.2: Uses glMultiDrawElementsBaseVertex and creates an index array.

gles-3.0: Uses glDrawArrays in a loop.

gl-3.0: Uses glMultiDrawArrays.  GLES does not have glMultiDrawArrays,
and using a different function here gives slightly more test coverage.

I didn't see an obvious way to share code by all three without build
gymnastics.  The gl-3.0 and gles-3.0 tests could be made to share code
without too much effort.  I'm looking for opinions or suggestions.

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