summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xci/no-includes.sh23
-rwxr-xr-xci/test.sh3
2 files changed, 26 insertions, 0 deletions
diff --git a/ci/no-includes.sh b/ci/no-includes.sh
new file mode 100755
index 00000000..6aa0fc12
--- /dev/null
+++ b/ci/no-includes.sh
@@ -0,0 +1,23 @@
+#!/usr/bin/env bash
+
+# Don't allow any system include directives in tests.
+
+set -eu
+cd "$(dirname "$0")/.."
+
+echo "Checking for #include directives of system headers..."
+
+grep -rn '#include\s*<.*>' tests/headers || {
+ echo "Found none; OK!"
+ exit 0
+}
+
+echo "
+Found a test with an #include directive of a system header file!
+
+There is no guarantee that the system running the tests has the header
+file, let alone the same version of it that you have. Any test with such an
+include directive won't reliably produce the consistent bindings across systems.
+"
+
+exit 1
diff --git a/ci/test.sh b/ci/test.sh
index 011ac737..c35dd20a 100755
--- a/ci/test.sh
+++ b/ci/test.sh
@@ -5,6 +5,9 @@ cd "$(dirname "$0")/.."
export RUST_BACKTRACE=1
+# Disallow system header file includes in our test suite.
+./ci/no-includes.sh
+
# Regenerate the test headers' bindings in debug and release modes, and assert
# that we always get the expected generated bindings.