test: Add new overlay unit test
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48
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;
+}