Add prefixes to header guards

Certain header guards used defines like __TYPE_H__ which are likely
to be shared by other projects or the standard library. Add a
COCKPIT_ prefix to them.

Closes: #201
Signed-off-by: Marius Vollmer <mvollmer@redhat.com>
configure.ac: We don't need gobject introspection

Remove the build time dependency
Implement TAP for our testing

This way we can integrate test results from multiple sources.

After the tests have run, you'll see a summary of how many tests
were run. Details of the failed tests are available in
$(builddir)/testsuite.log.

Using TAP with automake requires a special test driver. Instead
of using the inflexible one that comes with automake, we define
our own. It's very important to see stderr failures in our
build logs and CI.

Since we can't depend on the TAP support in glib versions later
than 2.38.x this commit also includes a test output compiler
that converts GTest output to TAP.

Fixes #210

Reviewed-by: Patrick Uiterwijk <puiterwijk@redhat.com>
ws: No need to explicitly specify 'user' in dbus-server.c

Reviewed-by: Patrick Uiterwijk <puiterwijk@redhat.com>
ws: Allow using other buses with dbus_server_serve_dbus()

This is for testing.

Reviewed-by: Patrick Uiterwijk <puiterwijk@redhat.com>
ws: Allow running test-server from builddir

First of all allow running test-server as non-privileged. Use
a test dbus bus for test-server. Disable GVFS as well.

Make this work to test from build tree directly. For this
we connect to the session bus, and also copy all the files we
need into $(builddir)

qunit goes into the tools/ subdirectory.

Reviewed-by: Patrick Uiterwijk <puiterwijk@redhat.com>
tools: Update to qunit 1.14.0

This helps with later commits for TAP integration

Reviewed-by: Patrick Uiterwijk <puiterwijk@redhat.com>
web: Remove alert() calls from dbus.js code

These get in the way of testing, and won't be particularly helpful
to users. Filed a bug about replacing with a real browser-compat
page: #212

These will foul up the tests. In particular we need to

Reviewed-by: Patrick Uiterwijk <puiterwijk@redhat.com>
ws: Wait until loaded before having Qunit start testing

Otherwise this results in multiple QUnit.done() callbacks and
interferes with proper TAP testing. You can see this sometimes
when it flickers that the tests have completed, only to run some
more.

Reviewed-by: Patrick Uiterwijk <puiterwijk@redhat.com>
ws: Include 'Connection: close' when serving static files

Fixes #207

Reviewed-by: Patrick Uiterwijk <puiterwijk@redhat.com>
ws: Don't log 'Broken pipe' errors if a client disconnects

Reviewed-by: Patrick Uiterwijk <puiterwijk@redhat.com>
ws: Fix work around json-glib bug #724319

David had a work around here ... rediscovered the issue,
filed the bug, patched json-glib, and fixed the broken workaround.

Needed to clear the error properly.

Fixes #202

eviewed-by: Patrick Uiterwijk <puiterwijk@redhat.com>
ws: Fix use after free in test-server.c extra_objects

Remove objects from the hash table as they're freed.

Fixes #208

Reviewed-by: Patrick Uiterwijk <puiterwijk@redhat.com>
ws: Fix callback signature in test-server.c

The signature didn't match the DBus method call.

Fixes #209

Reviewed-by: Patrick Uiterwijk <puiterwijk@redhat.com>
tools: Add tap-phantom phantom driver tool

This is a phantom driver which outputs TAP for QUnit tests.
It uses the qunit-tap javascript addon for QUnit.

You can run the driver manually like this:

tools/tap-phantom http://localhost:XXX/path-to-test.html

Reviewed-by: Patrick Uiterwijk <puiterwijk@redhat.com>
ws: Add test-server and dbus-test.html to 'make check'

Using work in the previous commits add dbus-test.html tests to
'make check'.

To run the test server in check mode pass the --tap argument
which is similar to the one used by GTest tests.

Obviously this depends on phantomjs in order to work. If it's
not available then the dbus-test.html tests are skipped.

Fixes #211

Reviewed-by: Patrick Uiterwijk <puiterwijk@redhat.com>
Makefile: Remove --disable-introspection from distcheck flags

Reviewed-by: Patrick Uiterwijk <puiterwijk@redhat.com>
doc: Document updated protocol with channels

Before implementing it.
ws: Split out mock dbus service into into its own file

I'd like to use it from other tests
ws: Implement a unit test case for dbus-server.c

We want to start testing dbus-server.c directly, so build straightforward
test case for it that doesn't involve running javascript.