summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNick Fitzgerald <fitzgen@gmail.com>2017-07-06 10:03:08 -0700
committerNick Fitzgerald <fitzgen@gmail.com>2017-07-06 10:03:08 -0700
commit945c66a764e635c0d3f2bb02412919d696b0e54f (patch)
treeb2985f26a16f7082baf94068a8e5544e61493d1e
parent78e7546d3be61a7cb7272c7365564300481798ae (diff)
Disallow system header file includes in our test suite
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.
-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.