Tiny improvement to wait_for_match docstring
Cleanup debug messages to not include /full/path/to/stbt

To make the debug messages a more readable line length.
wait_for_match searches for template image in script's own directory

This paves the way for separating preconditions (like "start in the
settings menu") into python functions in separate files, that can be
called from stbt scripts.

Note that in _caller_dir I have tried hard not to keep references to
frame objects, to avoid reference cycles. Hopefully I don't need any
explicit `del`s. See
http://docs.python.org/library/inspect.html#the-interpreter-stack

Note that the selftests tend to create a stbt script in /tmp (see
tests/test-stbt-run.sh). To avoid having to copy the template images to
/tmp, stbt-run tries the current directory if the template image can't
be found in the script's directory. Hopefully this won't cause any
trouble in production -- after all we do check the script's directory
*first*.
Move Display from stbt-run to stbt.py

This is in preparation for a videotestsrc remote control that will be
used by the selftests: The remote control will need to access Display's
internal details (its source pipeline), so they should be in the same
module.

The order in stbt.py looks like this: gstreamer-related stuff, remote-
control-related stuff, exception hierarchy, miscellaneous.
Format "Options" section of man page

in preparation for the VideoTestSrcControl I'll be adding soon.
videotestsrc remote control for the selftests

Use it with `--control=test`. Only works with
`--source-pipeline=videotestsrc`.

A stbt script like `press("18")` will cause the videotestsrc element to
change to pattern 18 (see `gst-inspect videotestsrc` for the available
patterns).

By the way, I changed the uri for the null control to be case
insensitive (so it can be `--control=none` instead of `--control=None`)
for consistency with `--control=test`.
Simplistic support for packaged preconditions

Instead of repeating a series of `press` + `wait_for_match` commands in
each script, you can put them in a separate script (e.g.
`preconditions.py`) and have them run before your own script (e.g.
`test.py`) with:

    stbt run --module=preconditions.py test.py

In the very near future we'll make this more straight-forward by making
the scripts import the stb-tester framework, not the other way round.
Then the preconditions support is there automatically via python's
normal package & module importing.
Merge branch 'preconditions'

* 'preconditions':
  Simplistic support for packaged preconditions
  videotestsrc remote control for the selftests
  Format "Options" section of man page
  Move Display from stbt-run to stbt.py
  wait_for_match searches for template image in script's own directory
stbt-record: Handle EOF in control-recorder input

End-Of-File is handled just as well as a Control-C is.

This is essential for file-based input: `--control-recorder=file://...`
(although file-based input still won't work well, because we need to
somehow introduce a delay before the first keypress so the gstreamer
pipeline has a chance to start up, and between keypresses so the video
source has a chance to react).

In `file_remote_recorder`, note that file.readline() returns an empty
string *only* when EOF is encountered immediately.
Selftest for stbt-record

We run stbt-record from $scratchdir, so that the test.py is saved there,
but we run stbt-run from the tests directory so that it can find the
manually-cropped template images (that committed to source control). We
remove the screenshots from $scratchdir so that run-tests.sh can remove
$scratchdir.

Note that run-tests.sh now requires bash, to support
<(process substitution) in test_record().