utils: cleanup winsys on test exit

Tested-by: Ilia Mirkin <imirkin@alum.mit.edu>
Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
util/wfl: unbind the current context before destroying its window

Otherwise we end up leaking the drawable. Spotted by Valgrind

Tested-by: Ilia Mirkin <imirkin@alum.mit.edu>
Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
cl: Add log1p tests

Signed-off-by: Aaron Watry <awatry@gmail.com>
Reviewed-by: Tom Stellard <thomas.stellard@amd.com>
gles2: add test to render a point without vertex attributes

v2: instead of c, make it a shader_runner_gles2 test

Signed-off-by: Tapani Pälli <tapani.palli@intel.com>
Reviewed-by: Anuj Phogat <anuj.phogat@gmail.com>
gles2: add linker test for varying that is not written but read

Signed-off-by: Tapani Pälli <tapani.palli@intel.com>
Reviewed-by: Anuj Phogat <anuj.phogat@gmail.com>
gles2: add linker test for shader not writing to gl_Position

Signed-off-by: Tapani Pälli <tapani.palli@intel.com>
Reviewed-by:  Anuj Phogat <anuj.phogat@gmail.com>
framework tests: Stop leaving temporary files

There is an odd interaction between context manager and
nose.tools.raises and nose.tools.assert_raises, if the context manager
is initializes inside of the assert_raises the temporary files a folders
will not be cleaned up.

Signed-off-by: Dylan Baker <dylanx.c.baker@intel.com>
exectest_test.py: Add a unit test for the expanding running bug

There is a bug right now that is present in the quite (and by
inheritance verbose) logger, which causes a test that uses the default
status to assert and the thread closes. When this happens the logger
doesn't finish, and the running line isn't removed.

Signed-off-by: Dylan Baker <dylanx.c.baker@intel.com>
results.py: Do add load class method to TestResult

This creates an alternate constructor for loading an existing test
result, designed for use with loading an existing TestrunResult. This
fixes the bug in demonstrated by the test in the last patch by not
converting the result key into a status object in all conditions.

Signed-off-by: Dylan Baker <dylanx.c.baker@intel.com>
results.py: Remove TestrunResult() repair file

This patch removes the TestrunResult private methods for repairing a
json file, and adds an alternate constructor that reads the results.json
file and assumes that the json file is valid (it should be after all),
and converts the test results to TestResult instances.

This patch should have been part of the atomic-rewrite series that
landed recently, but was lost in a rebase error.

Signed-off-by: Dylan Baker <dylanx.c.baker@intel.com>
egl-create-pbuffer-surface: Add test for egl pbuffer surface

Test to create egl pbuffer surface, clear it with glClear, draw
it to window and read written color back.

Signed-off-by: Juha-Pekka Heikkila <juhapekka.heikkila@gmail.com>
Reviewed-by: Tapani Pälli <tapani.palli@intel.com>
framework tests: fix timeout tests

Currently the timeout tests rely on /usr/bin/sleep and /usr/bin/true.
This is very fragile, since on my (Gentoo) system true is in /bin. The
better solution is to rely on either a shell built-in or to just find
the binary in path.

This of course still has some fragility, so this patch also introduces a
new utility function, binary_check. This function looks for a command
using which (not window safe of course, but most of the unit tests
aren't) or it raises a SkipTest.

Signed-off-by: Dylan Baker <dylanx.c.baker@intel.com>
framework: Move tests derived classes into a package

This moves all of the classes that derive from Test into a package
called test. This patch looks very large, but is mostly just moving
files around and changing imports to account for this.

So why all of this code churn? The big advantage is that through
__init__.py magic there is one module to be imported, framework.test.
This module contains all of the public classes, functions, and
constants, in one place while hiding the rest, but allowing them to be
accessed explicitly.

Signed-off-by: Dylan Baker <dylanx.c.baker@intel.com>
framework/test: refactor abstract Test and PiglitTest

This creates two separate modules for these classes.

Making this change allows us to separate the basic building blocks of
Test classes and the concrete implementations.

Signed-off-by: Dylan Baker <dylanx.c.baker@intel.com>
framework: Split PiglitTest into specific GL and CL classes

This creates two separate classes for OpenGL and OpenCL tests. This
allows the implementation of features, workarounds, etc for only one
standard without adversely effecting the other.

Signed-off-by: Dylan Baker <dylanx.c.baker@intel.com>
test: Split the spurious resize code out of PiglitGLTest

This patch splits that run method out into a separate mixin class that
overrides only the _run_command method. This split will be used in the
next patch to apply the same mixin to the GleanTest class, which
theoretically suffers from the same problem but doesn't have this catch.

v2: - add test for WindowResizeMixin

Signed-off-by: Dylan Baker <dylanx.c.baker@intel.com>
framework/test/base.py: Use a flag in _run_command

If there is an error in self._run_command return a flag of either True
or False, instead of checking for self.result['result'] == 'skip' in
Test.run() for early return check for the returned error flag. This
makes the early return mechanism much more flexible and extensible than
it was before, especially for mixins and subclasses that whish to extend
the _run_command method.

v2: - add test for _run_command return code

Signed-off-by: Dylan Baker <dylanx.c.baker@intel.com>
base.py: Extend the WindowResizeMixin to return early

In the event that we get more spurious window resizes than our threshold
(5), mark the test as fail, adds a message in out as to why it failed,
and then returns True so that Test.run() will return early.

Signed-off-by: Dylan Baker <dylanx.c.baker@intel.com>
framework: Move PLATFORMS list to core

This allows the PLATFORMS list to be readily shared, and will be used in
the next patch.

Signed-off-by: Dylan Baker <dylanx.c.baker@intel.com>
piglit_test.py: Automatically add -auto and -fbo when appropriate

There is a lot of logic in all.py to add -auto and possible -fbo to
tests when it is appropriate. This is rather silly as we can just make
the test class do this for us, which has the added advantage of reducing
the amount of memory each test needs by reducing the number of strings
stored by each instance.

Signed-off-by: Dylan Baker <dylanx.c.baker@intel.com>