forked from rust-lang/rust-bindgen
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
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.
- Loading branch information
Showing
2 changed files
with
26 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters