• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1#!/usr/bin/env bash
2
3# Don't allow any system include directives in tests.
4#
5# We make an exception for stdarg.h which is used for
6# the wrapped va_list feature. stdarg.h is available since C89
7# therefor not having this header is a sign of a bigger issue.
8
9set -eu
10cd "$(dirname "$0")/.."
11
12echo "Checking for #include directives of system headers..."
13
14grep -rn '#include\s*<(?!stdarg).*>' bindgen-tests/tests/headers || {
15    echo "Found none; OK!"
16    exit 0
17}
18
19echo "
20Found a test with an #include directive of a system header file!
21
22There is no guarantee that the system running the tests has the header
23file, let alone the same version of it that you have. Any test with such an
24include directive won't reliably produce the consistent bindings across systems.
25"
26
27exit 1
28