util: Move command-line parsing out of piglit_gl_test_config_init

Create a new function, piglit_gl_process_args, that does the
command-line parsing.  This happens after the test code between
PIGLIT_GL_TEST_CONFIG_BEGIN and PIGLIT_GL_TEST_CONFIG_END.  By having an
explicit function that does this, tests can call it inside the BEGIN/END
block.  This may be useful for tests that expect certain arguments to be
in specific positions.

piglit_gl_process_args removes processed arguments from the argc/argv
list.  This makes it safe to call multiple times since later calls
shouldn't see any arguments that they would process.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Paul Berry <stereotype441@gmail.com>
Reviewed-by: Chad Versace <chad.versace@linux.intel.com>
util: Add common framework for command-line invoked subtests

There are two parts to this.

First, command line options of the form "-subtest foo" have their
argument (the "foo" part) stored in a list in the
piglit_gl_test_config.  Tests can use this functionality without having
to use any of the other parts.  This allows every piglit test to have
the same syntax for specifying which subtests to run.

Second, tests can create a list of piglit_gl_subtest structures.  Each
structure describes a single subtest:  the name (as it will apear in the
log), the command-line name (as supplied to -subtest), and the function
that implements the test.  Helper function use this table and the list
of tests specified by -subtest options to run a group of tests.

A later patch shows an example of using this functionality.

v2: Use piglit_merge_result instead of
piglit_update_result_from_subtest_result.  Suggested by Eric, seconded
by Chad.

v3: Rename piglit_gl_subtest::subtest to
piglit_gl_subtest::subtest_func.  Fix some Doxygen comments.  Both
suggested by Chad.

v4: Add a 'void *data' field to piglit_gl_subtest that is passed to
piglit_gl_subtest::subtest_func.  Add a macro to detect the end of a
list of subtests.  Both suggested by Paul and seconded by Chad.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Paul Berry <stereotype441@gmail.com>
Reviewed-by: Chad Versace <chad.versace@linux.intel.com>
util: Add a -list-subtests option that will list all the subtests

The utility is that all.tests can do 'sometest -list-subtests' to
automatically get the list of subtests to run.  Since the syntax for
selecting subtests is regularized, this works quite well.

v2: Use a single way to detect the end of the list of subtests.
Suggested by Paul.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Paul Berry <stereotype441@gmail.com>
Reviewed-by: Chad Versace <chad.versace@linux.intel.com>
util: Add function to get the set of subtests selected from the command-line

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Chad Versace <chad.versace@linux.intel.com>
core.py: normalize testBinDir path

Signed-off-by: Dylan Baker <baker.dylan.c@gmail.com>
oglconform.tests: replace tabs with spaces

Signed-off-by: Dylan Baker <baker.dylan.c@gmail.com>
Revert "core.py: normalize testBinDir path"

This reverts commit 465c2291d2176e44bfb067fc624e5b881ca0e194.

This was not supposed to be in the push. oops.
ARB_texture_view: Test for API coverage of subset of input params

Tests GL_ARB_texture_view  and validity of input parameters.
Use both valid and invalid parameters, although mostly invalid
parameters are tested  since other tests will use valid parameters.
Only the parameters  "texture", "origtexture", "minlevel", "numlevels",
"minlayer", "numlayers"  are tested for validity  as per section 8.18 of
OpenGL 4.3 Core spec.

Tested on Nvidia Quadro 600 and it passes except the test invalid_layer_param.
NV driver returns INVALID_OPERATION instead of INVALID_VALUE for this test.

Reviewed-by: Brian Paul <brianp@vmware.com>
Signed-off-by: Jon Ashburn <jon@lunarg.com>
arb_texture_view: Test valid and invalid formats

When calling glTextureView() only certain formats are valid based on the format
of the original texture. This tests valid/invalid combinations.

Tested on Nvidia Quadro 600, all tests pass.

Reviewed-by: Brian Paul <brianp@vmware.com>
Signed-off-by: Jon Ashburn <jon@lunarg.com>
ARB_texture_view: Test valid and invalid targets for TextureView

The new target supplied with textureView must be compatible with the
original textures target. This tests  valid and invalid combinations.

