[Cogl] [PATCH 1/5] Don't include cogl/cogl.h from test-utils.h

Robert Bragg robert at sixbynine.org
Wed Jul 3 05:52:24 PDT 2013


This looks good to land to me:

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

thanks,
- Robert

On Wed, Jul 3, 2013 at 12:11 PM, Neil Roberts <neil at linux.intel.com> wrote:
> 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.
> ---
>  test-fixtures/test-utils.c        | 1 -
>  test-fixtures/test-utils.h        | 5 ++++-
>  tests/conform/test-no-gl-header.c | 6 ++----
>  tests/unit/test-unit-main.c       | 1 +
>  4 files changed, 7 insertions(+), 6 deletions(-)
>
> diff --git a/test-fixtures/test-utils.c b/test-fixtures/test-utils.c
> index 6c4291f..dc911ba 100644
> --- a/test-fixtures/test-utils.c
> +++ b/test-fixtures/test-utils.c
> @@ -1,6 +1,5 @@
>  #include <config.h>
>
> -#include <cogl/cogl.h>
>  #include <stdlib.h>
>
>  #include "test-unit.h"
> diff --git a/test-fixtures/test-utils.h b/test-fixtures/test-utils.h
> index f7cb748..0c58820 100644
> --- a/test-fixtures/test-utils.h
> +++ b/test-fixtures/test-utils.h
> @@ -1,7 +1,10 @@
>  #ifndef _TEST_UTILS_H_
>  #define _TEST_UTILS_H_
>
> -#include <cogl/cogl.h>
> +#include <cogl/cogl-context.h>
> +#include <cogl/cogl-onscreen.h>
> +#include <cogl/cogl-offscreen.h>
> +#include <cogl/cogl-texture-2d.h>
>  #include <glib.h>
>
>  /* We don't really care about functions that are defined without a
> diff --git a/tests/conform/test-no-gl-header.c b/tests/conform/test-no-gl-header.c
> index 0628576..9618d84 100644
> --- a/tests/conform/test-no-gl-header.c
> +++ b/tests/conform/test-no-gl-header.c
> @@ -1,18 +1,16 @@
>  #undef COGL_COMPILATION
>  #include <cogl/cogl.h>
>
> -#include "test-utils.h"
> -
>  /* If you just include cogl/cogl.h, you shouldn't end up including any
>     GL headers */
>  #ifdef GL_TRUE
>  #error "Including cogl.h shouldn't be including any GL headers"
>  #endif
>
> +void test_no_gl_header (void);
> +
>  void
>  test_no_gl_header (void)
>  {
> -  if (cogl_test_verbose ())
> -    g_print ("OK\n");
>  }
>
> diff --git a/tests/unit/test-unit-main.c b/tests/unit/test-unit-main.c
> index 92dcec7..b1f7864 100644
> --- a/tests/unit/test-unit-main.c
> +++ b/tests/unit/test-unit-main.c
> @@ -3,6 +3,7 @@
>  #include <gmodule.h>
>
>  #include <test-fixtures/test-unit.h>
> +#include <stdlib.h>
>
>  int
>  main (int argc, char **argv)
> --
> 1.7.11.3.g3c3efa5
>
> _______________________________________________
> Cogl mailing list
> Cogl at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/cogl


More information about the Cogl mailing list