Update Piglit.

Cherry pick commit e8f378e95315ad3920269eecb2e6c7c75fe58379.

Disable the new default of using Waffle, which we don't have.
I'll add this in a future CL.

Add LD_LIBRARY_PATH via lib_path.patch for the new dynamic linking arrangement.

Update test blacklist to reflect current reality on i915/Sandy Bridge,
and new test naming structure.

Remove obsolete CMakeLists_GLES_Release patch.

Note: This version of Python needs dev-python/mako in the chroot to build.
CQ-DEPEND=42146
BUG=chromium-os:34183
TEST=No crashes on i915 or Sandy Bridge.
Change-Id: I67e69d170d2f6ee518d5e1858a6306f94b319063
Reviewed-on: https://gerrit.chromium.org/gerrit/42244
Reviewed-by: Stéphane Marchesin <marcheu@chromium.org>
Reviewed-by: Ilja H. Friedel <ihf@chromium.org>
Commit-Queue: Stuart Abercrombie <sabercrombie@chromium.org>
Tested-by: Stuart Abercrombie <sabercrombie@chromium.org>
diff --git a/client/deps/piglit/piglit.py b/client/deps/piglit/piglit.py
index 1b45661..089c1ee 100755
--- a/client/deps/piglit/piglit.py
+++ b/client/deps/piglit/piglit.py
@@ -8,7 +8,7 @@
 from autotest_lib.client.bin import test, utils
 
 # changing this version number will force a delete of piglit/ and remake
-version = 2
+version = 3
 
 # TODO(ihf) piglit only builds on x86, Tegra2 only supports GLES
 def setup(topdir):
@@ -31,17 +31,21 @@
         utils.extract_tarball_to_dir(tarball_path, dst_path)
         # patch in files now
         utils.system('patch -p0 < ' +
-                     os.path.join(srcdir, 'CMakeLists_GLES_Release.patch'))
-        utils.system('patch -p0 < ' +
                      os.path.join(srcdir,
                      'monitor_tests_for_GPU_hang_and_SW_rasterization.patch'))
+        utils.system('patch -p0 < ' +
+                     os.path.join(srcdir,
+                     'lib_path.patch'))
+
         shutil.copyfile(os.path.join(srcdir, 'cros-driver.tests'),
                         os.path.join(dst_path, 'tests/cros-driver.tests'))
         os.chdir(dst_path)
         # we have to tell cmake where to find glut
         cmd = 'cmake  -DCMAKE_FIND_ROOT_PATH=' + sysroot
-        cmd = cmd + ' -DGLUT_INCLUDE_DIR=' + sysroot + '/usr/include'
-        cmd = cmd + ' -DGLUT_glut_LIBRARY=' + glut_libpath
+        cmd += ' -DGLUT_INCLUDE_DIR=' + sysroot + '/usr/include'
+        cmd += ' -DGLUT_glut_LIBRARY=' + glut_libpath
+        # By default Piglit requires Waffle on Linux. Use GLUT instead.
+        cmd += ' -DPIGLIT_USE_WAFFLE=0'
         utils.run(cmd)
         utils.make('-j %d' % utils.count_cpus())
         # strip symbols from all binaries to save space
diff --git a/client/deps/piglit/src/CMakeLists_GLES_Release.patch b/client/deps/piglit/src/CMakeLists_GLES_Release.patch
deleted file mode 100644
index 5acf533..0000000
--- a/client/deps/piglit/src/CMakeLists_GLES_Release.patch
+++ /dev/null
@@ -1,40 +0,0 @@
---- piglit/CMakeLists.txt	2012-05-01 13:14:42.000000000 
-+++ piglit/CMakeLists.txt	2012-05-02 15:50:47.000000000 
-@@ -64,13 +64,13 @@
- if(NOT import_numpy_error_code EQUAL 0)
- 	message(FATAL_ERROR "numpy library not found")
- endif(NOT import_numpy_error_code EQUAL 0)
- 
- # Default to compiling with debug information (`gcc -g`):
- if(NOT CMAKE_BUILD_TYPE)
--	SET(CMAKE_BUILD_TYPE Debug CACHE STRING
-+	SET(CMAKE_BUILD_TYPE RelWithDebInfo CACHE STRING
- 	"May be one of: None Debug RelWithDebInfo Release MinSizeRel" FORCE)
- endif(NOT CMAKE_BUILD_TYPE)
- 
- if (NOT MSVC)
- 	CHECK_C_COMPILER_FLAG("-Wall" C_COMPILER_FLAG_WALL)
- 	IF (C_COMPILER_FLAG_WALL)
-@@ -141,18 +141,21 @@
- 		NAMES GL/glext.h
- 		PATHS ${OPENGL_INCLUDE_DIR}
- 		DOC "Include for GL/glext.h"
- 	)
- endif (APPLE)
- 
-+find_library(OPENGL_gles2_LIBRARY NAMES GLESv2)
-+
-+if(OPENGL_gles2_LIBRARY)
- FIND_LIBRARY(OPENGL_egl_LIBRARY
-       NAMES EGL
-       PATHS /usr/lib
- )
- find_library(OPENGL_gles1_LIBRARY NAMES GLESv1_CM)
--find_library(OPENGL_gles2_LIBRARY NAMES GLESv2)
-+endif(OPENGL_gles2_LIBRARY)
- 
- # Put all executables into the bin subdirectory
- set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${piglit_BINARY_DIR}/bin)
- set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${piglit_BINARY_DIR}/lib)
- 
- # Do the same for MSVC, regardless of the build type. This only works correctly
diff --git a/client/deps/piglit/src/README.txt b/client/deps/piglit/src/README.txt
index 930e151..81aa848 100644
--- a/client/deps/piglit/src/README.txt
+++ b/client/deps/piglit/src/README.txt
@@ -1,5 +1,5 @@
 1) Cherry picked piglit.tar.gz from
