From 9e15b38133dbce39d340806433ea84f995753717 Mon Sep 17 00:00:00 2001 From: Nick Bowler Date: Sat, 8 Feb 2020 11:03:19 -0500 Subject: [PATCH] Include in test cases. Even the test cases need to include , as they may need definitions from the configure run in order to work correctly. In particular, with old GLib the tests can hit the G_INLINE_FUNC bug which is detected and worked around by configure via . --- tests/general.at | 20 +++++++++++++------- tests/interface.at | 26 ++++++++++++++++++-------- testsuite.at | 6 +++++- 3 files changed, 36 insertions(+), 16 deletions(-) diff --git a/tests/general.at b/tests/general.at index 6643d4d..7b03f4e 100644 --- a/tests/general.at +++ b/tests/general.at @@ -22,7 +22,8 @@ AT_CLEANUP AT_SETUP([str.gob]) AT_DATA([main.c], -[[#include "str.h" +[[#include +#include "str.h" int main(void) { @@ -61,7 +62,7 @@ exec 3<&- AT_CHECK([test x"$total" = x"2"]) TEST_COMPILE_GOBJECT([main.c], [0], [], [stderr]) -AT_CHECK([awk -NF : '$1 == "main.c" && $2 == "15" { exit 42 }' stderr], [42]) +AT_CHECK([awk -NF : '$1 == "main.c" && $2 == "16" { exit 42 }' stderr], [42]) AT_CHECK([$CC $CFLAGS $LDFLAGS $LIBGOBJECT_LIBS -o main str.o main.o]) @@ -71,8 +72,10 @@ dnl Check that dynamic types are accepted and compile OK... AT_SETUP([dynamic types]) AT_KEYWORDS([dynamic]) -AT_DATA([test.gob], -[[class :Test from G:Object (dynamic) +AT_DATA([test.gob], [[%ctop{ +#include +%} +class :Test from G:Object (dynamic) { public void test(void) { @@ -82,7 +85,8 @@ AT_DATA([test.gob], AT_CHECK([gob2 test.gob]) AT_DATA([main.c], -[[#include "test.h" +[[#include +#include "test.h" int main(void) { test_register_type(NULL); @@ -100,8 +104,10 @@ dnl dynamic type after registration. AT_SETUP([dynamic type registration]) AT_KEYWORDS([dynamic runtime]) -AT_DATA([test.gob], -[[%{ +AT_DATA([test.gob], [[%ctop{ +#include +%} +%{ #include %} class :Test from G:Object (dynamic) diff --git a/tests/interface.at b/tests/interface.at index e750bc4..3307c3d 100644 --- a/tests/interface.at +++ b/tests/interface.at @@ -25,7 +25,10 @@ m4_define([TEST_FOOABLE_IMPL_DYN], TEST_TYPE_MODULE([$1])]) m4_define([TEST_FOOABLE_IMPL_], -[AT_DATA([$2.gob], [[%{ +[AT_DATA([$2.gob], [[%ctop{ +#include +%} +%{ #include #include #include "test-fooable.h" @@ -58,7 +61,8 @@ TEST_FOOABLE_IFACE() TEST_FOOABLE_IMPL([Test:A], [G:Object], [return 42;]) AT_DATA([main.c], -[[#include +[[#include +#include #include #include "test-fooable.h" #include "test-a.h" @@ -91,7 +95,8 @@ TEST_FOOABLE_IFACE() TEST_FOOABLE_IMPL_DYN([Test:A], [G:Object], [return 54;]) AT_DATA([main.c], -[[#include +[[#include +#include #include #include "test-fooable.h" #include "test-a.h" @@ -131,7 +136,8 @@ TEST_FOOABLE_IMPL([Test:B], [Test:A], [puts("Test:B foo called"); return 54;]) AT_DATA([main.c], -[[#include +[[#include +#include #include #include "test-fooable.h" #include "test-a.h" @@ -178,7 +184,8 @@ TEST_FOOABLE_IMPL_DYN([Test:B], [Test:A], [puts("Test:B foo called"); return 54;]) AT_DATA([main.c], -[[#include +[[#include +#include #include #include "test-fooable.h" #include "test-a.h" @@ -229,7 +236,8 @@ TEST_FOOABLE_IMPL_DYN([Test:B], [Test:A], [puts("Test:B foo called"); return 54;]) AT_DATA([main.c], -[[#include +[[#include +#include #include #include "test-fooable.h" #include "test-a.h" @@ -282,7 +290,8 @@ TEST_FOOABLE_IMPL([Test:C], [Test:B], [puts("Test:C foo called"); return PARENT_HANDLER(go);]) AT_DATA([main.c], -[[#include +[[#include +#include #include #include "test-fooable.h" #include "test-a.h" @@ -326,7 +335,8 @@ TEST_FOOABLE_IMPL_DYN([Test:C], [Test:B], [puts("Test:C foo called"); return PARENT_HANDLER(go);]) AT_DATA([main.c], -[[#include +[[#include +#include #include #include "test-fooable.h" #include "test-a.h" diff --git a/testsuite.at b/testsuite.at index b28fd93..c87123b 100644 --- a/testsuite.at +++ b/testsuite.at @@ -34,7 +34,10 @@ m4_define([TEST_TYPE_MODULE], m4_define([TEST_TYPE_MODULE_], [AT_KEYWORDS([dynamic])dnl -AT_DATA([$3-mod.gob], [[%{ +AT_DATA([$3-mod.gob], [[%ctop{ +#include +%} +%{ #include "$3.h" %} class $1:Mod from G:Type:Module @@ -54,6 +57,7 @@ AT_COLOR_TESTS AT_TESTED([gob2]) m4_divert_push([PREPARE_TESTS])dnl +CPPFLAGS="-I$builddir $CPPFLAGS" :; { AS_ECHO(["AUTOCONF = ${AUTOCONF=autoconf}"]) command -v $AUTOCONF -- 2.43.0