diff mbox

[RFC] fixup! tests: New make target check-source

Message ID 1467268211-11451-1-git-send-email-armbru@redhat.com
State New
Headers show

Commit Message

Markus Armbruster June 30, 2016, 6:30 a.m. UTC
---
 tests/header-test-template.c | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)
 create mode 100644 tests/header-test-template.c

Comments

Sascha Silbe June 30, 2016, 10:58 a.m. UTC | #1
Dear Markus,

Markus Armbruster <armbru@redhat.com> writes:

> ---
>  tests/header-test-template.c | 16 ++++++++++++++++
[...]

Thanks, that helped, I get a bit further now.

Is "make header-check" supposed to work on a host that doesn't have all
optional dependencies installed? It fails for me because some OpenGL
related header is missing. configure correctly detected that and didn't
enable OpenGL support:

$ make check-headers
  CC    tests/headers/include/ui/shader.o
In file included from tests/headers/include/ui/shader.c:14:0:
./include/ui/shader.h:6:22: fatal error: epoxy/gl.h: No such file or directory
 #include <epoxy/gl.h>
                      ^
compilation terminated.
make: *** [tests/headers/include/ui/shader.o] Error 1
rm tests/headers/include/ui/shader.c
$ grep OPENGL config-host.*


Sascha
Markus Armbruster June 30, 2016, 12:14 p.m. UTC | #2
Sascha Silbe <silbe@linux.vnet.ibm.com> writes:

> Dear Markus,
>
> Markus Armbruster <armbru@redhat.com> writes:
>
>> ---
>>  tests/header-test-template.c | 16 ++++++++++++++++
> [...]
>
> Thanks, that helped, I get a bit further now.
>
> Is "make header-check" supposed to work on a host that doesn't have all
> optional dependencies installed? It fails for me because some OpenGL
> related header is missing. configure correctly detected that and didn't
> enable OpenGL support:
>
> $ make check-headers
>   CC    tests/headers/include/ui/shader.o
> In file included from tests/headers/include/ui/shader.c:14:0:
> ./include/ui/shader.h:6:22: fatal error: epoxy/gl.h: No such file or directory
>  #include <epoxy/gl.h>
>                       ^
> compilation terminated.
> make: *** [tests/headers/include/ui/shader.o] Error 1
> rm tests/headers/include/ui/shader.c
> $ grep OPENGL config-host.*

Hmm, this demonstrates some of our headers may only be included when
certain CONFIG_* are defined.

Actually, I ran into a related case myself: headers that don't compile
with CONFIG_WIN32.

We can either add suitable ifdeffery to make our headers work always, or
mark headers so the test skips them when their requirements aren't met,
similarly to how this patch skips certain headers when CONFIG_WIN32 is
defined.

Regardless, we need to find the problemtatic headers.  Perhaps you can
find a few more with "make -k check-source".

Thanks!
Markus Armbruster July 1, 2016, 1:52 p.m. UTC | #3
Markus Armbruster <armbru@redhat.com> writes:

> Sascha Silbe <silbe@linux.vnet.ibm.com> writes:
>
>> Dear Markus,
>>
>> Markus Armbruster <armbru@redhat.com> writes:
>>
>>> ---
>>>  tests/header-test-template.c | 16 ++++++++++++++++
>> [...]
>>
>> Thanks, that helped, I get a bit further now.
>>
>> Is "make header-check" supposed to work on a host that doesn't have all
>> optional dependencies installed? It fails for me because some OpenGL
>> related header is missing. configure correctly detected that and didn't
>> enable OpenGL support:
>>
>> $ make check-headers
>>   CC    tests/headers/include/ui/shader.o
>> In file included from tests/headers/include/ui/shader.c:14:0:
>> ./include/ui/shader.h:6:22: fatal error: epoxy/gl.h: No such file or directory
>>  #include <epoxy/gl.h>
>>                       ^
>> compilation terminated.
>> make: *** [tests/headers/include/ui/shader.o] Error 1
>> rm tests/headers/include/ui/shader.c
>> $ grep OPENGL config-host.*
>
> Hmm, this demonstrates some of our headers may only be included when
> certain CONFIG_* are defined.
>
> Actually, I ran into a related case myself: headers that don't compile
> with CONFIG_WIN32.
>
> We can either add suitable ifdeffery to make our headers work always, or
> mark headers so the test skips them when their requirements aren't met,
> similarly to how this patch skips certain headers when CONFIG_WIN32 is
> defined.
>
> Regardless, we need to find the problemtatic headers.  Perhaps you can
> find a few more with "make -k check-source".

I think I tracked them down.  Not too bad, just a dozen or so.  Now I
have to make up my mind whether I prefer to document their configuration
requirements with comments or with ifdefs.
Sascha Silbe July 4, 2016, 11:16 a.m. UTC | #4
Dear Markus,

Markus Armbruster <armbru@redhat.com> writes:

> Markus Armbruster <armbru@redhat.com> writes:
>
>> Hmm, this demonstrates some of our headers may only be included when
>> certain CONFIG_* are defined.
[...]
>> Regardless, we need to find the problemtatic headers.  Perhaps you can
>> find a few more with "make -k check-source".
>
> I think I tracked them down.  Not too bad, just a dozen or so.  Now I
> have to make up my mind whether I prefer to document their configuration
> requirements with comments or with ifdefs.

FWIW, I'd prefer a solution that allows successfully running "make
check-source" even on hosts where not all optional dependencies are
installed. It would be useful as a sanity check before sending
patches. If "make check-source" doesn't work on the developers primary
machine because they cannot install all the latest experimental
dependencies, fewer submitters will use it.

Sascha
Markus Armbruster July 6, 2016, 1:46 p.m. UTC | #5
Sascha Silbe <silbe@linux.vnet.ibm.com> writes:

> Dear Markus,
>
> Markus Armbruster <armbru@redhat.com> writes:
>
>> Markus Armbruster <armbru@redhat.com> writes:
>>
>>> Hmm, this demonstrates some of our headers may only be included when
>>> certain CONFIG_* are defined.
> [...]
>>> Regardless, we need to find the problemtatic headers.  Perhaps you can
>>> find a few more with "make -k check-source".
>>
>> I think I tracked them down.  Not too bad, just a dozen or so.  Now I
>> have to make up my mind whether I prefer to document their configuration
>> requirements with comments or with ifdefs.
>
> FWIW, I'd prefer a solution that allows successfully running "make
> check-source" even on hosts where not all optional dependencies are
> installed. It would be useful as a sanity check before sending
> patches. If "make check-source" doesn't work on the developers primary
> machine because they cannot install all the latest experimental
> dependencies, fewer submitters will use it.

Agree.
diff mbox

Patch

diff --git a/tests/header-test-template.c b/tests/header-test-template.c
new file mode 100644
index 0000000..b6f86f4
--- /dev/null
+++ b/tests/header-test-template.c
@@ -0,0 +1,16 @@ 
+/*
+ * Template for make check-headers
+ *
+ * Copyright (C) 2016 Red Hat, Inc.
+ *
+ * Authors:
+ *  Markus Armbruster <armbru@redhat.com>
+ *
+ * This work is licensed under the terms of the GNU GPL, version 2 or
+ * later.  See the COPYING file in the top-level directory.
+ */
+
+#include "qemu/osdep.h"
+#include "@header@"
+/* Include a second time to catch missing header guard */
+#include "@header@"