tests/test-stbt-batch.sh: Increase timeouts

Self-tests that are testing that `stbt batch run` (without `-1`) keeps
on running until one of the test scripts fails, have a timeout to avoid
the self-test running forever in the (hypothetical) presence of a bug
in `stbt batch run`. This timeout needs to be increased for systems that
are running the self-tests while under heavy load. The increased timeout
shouldn't make any difference to the run-time of these self-tests in the
normal (successful) case.

Thanks to Lewis Haley for reporting the problem:

> I got false negatives for these tests because they were timing out
> before they could conclude. This was probably due to my system having
> a heavy load at the time (running tests with extra logging processes)
> and the stb-tester selftests in parallel.

I also did some related cleanup: I added the `-1` argument to a
self-test that isn't explicitly testing the exit-on-failure behaviour,
but was relying on the fact that `tests/test.py` returns failure the
second time it is run. And I added a timeout to all remaining self-tests
that call `stbt batch run` without `-1`, for consistency.
stbt control: Detect duplicated keyboard keys in the keymap file

If a user assigns multiple remote control keys to a keyboard key in the
keymap file, like

    o   OPEN
    o   OK

`stbt control` silently ignores this configuration issue and only
uses the mapping that is specified later in the keymap file.

Rase `stbt.ConfigurationError` if a keyboard key is duplicated.
Merge pull request #123 from szemate/stbt-control-to-detect-duplicated-key

stbt control: Detect duplicated keyboard keys in the keymap file
stbt.py: Document that GObject.threads_init() won't be needed forever

See
https://help.gnome.org/misc/release-notes/3.12/developers.html.en#pygobject

For the foreseeable future we still have to support GObject < 3.12.
Add scripts for creating Ubuntu PPA with our dependencies

When we migrated to GStreamer 1.0 we had to patch some regressions
which had made their way into GStreamer since 0.10.  These patches
have been submitted upstream but not yet made their way into a
stable release of GStreamer, let alone the major distros.  This
makes it very difficult for our users to install and deploy
stb-tester.  This is an attempt at simplifying this process by
providing appropriately patched versions of our dependencies in an
Ubuntu PPA.

This also includes a dkms package to allow distributing a patched
version of the uvcvideo driver.  This is required for Smart TV
support with the Logitech C920 driver.

The code isn't beautiful but it lives in extra/ and is a tools
for maintainers rather than users or developers.
PPA Support: disable `make check` as a part of building Debian package

Disable `make check` for now as it gives us difficulty on Ubuntu's PPA
build farm.  Specifically the lack of a terminal prevents expect from
working and there are timing issues due to the load the build machines are
under.

This commit should be reverted once these issues have been investigated
and resolved but for now PPAs are more important.
PPA Support: Add make target `make ppa-publish`

This makes it easy to publish stb-tester packages for Ubuntu.
stbt.py: Fix teardown hang with BlackMagic Intensity Pro

Since the port to GStreamer 1.0 the BlackMagic Intensity Pro has caused
an intermittant hang during pipeline teardown (after the test script has
run to completion).  While it should be valid to call

    source_pipeline.set_state(Gst.State.NULL)

at any time this was hanging.

It seems from the backtraces that the `GstBaseSrc` thread that was
associated with `decklinksrc` was blocked calling `gst_task_join`, e.g.
waiting for the BlackMagic thread to finish.  In turn there was another
thread (presumably the target of the join) calling into the proprietary
BlackMagic blob which seemed to be just blocked on `poll()`, presumably as
part of an event loop.  There must be some sort of race condition in there.

Instead we shut the pipeline down more gently by first sending EOS to the
source pipeline and then only after receiving EOS from our `appsink` do we
precede to state NULL.  This way we can be certain that the pipeline is
quiescent before attempting the state change.   This seems to fix the hang.

Fixes #110
Merge pull request #124 from wmanley/blackmagic-fixes

stbt.py: Fix teardown hang with BlackMagic Intensity Pro
fixup! stbt.py: Fix teardown hang with BlackMagic Intensity Pro

Fix a race in the recently modified teardown code.  With further testing
with the Teradek VidiU I got the error:

    stbt-run: teardown: Source pipeline did not teardown gracefully
    Traceback (most recent call last):

      File "stbt.py", line 1408, in teardown
        self.source_pipeline.set_state(Gst.State.NULL)
    AttributeError: 'NoneType' object has no attribute 'set_state'

As `rtmpsrc` has its own teardown problems (see #111).
Misc: Fix typo in error message

Instead of "usedwith" it says "used with".
stbt.py: Fix `stbt._set_config` for sections which don't yet exist

Bug discovered when trying to set a config item in an empty config file.
pylint 1.1 support: `disable-msg` is deprecated in favor of `disable`

This is a warning on pylint 1.1.  `disable-msg` was deprecated in 0.21.0.
Our oldest platform (Ubuntu 12.04) has 0.25.
Merge pull request #125 from wmanley/ppa

 Create Ubuntu PPA including our dependencies
Add automated test involving video capture hardware

This is a nascent attempt to write some automated tests to ensure that
stb-tester continues to work with all our current supported hardware.  It's
currently very basic but works.  The intention is that in the future we
will have a test rig such that all commits are tested with real hardware
to prevent future regressions.

The test is currently very basic, it just checks to see if something major
goes wrong but in the future we can add greater control over the input
to the hardware (e.g. using a Raspberry Pi) to measure other properties
such as quality, latency, startup/shutdown time, ability to recover from
video loss, ability to handle HDMI renegotiation, etc.
Hardware tests: Add test_blackmagic_intensitypro
Rename tests/{hardware-test => hardware}

For consistency with tests/ocr
Move all utility functions from tests/{run-tests.sh => utils.sh}

This keeps all the utility functions used by the self-tests in a single
place.
tests/run-tests.sh: Test suites passed on command line must be relative to caller

...not relative to `run-tests.sh`. This will allow me to move the
hardware-specific test suite into tests/hardware/ in a future commit (so
that it doesn't get run by default).

This changes the command-line API of run-tests.sh but that is a change
that only affects developers, not users, of stb-tester.
Run hardware tests with `make check-hardware`

Instead of `STBT_ENABLE_HARDWARE_TESTS make check-integrationtests`. I
feel that a separate `make` target is better documentation than having
to read the source code of test-hardware.sh. Also, this allows us to run
the hardware tests separately (for example only after the non-hardware
tests have passed).

To exclude the test cases in `tests/test-hardware.sh` from `make
check-integrationtests` I had to move `test-hardware.sh` out of
`tests/`, into `tests/hardware`.

One consequence of this change is that `tests/test-install` (the
temporary installation used to run the tests) isn't removed after `make
check` completes. It's already in `.gitignore`.