Commit Graph

4 Commits

Author SHA1 Message Date
Neil Roberts
4d98bdd9e5 Fix building the conformance and unit tests on mingw32
The unit tests were failing to build with mingw32 because the
libtest-fixtures was being included both by libcogl and the
test-conformance and test-unit executables. That meant that the
symbols were defined twice and it wouldn't link.

The rule which depends on test-unit being built needs to be called
test-unit.exe on Windows so this patch fixes it to use the $(EXEEXT)
variable to get the right name.

Reviewed-by: Robert Bragg <robert@linux.intel.com>
(cherry picked from commit 575bac47fee0b425f4fd30761e5819443e6c045f)

Conflicts:
	tests/conform/Makefile.am
	tests/unit/Makefile.am
2013-09-02 18:08:09 +01:00
Neil Roberts
b1542cf9dd Don't include cogl/cogl.h from test-utils.h
There was a circular depedency when building from a fresh git clone
where test-fixtures needs to be built before the cogl directory, but
test-fixtures also indirectly includes cogl-enum-types.h which is only
generated when building the cogl directory. If we change the header to
just include specific cogl headers instead of cogl/cogl.h then we can
break the circular dependency.

This needs a tweak to test-no-gl-header because that first undefines
COGL_COMPILATION before including test-utils.h. However it doesn't
really do any actual work so we can get away without including it.

Reviewed-by: Robert Bragg <robert@linux.intel.com>

(cherry picked from commit adb26bd13a48ed571ef4cae4de005e039b34e361)
2013-07-04 11:50:31 +01:00
Neil Roberts
e6fb1fb433 Use GModule instead of libdl to load unit test symbols
Previously the unit tests were using libdl without directly linking to
it. It looks like this ends up working because one of Cogl's
dependencies ends up pulling adding -ldl via libtool. However in some
configurations it looks like this wasn't happening.

To avoid this problem we can just use GModule to resolve the symbols.
g_module_open is documented to return a handle to the ‘main program’
when NULL is passed as the filename and looking at the code it seems
that this ends up using RTLD_DEFAULT so it will have the same effect.

The in-tree copy of glib already has the code for gmodule so this
shouldn't cause problems for --disable-glib.

Reviewed-by: Robert Bragg <robert@linux.intel.com>

(cherry picked from commit b14ece116ed3e4b18d59b645e77b3449fac51137)
2013-06-12 15:04:54 +01:00
Robert Bragg
eb7fafe700 tests: Adds our first white-box unit test
This adds a white-box unit test that verifies that GL_BLEND is disabled
when drawing an opaque rectangle, enabled when drawing a transparent
rectangle and then disabled again when drawing a transparent rectangle
but with a blend string that effectively disables blending.

This shares the test utilities and launcher infrastructure we are using
for conformance tests so we get consistent reporting and so unit tests
will be run against a range of different drivers.

This adds a --enable-unit-tests configure option which is enabled by
default but if disabled will make all UNIT_TESTS() into static inline
functions that we should expect the compiler to discard since they won't
be referenced by anything.

Reviewed-by: Neil Roberts <neil@linux.intel.com>

(cherry picked from commit 9047cce06bbf9051ec77e622be2fdbb96ed767a8)
2013-06-06 21:27:16 +01:00