-   http://cgit.freedesktop.org/piglit/commit/?id=a50bc91c44f21214569d2c567f803d3a92af6ab5
+   http://cgit.freedesktop.org/piglit/commit/?id=e8f378e95315ad3920269eecb2e6c7c75fe58379
 
 2) Added config file cros-driver.test which was derived from 
    piglit.tar.gz:tests/quick-driver.tests
diff --git a/client/deps/piglit/src/cros-driver.tests b/client/deps/piglit/src/cros-driver.tests
index 1cd6d62..fef573b 100644
--- a/client/deps/piglit/src/cros-driver.tests
+++ b/client/deps/piglit/src/cros-driver.tests
@@ -1,12 +1,9 @@
 #!/usr/bin/env python
 # -*- coding: utf-8 -*-
 
-import re
-import subprocess
+import os.path
 
-from framework.core import *
-from framework.exectest import *
-from framework.gleantest import *
+global profile
 
 execfile(os.path.dirname(__file__) + '/quick.tests')
 
@@ -22,18 +19,14 @@
 del profile.tests['shaders']['glsl-fs-unroll-explosion']
 del profile.tests['shaders']['glsl-vs-inline-explosion']
 del profile.tests['shaders']['glsl-vs-unroll-explosion']
-del profile.tests['texturing']['streaming-texture-leak']
+del profile.tests['spec']['!OpenGL 1.1']['streaming-texture-leak']
 
 # IHF: this test runs with too much memory on my 64 bit dev system
-del profile.tests['texturing']['tex3d-maxsize']
-
-# This test is nonsense
-del profile.tests['glean']['exactRGBA']
+del profile.tests['spec']['!OpenGL 1.2']['tex3d-maxsize']
 
 # IHF: this test hangs testing
-del profile.tests['general']['longprim']
+del profile.tests['spec']['!OpenGL 1.1']['longprim']
 del profile.tests['glx']['glx-make-glxdrawable-current']
-#del profile.tests['glean']
 del profile.tests['shaders']['glsl-texcoord-array']
 
 # IHF: bug 19813 - x86-generic crashes/hangs blacklisted (roughly declining order of badness)
@@ -41,19 +34,30 @@
 del profile.tests['spec']['glsl-1.10']['execution']['samplers']['in-parameter-struct']
 del profile.tests['spec']['glsl-1.10']['execution']['samplers']['normal-parameter']
 del profile.tests['spec']['glsl-1.10']['execution']['samplers']['normal-parameter-struct']
-del profile.tests['general']['bgra-sec-color-pointer']
-del profile.tests['general']['array-stride']
-del profile.tests['fbo']['fbo-rg-GL_RED']
-del profile.tests['fbo']['fbo-rg-GL_R8']
-del profile.tests['fbo']['fbo-rg-GL_R16']
-del profile.tests['fbo']['fbo-rg-GL_RG']
-del profile.tests['fbo']['fbo-rg-GL_RG8']
-del profile.tests['fbo']['fbo-rg-GL_RG16']
 
 # IHF: This test crashed on lumpy during checkout.
-del profile.tests['texturing']['max-texture-size']
+del profile.tests['spec']['!OpenGL 1.1']['max-texture-size']
 
 # IHF: These tests cause hangchecks on lumpy/stumpy and often many crashes and a loss
 # of hardware acceleration later. See crosbug.com/30809.
 del profile.tests['spec']['glsl-1.30']['execution']['fs-discard-exit-1']
 del profile.tests['spec']['glsl-1.30']['execution']['fs-discard-exit-2']
