Commit 786d1439207b689fb0219ab38f535891ec90dbf1

Guillem Jover 2012-03-24T20:37:55

test: Add new overlay unit test

diff --git a/test/.gitignore b/test/.gitignore
index 4237ec7..ecfa218 100644
--- a/test/.gitignore
+++ b/test/.gitignore
@@ -1 +1,2 @@
 headers
+overlay
diff --git a/test/Makefile.am b/test/Makefile.am
index 30749c2..03ecb58 100644
--- a/test/Makefile.am
+++ b/test/Makefile.am
@@ -12,6 +12,7 @@ AM_CPPFLAGS = \
 
 check_PROGRAMS = \
 	headers \
+	overlay \
 	$(nil)
 
 TESTS = $(check_PROGRAMS)
diff --git a/test/overlay.c b/test/overlay.c
new file mode 100644
index 0000000..f748f1b
--- /dev/null
+++ b/test/overlay.c
@@ -0,0 +1,23 @@
+/* Include system headers that are “known” to pull bits selectively from
+ * other headers through magic macros, to check that the overlay is working
+ * properly. */
+#include <errno.h>
+#include <grp.h>
+#include <stdint.h>
+
+/* Include libbsd overlayed headers that might get partially included. */
+#include <sys/cdefs.h>
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+
+int
+main()
+{
+	/* Test that we do not get partial definitions. */
+	fflush(stdout);
+
+	return 0;
+}