json_tests.py: Add unit tests for json backend

Refactor run.py a little to allow testing the Backend.initialize() call.

This adds tests for the output of the json piglit format. This currently
has 4 failing tests exposing two separate bugs:
1) the logger verbosity level is not stored and thus cannot be used by
resume
2) lspci, uname, and glxinfo are not written into the root of the json
output.

This also adds a unit test utility function for skipping unit tests when
the OS is not the required OS.

Signed-off-by: Dylan Baker <dylanx.c.baker@intel.com>
Tested-by: Emil Velikov <emil.l.velikov@gmail.com>
framework: fix glxinfo, uname, and lspci in json output

Move the environment information back into the root of the json output
dictionary.

Also modifies two tests. One is removed because it is basically a
duplicate of the tests added in the last patch, the other is simplified
to be more robust.

Signed-off-by: Dylan Baker <dylanx.c.baker@intel.com>
Tested-by: Emil Velikov <emil.l.velikov@gmail.com>
run.py: store log_level (verbosity) for resume

This allows resume to use the same level of verbosity as the initial
run.

Signed-off-by: Dylan Baker <dylanx.c.baker@intel.com>
Tested-by: Emil Velikov <emil.l.velikov@gmail.com>
results_v0_tests.py: Use TestrunResult.load instead of load_results

framework.results.load_results calls update_results() internally. This
means that as soon as a second method is added that updates results to
version 2 then the tests will start failing.

v2: - add this patch

Signed-off-by: Dylan Baker <dylanx.c.baker@intel.com>
Tested-by: Emil Velikov <emil.l.velikov@gmail.com>
json_.py: Bump results version to 2

This corrects in a permanent and automatic way the changes in the
results that were fixed in the previous patch.

v2: - add this patch
v3: - Only add each element if it exists
    - Put the tests in their own module
v4: - actually check that test module into git...

Signed-off-by: Dylan Baker <dylanx.c.baker@intel.com>
Tested-by: Emil Velikov <emil.l.velikov@gmail.com>
Fix egl-create-pbuffer-surface test

Piglit egl-util nowadays require gles to be declared in
test attributes, otherwise we'll get gl.

Signed-off-by: Juha-Pekka Heikkila <juhapekka.heikkila@gmail.com>
Reviewed-by: Tapani Pälli <tapani.palli@intel.com>
Fix egl-nok-texture-from-pixmap

Piglit egl-util nowadays require gles to be declared in
test attributes, otherwise we'll get gl.

Signed-off-by: Juha-Pekka Heikkila <juhapekka.heikkila@gmail.com>
Reviewed-by: Tapani Pälli <tapani.palli@intel.com>
egl-util.c: add warning if no EGL_RENDERABLE_TYPE is defined for test

Signed-off-by: Juha-Pekka Heikkila <juhapekka.heikkila@gmail.com>
Reviewed-by: Tapani Pälli <tapani.palli@intel.com>
gbm: use libcaca to display results in non-auto mode

If GBM is enabled, attempt to locate libcaca too.

If the test was not run with -auto, then use libcaca
to draw a text version of the test's results to the
console.

v2 (Ben): Rebase
Per Ken's comment the libcaca API may change at v1.0, but it's still not
there are 8 months. I propose we push this, and worry about libcaca
breakage later.

Signed-off-by: Jordan Justen <jordan.l.justen@intel.com> (v1)
Acked-by: Kenneth Graunke <kenneth@whitecape.org>
Cc: Kristian Høgsberg <krh@bitplanet.net>
Signed-off-by: Ben Widawsky <ben@bwidawsk.net>
ext_transform_feedback-points: a new, simple xfb test

If argv[1]="large", draw large points (which may get converted to quads).

Reviewed-by: Charmaine Lee <charmainel@vmware.com>
profile.py: If the test list is empty after being filtered exit

Currently if the test list is empty an assertion will be raised in the
storage backend, this is a non-obvious message. This patch adds a quick
check that prints a nice message if there are not tests scheduled to
run.

Signed-off-by: Dylan Baker <dylanx.c.baker@intel.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
arb_texture_multisample: add test for sampling from depth

This demonstrates an i965 bug, where hiz resolves for MSAA surfaces
don't work (on BLORP platforms).

Signed-off-by: Chris Forbes <chrisf@ijw.co.nz>
Reviewed-by: Glenn Kennard <glenn.kennard@gmail.com>
cl: Add test for clCreateProgramWithBinary() v3

v2:
  - Fix filename in doxygen comments
  - Remove redundant binary status check.

v3:
  - Add test cases for passing binary programs to clBuildProgram() and
    clCompileProgram().

Reviewed-by: Francisco Jerez <currojerez@riseup.net>
arb_tessellation_shader: Add sanity shader_runner test.

Add test that should tessellate two 3-vertex-patches into one triangle each
to fill the screen.

The test should effectively bahave as if the vertex data was used to draw
GL_TRIANGLES without the tessellation stage.

Note [Chris]: This is partially redundant with nop.shader_test, but the
approach in the tessellation evaluation shader is more normal (weighted
sum of vertices) so both are useful.

Reviewed-by: Chris Forbes <chrisf@ijw.co.nz>
arb_tessellation_shader: Test large uniforms arrays.

Test uniform arrays of maximal size as well as arrays of uniform blocks.

Also test for the required linking errors if too large uniform arrays are
requested.
arb_tessellation_shader: Test global layout qualifiers.

Test declaring layout qualifiers in multiple shader objects and check for
linking arrays if qualifiers mismatch.
gen_builtin_uniform_tests.py: Add tessellation control shader tests.
generated_tests: Test tessellation evaluation shader input.

For every GLSL variable type, generate four tests. One passes a per-vertex
and one a per-patch varying of said type as a scalar from the tessellation
control to the tessellation evaluation shader. The two other tests do the same
for a two-element array of that type.

The varying gets filled in the tessellation control shader from a uniform and
compared against the same uniform in the tessellation evaluation shader.

Every test draws 4 patches, each of which gets tessellated into a quad that
fills a quarter of the screen.

Also test core profile built-in varyings in gl_PerVertex.
generated_tests: Test tessellation control shader input.

for every GLSL variable type, generate two tests. One passes a varying of said
type as a scalar from the vertex to the tessellation control shader and one
that passes a two-element array.
Fill the varying in the vertex shader from a uniform and compare
it against the uniform in the tessellation control shader.

Draw 4 patches, tessellate each into a quad that fills a quarter of the
screen.

Also test core profile built-in varyings.
built-in-constants: Fix shader template for TCS.

Previously this tried to assign vec4 to float, and would fail there
rather than testing anything useful.

Signed-off-by: Chris Forbes <chrisf@ijw.co.nz>