]> git.draconx.ca Git - gob-dx.git/commitdiff
Include <config.h> in test cases.
authorNick Bowler <nbowler@draconx.ca>
Sat, 8 Feb 2020 16:03:19 +0000 (11:03 -0500)
committerNick Bowler <nbowler@draconx.ca>
Sat, 8 Feb 2020 16:03:19 +0000 (11:03 -0500)
Even the test cases need to include <config.h>, 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 <config.h>.

tests/general.at
tests/interface.at
testsuite.at

index 6643d4d7b5642160b6385b49706eab440a157a7c..7b03f4e4fa7f51dd51227edf8c53d1d3beeda673 100644 (file)
@@ -22,7 +22,8 @@ AT_CLEANUP
 AT_SETUP([str.gob])
 
 AT_DATA([main.c],
-[[#include "str.h"
+[[#include <config.h>
+#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 <config.h>
+%}
+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 <config.h>
+#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 <config.h>
+%}
+%{
 #include <stdio.h>
 %}
 class :Test from G:Object (dynamic)
index e750bc4b5c317d388cf4d40e180812934bd50818..3307c3d2c6400ffa5279b7f33852bded72dd80fa 100644 (file)
@@ -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 <config.h>
+%}
+%{
 #include <stdio.h>
 #include <stdlib.h>
 #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 <stdio.h>
+[[#include <config.h>
+#include <stdio.h>
 #include <stdlib.h>
 #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 <stdio.h>
+[[#include <config.h>
+#include <stdio.h>
 #include <stdlib.h>
 #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 <stdio.h>
+[[#include <config.h>
+#include <stdio.h>
 #include <stdlib.h>
 #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 <stdio.h>
+[[#include <config.h>
+#include <stdio.h>
 #include <stdlib.h>
 #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 <stdio.h>
+[[#include <config.h>
+#include <stdio.h>
 #include <stdlib.h>
 #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 <stdio.h>
+[[#include <config.h>
+#include <stdio.h>
 #include <stdlib.h>
 #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 <stdio.h>
+[[#include <config.h>
+#include <stdio.h>
 #include <stdlib.h>
 #include "test-fooable.h"
 #include "test-a.h"
index b28fd93535c6d8aad3d974c323516df7a02b6312..c87123b9fd61150ccc0cb25f8d78e452e5ccb28e 100644 (file)
@@ -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 <config.h>
+%}
+%{
 #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