+
+# SCBA: These crashed on Sandy Bridge. Some are not supported.
+del profile.tests['spec']['ARB_framebuffer_object']['negative-readpixels-no-rb']
+del profile.tests['spec']['ARB_uniform_buffer_object']['maxuniformblocksize/fsexceed']
+del profile.tests['spec']['ARB_uniform_buffer_object']['maxuniformblocksize/fs']
+del profile.tests['spec']['EGL_KHR_create_context']
+del profile.tests['spec']['EGL_NOK_swap_region']
+del profile.tests['spec']['EGL_NOK_texture_from_pixmap']
+del profile.tests['spec']['EGL 1.4']
+del profile.tests['spec']['EXT_texture_array']['compressed teximage']
+del profile.tests['spec']['EXT_packed_depth_stencil']['fbo-clear-formats stencil']
+del profile.tests['spec']['EXT_texture_compression_s3tc']['s3tc-errors']
+del profile.tests['spec']['glsl-1.10']['execution']['varying-packing']
+del profile.tests['spec']['ARB_draw_elements_base_vertex']['draw-elements-base-vertex-neg-user_varrays']
+del profile.tests['spec']['glsl-1.30']['execution']['varying-packing-mixed-types']
+del profile.tests['spec']['ARB_fragment_program']['fp-long-alu']
+
+# SCBA: These crashed on i915
+del profile.tests['shaders']['glsl-fs-convolution-2']
diff --git a/client/deps/piglit/src/lib_path.patch b/client/deps/piglit/src/lib_path.patch
new file mode 100644
index 0000000..7f3f721
--- /dev/null
+++ b/client/deps/piglit/src/lib_path.patch
@@ -0,0 +1,11 @@
+--- piglit/framework/core.py	2013-01-17 16:03:17.677165077 -0800
++++ piglit/framework/core.py	2013-01-29 11:13:25.320014849 -0800
+@@ -211,6 +211,8 @@
+     p = os.path
+     os.environ['PIGLIT_SOURCE_DIR'] = p.abspath(p.join(p.dirname(__file__), '..'))
+ 
++os.environ['LD_LIBRARY_PATH'] = "/usr/local/autotest/deps/piglit/piglit/lib"
++
+ #############################################################################
+ ##### Result classes
+ #############################################################################
diff --git a/client/deps/piglit/src/monitor_tests_for_GPU_hang_and_SW_rasterization.patch b/client/deps/piglit/src/monitor_tests_for_GPU_hang_and_SW_rasterization.patch
index 3eace9c..c1c67c7 100644
--- a/client/deps/piglit/src/monitor_tests_for_GPU_hang_and_SW_rasterization.patch
+++ b/client/deps/piglit/src/monitor_tests_for_GPU_hang_and_SW_rasterization.patch
@@ -1,13 +1,11 @@
---- piglit/framework/exectest.py	2012-05-01 13:14:42.000000000 
-+++ piglit/framework/exectest.py	2012-05-10 16:07:55.000000000 
-@@ -29,12 +29,18 @@
- 
- #############################################################################
- ##### ExecTest: A shared base class for tests that simply run an executable.
+--- piglit/framework/exectest.py	2013-01-17 16:03:17.677165077 -0800
++++ piglit/framework/exectest.py	2013-01-17 17:17:40.666633122 -0800
+@@ -40,6 +40,13 @@
  #############################################################################
  
  class ExecTest(Test):
-+	# Variables for tracking hangs and hardware acceleration status.
++
++    # Variables for tracking hangs and hardware acceleration status.
 +	software = False
 +	glxinfo = ''
 +	hangs = {}
@@ -16,13 +14,7 @@
  	def __init__(self, command):
  		Test.__init__(self)
  		self.command = command
- 		self.env = {}
- 
- 		if isinstance(self.command, basestring):
-@@ -42,12 +48,45 @@
- 
- 	def interpretResult(self, out, results):
- 		raise NotImplementedError
+@@ -56,6 +63,39 @@
  		return out
  
  	def run(self, valgrind):
@@ -62,13 +54,7 @@
  		fullenv = os.environ.copy()
  		for e in self.env:
  			fullenv[e] = str(self.env[e])
- 
- 		if self.command is not None:
- 			command = self.command
-@@ -129,12 +168,27 @@
- 
- 		else:
- 			results = TestResult()
+@@ -159,6 +199,21 @@
  			if 'result' not in results:
  				results['result'] = 'skip'
  
@@ -89,7 +75,4 @@
 +		print results
  		return results
  
- 
- 
- #############################################################################
- ##### PlainExecTest: Run a "native" piglit test executable
+ 	def check_for_skip_scenario(self, command):
diff --git a/client/deps/piglit/src/piglit.tar.gz b/client/deps/piglit/src/piglit.tar.gz
index 0fd93c3..0afc034 100644
--- a/client/deps/piglit/src/piglit.tar.gz
+++ b/client/deps/piglit/src/piglit.tar.gz
Binary files differ