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>
gl-2.0: Verify results of program validation when a conflicting sampler configuration is used.

Section 2.15.4 (Shader Execution), subheading "Validation" of the OpenGL
2.0 spec says:

    "[INVALID_OPERATION] is generated by Begin, RasterPos, or any
    command that performs an implicit Begin if:

        - any two active samplers in the current program object are of
          different types, but refer to the same texture image unit,"

This test verifies this behavior several ways.  First, an invalid
configuration is constructed.  When the program is in the invalid
configuration, glValidateProgram is used to determine the status.

The program is then transitioned to a valid configuration, and
glValidateProgram is called again.

The program is then transitioned back to the invalid configuration.
Without calling glValidateProgram, glBegin is called.  This should
generate the aforementioned error.  While still in the invalid state
glValidateProgram is called a third time.

Finally, the program is transitioned back to the valid configuration.
Without calling glValidateProgram, glBegin is called.  This should not
generate any error.

All of the state flip-flopping is done in an attempt to catch
implementations that latch state in glValidateProgram and do not
re-validate in glBegin.

NOTE: Mesa fails this test because it does not generate
GL_INVALID_OPERATION the first time glBegin is called.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Anuj Phogat <anuj.phogat@gmail.com>
sso: Verify results of program pipeline validation when a conflicting sampler configuration is used.

Section 2.11.11 (Shader Execution), subheading "Validation," of the
OpenGL 4.1 spec says:

    "[INVALID_OPERATION] is generated by any command that transfers
    vertices to the GL if:

        ...

        - Any two active samplers in the current program object are of
          different types, but refer to the same texture image unit."

This test verifies this behavior several ways.  First, an invalid
configuration is constructed.  When the pipeline is in the invalid
configuration, glValidateProgramPipeline is used to determine the
status.

The pipeline is then transitioned to a valid configuration, and
glValidateProgramPipeline is called again.

The pipeline is then transitioned back to the invalid configuration.
Without calling glValidateProgramPipeline, glDrawArrays is called.  This
should generate the aforementioned error.  While still in the invalid
state glValidateProgramPipeline is called a third time.

Finally, the pipeline is transitioned back to the valid configuration.
Without calling glValidateProgramPipeline, glDrawArrays is called.  This
should not generate any error.

All of the state flip-flopping is done in an attempt to catch
implementations that latch state in glValidateProgramPipeline and do not
re-validate in glDrawArrays.

NOTE: The work-in-progress GL_ARB_separate_shader_objects implementation
for Mesa currently fails this test because glValidateProgramPipeline
always succeeds, and it does not generate GL_INVALID_OPERATION the first
time glDrawArrays is called.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Anuj Phogat <anuj.phogat@gmail.com>
normal3b3s-invariance: test GLbyte[3] and GLshort[3] normal vec invariance

Test rendering invariance with GLfloat[3] vs. GLbyte[3] vs. GLshort[3]
normal vectors.  See comments in code for more details.
swapbuffers-behavior: check if swapbuffers swaps or copies

Probe front/back buffers after a SwapBuffers() call to see if the
implementation does a true swap or a back-to-front copy.

There is no pass/fail (except for one sanity check).  This is just
to find out what GL does.
fbo-readpixels: use piglit_get_gl_enum_name() for info/error messages

Reviewed-by: Eric Anholt <eric@anholt.net>
implement new texture swizzle test

The original one didn't test the GL_ONE and GL_ZERO terms and was
pretty compilicated.  This tests all swizzle combinations and is
much simpler.

v2: remove stray '&& pass' per Eric.

Reviewed-by: Eric Anholt <eric@anholt.net>
add new texture swizzle API test

Test for API errors and glGet for GL_EXT_texture_swizzle.

v2: minor re-org, per Eric

Reviewed-by: Eric Anholt <eric@anholt.net>
remove old tex-swizzle test

It didn't test the GL_ONE and GL_ZERO terms and was needlessly
complicated.  Replaced by ext_texture_swizzle-swizzle test.

Reviewed-by: Eric Anholt <eric@anholt.net>
remove glean texSwizzle test

Replaced by spec/ext_texture_swizzle/api.c and swizzle.c tests.

Reviewed-by: Eric Anholt <eric@anholt.net>
glsl-1.20: Add more tests for various 'invariant' scenarios

Signed-off-by: Chris Forbes <chrisf@ijw.co.nz>
Reviewed-by: Anuj Phogat <anuj.phogat@gmail.com>