Tested on Nvidia Quadro 600, all tests pass.

Reviewed-by: Brian Paul <brianp@vmware.com>
Signed-off-by: Jon Ashburn <jon@lunarg.com>
ARB_texture_view: Add query tests for gl state effected by this extension

Tests the queryable state from ARB_texture_view extension is correct.
Includes GL_TEXTURE_IMMUTABLE_LEVELS,GL_TEXTURE_VIEW_MIN_LEVEL,
 GL_TEXTURE_VIEW_NUM_LEVELS, GL_TEXTURE_IMMUTABLE_FORMAT.

Tested on Nvidia Quadro 600, all subtests pass.

Reviewed-by: Brian Paul <brianp@vmware.com>
Signed-off-by: Jon Ashburn <jon@lunarg.com>
ARB_texture_view: Test for rendering various targets in texture view

Tests GL_ARB_texture_view rendering with various texture targets.
Creates texture maps with different solid colors for each level or layer
reads the framebuffer to ensure the rendered color is correct.

Tested on Nvidia  Quadro 600, all subtests pass.

Reviewed-by: Brian Paul <brianp@vmware.com>
Signed-off-by: Jon Ashburn <jon@lunarg.com>
ARB_texture_view: Test for rendering various levels and layers in texture view

Tests GL_ARB_texture_view  rendering with various layers  and levels.
Creates texture maps with different  solid colors for each level or layer,
reads the framebuffer to ensure the rendered color is correct.

Tested on Nvidia  Quadro 600, all subtests pass.

Reviewed-by: Brian Paul <brianp@vmware.com>
Signed-off-by: Jon Ashburn <jon@lunarg.com>
ARB_texture_view: Test texture view format changes and lifetimes

Tests texture views with data format changes. 1D textures only.
Uses multiple simultaneous views with different lifetimes and
check results via glGetTexImage().

Tested on Nvidia  Quadro 600, all subtests pass.

Reviewed-by: Brian Paul <brianp@vmware.com>
Signed-off-by: Jon Ashburn <jon@lunarg.com>
glean: Fix occlusion query test: expect Gen/DeleteQueries while active to work

A recent inspection of the latest OpenGL specification revealed that
there is no requirement for errors to be generated if GenQueries or
DeleteQueries are called while a query is active.

Specifically, in Section 4.2 of OpenGL 4.4 (Core Profile) the only
errors specified for GenQueries and DeleteQueries is INVALID_VALUE if
the ID is negative.

Additionally, the same section specifies what to do in case the active
query is deleted:

	If an active query object is deleted its name immediately
	becomes unused,...

Implementing this requires that DeleteQueries be able to succeed when
a query is active.

Reviewed-by: Brian Paul <brianp@vmware.com>
cmake: Define PIGLIT_HAS_WAYLAND if using Waffle

File piglit_wl_framework.c, which belongs to the waffle framework, has
no compile-time Wayland dependencies. So it's always safe to build the
file and thus build Wayland support into Piglit.

Signed-off-by: Chad Versace <chad.versace@linux.intel.com>
cmake: Remove unused PIGLIT_HAS_EGL

Signed-off-by: Chad Versace <chad.versace@linux.intel.com>
cmake: Fail if PIGLIT_BUILD_GLES${N}_TESTS but cannot find EGL

If the user requests to build GLES tests but cmake fails to find the EGL
library, then configuration succeeded. Not until much later did faiure
occur, during linking the GLES tests.

Instead, cmake should fail early, during configuration not linking.
cmake: Use pkg-config to find EGL

This restricts building the EGL tests to Linux only. No problem, though,
because no other platform yet has EGL anyway.

Should fix Ian's build failure with egl-terminate-then-unbind-context.c.

CC: Ian Romanick <idr@freedesktop.org>
Signed-off-by: Chad Versace <chad.versace@linux.intel.com>
status.py: convert status object attributes from instance to class

This converts Status objects attributes to class attributes. This should
reduce lookup time and memory consumption of these classes.

Tested-by: Ben Widawsky <ben@bwidawsk.net>
Signed-off-by: Dylan Baker <baker.dylan.c@gmail.com>