diff options
author | Nick Fitzgerald <fitzgen@gmail.com> | 2017-07-06 10:03:08 -0700 |
---|---|---|
committer | Nick Fitzgerald <fitzgen@gmail.com> | 2017-07-06 10:03:08 -0700 |
commit | 945c66a764e635c0d3f2bb02412919d696b0e54f (patch) | |
tree | b2985f26a16f7082baf94068a8e5544e61493d1e | |
parent | 78e7546d3be61a7cb7272c7365564300481798ae (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-x | ci/no-includes.sh | 23 | ||||
-rwxr-xr-x | ci/test.sh | 3 |
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 @@ -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. |