Add more README documentation on how existing test drivers are structured.

More than once, I've reverse-engineered how the test suite uses test
drivers (app_driver.py and tool_driver.py) to invoke scripts within
the apps/ and traces/ directory. In order to save my future-self some
work in doing this yet again, I've written some documentation in
README.markdown in each directory.

Hopefully this documentation will be useful for anyone wanting to
write additional tests.
Add a new 'cli' subdirectory for higher-level testing of apitrace CLI.

As described in the README, this new directory is for tests that
perform higher-level testing of the apitrace command-line interface
than either of the existing traces or apps directories.

Compared to traces, these new tests can do higher-level things like
dumping images from traces, comparing images, etc.

Compared to apps, these tests are intended to be portable across
multiple targets. (This isn't actually the case yet because commands
like "apitrace dump-images" currently work only on OpenGL. Also, even
when that is fixed, we will also need to then extend these tests to
have traces for each supported target for testing.)

In this commit, the only new test exercises "apitrace dump-images" and
"apitrace diff-images" on a simple trace file with one frame,
(tri.trace grabbed from apps/gl).
Add a test that "apitrace diff-images" flags mismatching images.

With this test we add a new EXPECT_FAILURE: attribute to the script
syntax to indicate that a particular apitrace command in the script is
expected to fail. This requires manually invoking the Popen
constructor rather than using subprocess.check_output, (which is
*close* to what we need but fails to assign the output when raising an
exception).

We also remove the globbing from the CMakeLists.txt file to get a
manual ordering of the tests (rather than executing in alphabetic
order).
Add some comments to the recently-added cli tests.

It's easy enough to ignore lines starting with a '#' and that lets us
make these tests more self-documenting.
Add a test to ensure "apitrace trim" performs proper dependency checking

Here we trim a trace by specifying (with --calls) only the final
glXSwapBuffers and then test that we can still produce a matching
image from the trace. This will only succeed if "apitrace trim"
performs dependency checking and includes many previous calls.

Of course, historically "apitrace trim" performed no such dependency
checks, so older versions of apitrace are expected to fail this test.
Print commands to be executed by cli_driver.py

These aren't made visible unless CTEST_OUTPUT_ON_FAILURE in set, and
in that case it's quite convenient to see what the test was doing when
it failed.
cli: Use new --call-nos=no call to "apitrace dump-images" for consistent results

Recent "apitrace trim" is now dropping uninteresting calls by
default. This means that the call numbers of rendering operations are
changing. Consequently, image comparisons were failing not due to
image-content differences, but simply because the filenames (with
embedded call numbers in them) no longer matched.

We can avoid this problem by using the --call-nos=no option which was
added to "apitrace dump-images" in very recent versions.
Add the source of a very simple program using OpenGL through GLX.

We'll use this program to generate traces for use in the test suite,
(to exercise using "apitrace trim" to trim away unused textures,
shader programs, etc.).

There is a Makefile here, for convenience to any test writers wanting
to expand this program. Note that this Makefile us intentionally not
integrated with the cmake setup of the apitrace-tests project. That's
because it is not expected that this test program should be built or
run as a standard part of the test suite. Instead, useful trace files
generated from glxsimple will be directly committed to the
apitrace-tests repository.
glxsimple: Add a second frame drawing a solid color with GLSL.

This will allow us to test that we can trim out unused shaders.
Add a third frame, this time drawing with a texture.

This will allow us to test that "apitrace trim" can trim out unused
textures.
Make glxsimple loop over all drawing methods multiple times

We now have 3 different drawing methods, each performed two times, and
in a total of 6 different colors. Looping over theese things twice
means that we can trim out a single frame of any one method and ensure
that "apitrace trim" has some non-trivial trimming to do both before
and after the frame of interest.
trim-head: New test to ensure "apitrace trim" drops all calls after range

This test ensures that all calls beyond the user-specified range are
correctly dropped. It also ensures that uninteresting calls are
trimmed, (since the glxsimple trace includes many of those).
Add test to ensure that unused textures are dropped from a trace.

This tests functionality recently added to "apitrace trim".
cli_driver: Rework driver script to preserve json-embedded whitespace

Previously, the line read from the script was being passed through
python's string.split() and string.join() functions. This was causing
sequences of successive whitespace characters to be collapsed down to
a single space, (in turn causing spurious failures when comparing
against expected output with successive whitespace).

Rework the driver to avoid munging the line past the separation of the
first command word.
Add test to ensure that unused shaders are dropped from a trace.

This tests functionality which was added even more recently to
"apitrace trim".
Add a couple of tests for the --frames option of "apitrace trim"

Recent versions of apitrace added this new command-line option, so
it's useful to test that it actually works here.
Add stress tests from "apitrace trim".

The trim_stress directory makes it simple to stress test "apitrace
trim" by simply dropping new trace files into this directory. The
stress testing ensures that creating a new trace by trimming to a
single frame still generates the same image as that frame from the
original trace. It performs this test exhaustively for each frame of
each trace.

This testing ensures that trimming doesn't break the rendered results
of any frame. It does not do anything to test that trimming actually
discards anything. So the existing cli tests are still
independendently useful for verifying that expected content is
discarded.
glxsimple: Introduce an inter-frame texture dependency to exercise trim code

The previous glxsimple program was too simple as each frame was
entirely self-contained, (textures were created, initialized, and
referenced only within single frames).

For more realistic trimming, we create and initialize a texture in one
frame, then reference that texture in a later frame. This is a better
test to ensure that when trimming the first frame the texture creation
and initialization is not discarded.
Track updates to "apitrace trim" which no longer drops glBindTexture calls

We still aren't sure *why* apitrace trim should have to leave these
calls around, but we have a trace which only passes the
trim-stress-test if these calls are untrimmed. While that mystery
waits to be solved, make the test here compatible with the current
behavior.
trim: Update for --exact -> --auto