tests: add an headers test
This test checks that the protocol and library headers include only what they are supposed to include. That is, that the core headers do not include the protocol headers and that the core protocol headers do not include the non core library headers. The build process now generates core protocol headers, but they are only used in the test and don't get installed. Reviewed-by: Bryce Harrington <bryce@osg.samsung.com>
This commit is contained in:
parent
12cab2c4df
commit
1fab2e7ba9
19
Makefile.am
19
Makefile.am
|
@ -85,9 +85,16 @@ protocol/%-server-protocol.h : $(top_srcdir)/protocol/%.xml
|
|||
protocol/%-client-protocol.h : $(top_srcdir)/protocol/%.xml
|
||||
$(AM_V_GEN)$(MKDIR_P) $(dir $@) && $(wayland_scanner) client-header < $< > $@
|
||||
|
||||
protocol/%-server-protocol-core.h : $(top_srcdir)/protocol/%.xml
|
||||
$(AM_V_GEN)$(MKDIR_P) $(dir $@) && $(wayland_scanner) server-header -c < $< > $@
|
||||
|
||||
protocol/%-client-protocol-core.h : $(top_srcdir)/protocol/%.xml
|
||||
$(AM_V_GEN)$(MKDIR_P) $(dir $@) && $(wayland_scanner) client-header -c < $< > $@
|
||||
|
||||
BUILT_SOURCES = \
|
||||
$(nodist_libwayland_server_la_SOURCES) \
|
||||
$(nodist_libwayland_client_la_SOURCES)
|
||||
$(nodist_libwayland_client_la_SOURCES) \
|
||||
$(nodist_headers_test_SOURCES)
|
||||
|
||||
CLEANFILES = $(BUILT_SOURCES)
|
||||
DISTCLEANFILES = src/wayland-version.h
|
||||
|
@ -132,7 +139,8 @@ TESTS = \
|
|||
queue-test \
|
||||
signal-test \
|
||||
resources-test \
|
||||
message-test
|
||||
message-test \
|
||||
headers-test
|
||||
|
||||
if ENABLE_CPP_TEST
|
||||
TESTS += cpp-compile-test
|
||||
|
@ -188,6 +196,13 @@ resources_test_SOURCES = tests/resources-test.c
|
|||
resources_test_LDADD = libtest-runner.la
|
||||
message_test_SOURCES = tests/message-test.c
|
||||
message_test_LDADD = libtest-runner.la
|
||||
headers_test_SOURCES = tests/headers-test.c \
|
||||
tests/headers-protocol-test.c \
|
||||
tests/headers-protocol-core-test.c
|
||||
headers_test_LDADD = libtest-runner.la
|
||||
nodist_headers_test_SOURCES = \
|
||||
protocol/wayland-server-protocol-core.h \
|
||||
protocol/wayland-client-protocol-core.h
|
||||
|
||||
if ENABLE_CPP_TEST
|
||||
cpp_compile_test_SOURCES = tests/cpp-compile-test.cpp
|
||||
|
|
31
tests/headers-protocol-core-test.c
Normal file
31
tests/headers-protocol-core-test.c
Normal file
|
@ -0,0 +1,31 @@
|
|||
/*
|
||||
* Copyright © 2015 Giulio Camuffo
|
||||
*
|
||||
* Permission to use, copy, modify, distribute, and sell this software and its
|
||||
* documentation for any purpose is hereby granted without fee, provided that
|
||||
* the above copyright notice appear in all copies and that both that copyright
|
||||
* notice and this permission notice appear in supporting documentation, and
|
||||
* that the name of the copyright holders not be used in advertising or
|
||||
* publicity pertaining to distribution of the software without specific,
|
||||
* written prior permission. The copyright holders make no representations
|
||||
* about the suitability of this software for any purpose. It is provided "as
|
||||
* is" without express or implied warranty.
|
||||
*
|
||||
* THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
|
||||
* INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
|
||||
* EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY SPECIAL, INDIRECT OR
|
||||
* CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
|
||||
* DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
|
||||
* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
|
||||
* OF THIS SOFTWARE.
|
||||
*/
|
||||
|
||||
#include "wayland-client-protocol-core.h"
|
||||
#include "wayland-server-protocol-core.h"
|
||||
|
||||
#ifdef WAYLAND_CLIENT_H
|
||||
#error including wayland-client-protocol-core.h included wayland-client.h!
|
||||
#endif
|
||||
#ifdef WAYLAND_SERVER_H
|
||||
#error including wayland-server-protocol-core.h included wayland-server.h!
|
||||
#endif
|
31
tests/headers-protocol-test.c
Normal file
31
tests/headers-protocol-test.c
Normal file
|
@ -0,0 +1,31 @@
|
|||
/*
|
||||
* Copyright © 2015 Giulio Camuffo
|
||||
*
|
||||
* Permission to use, copy, modify, distribute, and sell this software and its
|
||||
* documentation for any purpose is hereby granted without fee, provided that
|
||||
* the above copyright notice appear in all copies and that both that copyright
|
||||
* notice and this permission notice appear in supporting documentation, and
|
||||
* that the name of the copyright holders not be used in advertising or
|
||||
* publicity pertaining to distribution of the software without specific,
|
||||
* written prior permission. The copyright holders make no representations
|
||||
* about the suitability of this software for any purpose. It is provided "as
|
||||
* is" without express or implied warranty.
|
||||
*
|
||||
* THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
|
||||
* INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
|
||||
* EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY SPECIAL, INDIRECT OR
|
||||
* CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
|
||||
* DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
|
||||
* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
|
||||
* OF THIS SOFTWARE.
|
||||
*/
|
||||
|
||||
#include "wayland-client-protocol.h"
|
||||
#include "wayland-server-protocol.h"
|
||||
|
||||
#ifndef WAYLAND_CLIENT_H
|
||||
#error including wayland-client-protocol.h did not include wayland-client.h!
|
||||
#endif
|
||||
#ifndef WAYLAND_SERVER_H
|
||||
#error including wayland-server-protocol.h did not include wayland-server.h!
|
||||
#endif
|
50
tests/headers-test.c
Normal file
50
tests/headers-test.c
Normal file
|
@ -0,0 +1,50 @@
|
|||
/*
|
||||
* Copyright © 2015 Giulio Camuffo
|
||||
*
|
||||
* Permission to use, copy, modify, distribute, and sell this software and its
|
||||
* documentation for any purpose is hereby granted without fee, provided that
|
||||
* the above copyright notice appear in all copies and that both that copyright
|
||||
* notice and this permission notice appear in supporting documentation, and
|
||||
* that the name of the copyright holders not be used in advertising or
|
||||
* publicity pertaining to distribution of the software without specific,
|
||||
* written prior permission. The copyright holders make no representations
|
||||
* about the suitability of this software for any purpose. It is provided "as
|
||||
* is" without express or implied warranty.
|
||||
*
|
||||
* THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
|
||||
* INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
|
||||
* EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY SPECIAL, INDIRECT OR
|
||||
* CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
|
||||
* DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
|
||||
* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
|
||||
* OF THIS SOFTWARE.
|
||||
*/
|
||||
|
||||
#include "wayland-client-core.h"
|
||||
#include "wayland-server-core.h"
|
||||
|
||||
#ifdef WL_DISPLAY_SYNC
|
||||
#error including wayland-client-core.h imported protocol symbols!
|
||||
#endif
|
||||
#ifdef WL_DISPLAY_ERROR
|
||||
#error including wayland-server-core.h imported protocol symbols!
|
||||
#endif
|
||||
|
||||
#ifdef WAYLAND_CLIENT_H
|
||||
#error including wayland-client-core.h included the non-core header!
|
||||
#endif
|
||||
#ifdef WAYLAND_SERVER_H
|
||||
#error including wayland-server-core.h included the non-core header!
|
||||
#endif
|
||||
|
||||
#include "wayland-client.h"
|
||||
#include "wayland-server.h"
|
||||
|
||||
#ifndef WL_DISPLAY_SYNC
|
||||
#error including wayland-client.h did not import protocol symbols!
|
||||
#endif
|
||||
#ifndef WL_DISPLAY_ERROR
|
||||
#error including wayland-server.h did not import protocol symbols!
|
||||
#endif
|
||||
|
||||
int main(int argc, char **argv) { return 0; }
|
Loading…
Reference in New Issue
Block a user