util/egl: Fix build for old EGL headers

I broke the build for many people in commit
cf53b461387952b899b4df6ad4164444f8dee670. In that commit,
piglit-util-egl.c and egl_khr_fence_sync.c rely on a very recent
eglext.h to provide the EGL_PLATFORM_* enums.

Fix the build by defining the required enums in
piglit-util-egl.h.

When Piglit gets proper EGL dispatch, problems like this will disappear.

Reported-by: Ilia Mirkin <imirkin@alum.mit.edu>
Signed-off-by: Chad Versace <chad.versace@linux.intel.com>
arb_gpu_shader5: skip layout qualifier tests if extension not supported

Signed-off-by: Chris Forbes <chrisf@ijw.co.nz>
framework: fix potential bug in function signatures

There is a potential for some very odd bugs because of the way python
handles mutable arguments.

Consider this:
def foo(defaults=[]):
	defaults.append('a')
	return defaults

Calling foo(['bar']) will do the expected thing:
	>>> foo(['bar'])
	['bar', 'a']

But calling foo() will not:
	>>> foo()
	['a']
	>>> foo()
	['a', 'a']

Signed-off-by: Dylan Baker <baker.dylan.c@gmail.com>
Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu>
framework: Dump the result of 'uname -a' in the report

Signed-off-by: Damien Lespiau <damien.lespiau@intel.com>
Reviewed-by: Dylan Baker <baker.dylan.c@gmail.com>
tests/igt.py: add support for reading the test list from the file system

Signed-off-by: Thomas Wood <thomas.wood@intel.com>
cl: Add cl-api-enqueue-copy-buffer-rect test
gtest: Use correct fuction signature for interpret_result

This was changed in fb6c545d880791f8e3057bbd86dd5cdf1bf3a3d3
and gtest.py was not updated.
util: Move MSVC's inline macro to piglit-util.h

So that it is more widely defined.

This should fix MSVC build.

Trivial change, which does not affect non-Windows builds in any way.
Allow setting a cwd to execute tests from.

Reviewed-by: Dylan Baker <baker.dylan.c@gmail.com>
framework/core.py: Add pre_run and post_run hooks to TestProfile

These hooks no-op in the default TestProfile class, however they are
intended to give versatility and power to external test suites, which
may have specific environment requirements, setup requirements, or
teardown requirements, by allowing them to subclass TestProfile and set
these methods.

Signed-off-by: Dylan Baker <baker.dylan.c@gmail.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
python: Add results_dir to TestProfile

This is needed specifically by XTS, but it might be useful for other
external suites that want to move files out of their runtime directories
into the saved directory. Specifically if those files are linked into
the summary.

v3: - Add the results_dir name definition to the constructor

Signed-off-by: Dylan Baker <baker.dylan.c@gmail.com>
Reviewed-by: Eric Anholt <eric@anholt.net> (v2)
tests/xts.py: Add a tests file for the X Test suite.

This adds support for running XTS from piglit.

This patch was original written by Eric Anholt, but I've cleaned it up
and reworked parts of it for upstreaming, and as a result I've attached
my name as the author so ``git bisect'' and ``git blame'' will send
angry mail my way instead of Eric's.

v2: - Don't break dmesg reporting
    - Use str.format consistently
    - populate profile after check for xtest symlink
v3: - rebase against master
    - fix spelling errors

Signed-off-by: Dylan Baker <baker.dylan.c@gmail.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
fbo-depth-sample-compare: Eliminate dependency on glutSolidSphere.

Reviewed-by: Brian Paul <brianp@vmware.com>
util: Create core profiles with GLUT when supported by freeglut.

Handy until we have waffle everywhere.

Reviewed-by: Brian Paul <brianp@vmware.com>
junit: Results' stdout and stderr is now in `out` in `err`.
profile: Fix mixed concurrency runs

Currently we call join after initializing both of the pools, which means
that they run simultaneously. This patch fixes that by creating a helper
function which sets off the pool, closes it, and then joins it. This
fixes the problem by forcing each pool to run in series.

v2: - Fix typo that put all tests in a multithreaded pool
    - split lines differently for improved readability

Signed-off-by: Dylan Baker <baker.dylan.c@gmail.com>
Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu>
framework/core.py: Remove unused imports and fix __all__

After profile was split out of the core module it's imports were not
removed. This has a small overhead cost and drive the code quality
checking tools crazy.

__all__ is a module name that controls the values exported when running
help() or pydoc. Setting these to reflect proper values helps python
tools to function better and makes the documentation accurate.

None of these changes affect running code at all.

Signed-off-by: Dylan Baker <baker.dylan.c@gmail.com>
egl/utils: Prepare egl_util_run to be called from piglit subtests.

For future EGL tests, I want to be able to use Chad's new piglit EGL
subtest infrastructure, and use the EGL utilities convenience functions
to set up a window, surface, and context.

Currently, egl_util_run calls piglit_report_result() after calling
test.draw.  This means no other subtests get run.  Add a new field in
egl_test to specify whether piglit_report_result() should be called, and
another field to store the result returned from test.draw.

Make sure that egl_util_run() tears down the window, surface, and
context.  Previously it was relying on cleanup being done when the
process died, which won't work if we want to run a second subtest in the
same thread.

TODO:

There's still some work that could be done here to ensure the
initialization steps in egl_util_run aren't done twice (e.g. calling
XOpenDisplay, eglInitialize, etc.)  However, the tests pass in their
current state, so there's no reason they shouldn't be merged.

Thanks a bunch to Chad Versace and Rob Bradford, who helped me debug
this code!

Signed-off-by: Sarah Sharp <sarah.a.sharp@linux.intel.com>
Cc: Chad Versace <chad.versace@linux.intel.com>
Cc: Rob Bradford <rob@linux.intel.com>
EGL_CHROMIUM_sync_control: Add initial tests.

Test the EGL_CHROMIUM_sync_control extension, which is similar to
the GLX_OML_sync_control extension:

http://www.opengl.org/registry/specs/OML/glx_sync_control.txt

The extension only defines one new function,
EGL_CHROMIUM_get_sync_values, which is equivalent to the
glXGetSyncValuesOML function.

It's difficult to test the Media Stream Counter (MSC) without the
equivalent function to get the MSC rate (glXGetMscRateOML).  The test at
least makes sure MSC and SBC increment after two SwapBuffers() calls.
UST is system-dependent, so it may behave differently on Windows, Linux,
and Apple.  The test just makes sure it increments monotonically.

The test uses Chad's new subtest infrastructure and the EGL convenience
functions from egl-util.c.

v2:
 - Remove glFinish in egl_util_run.  Tests still pass without it.
 - Fix memory leak of vinfo in create_window.
 - Make error handling code in egl_util_run more readable/verifiable.
 - Make sure test is const in egl_util_run.
 - The extension *name* should be EGL_CHROMIUM_sync_control, and the new
   *function* is called EGL_CHROMIUM_get_sync_values.

Signed-off-by: Sarah Sharp <sarah.a.sharp@linux.intel.com>
Cc: Chad Versace <chad.versace@linux.intel.com>
Cc: Rob Bradford <rob@linux.intel.com>