summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNick Fitzgerald <fitzgen@gmail.com>2017-04-19 10:50:21 -0700
committerNick Fitzgerald <fitzgen@gmail.com>2017-04-19 11:13:08 -0700
commit6aa647de8d10e781571070eaef34e93feb2622ea (patch)
tree7315b920f331c3e3e2110038f4012c2a45bef37f
parentf775f1f24c743505bd35da09958fcb10300b4069 (diff)
Make the test-one.sh script use the test's bindgen flags
Previously, the test-one.sh script hard coded common bindgen flags to run the specified test with. Now, it parses the `// bindgen-flags:` comment in the test header and uses those flags when running bindgen.
-rwxr-xr-xtests/test-one.sh11
1 files changed, 7 insertions, 4 deletions
diff --git a/tests/test-one.sh b/tests/test-one.sh
index d1950eb9..c7f9b2ae 100755
--- a/tests/test-one.sh
+++ b/tests/test-one.sh
@@ -21,13 +21,16 @@ TEST=$(find ./tests/headers -type f -iname "*$1*" | head -n 1)
BINDINGS=$(mktemp -t bindings_XXXXXX.rs)
TEST_BINDINGS_BINARY=$(mktemp -t bindings.XXXXX)
-./target/debug/bindgen \
- "$TEST" \
+FLAGS="$(grep "// bindgen-flags: " "$TEST")"
+FLAGS="${FLAGS/\/\/ bindgen\-flags:/}"
+
+eval ./target/debug/bindgen \
+ "\"$TEST\"" \
--emit-ir \
--emit-ir-graphviz ir.dot \
--emit-clang-ast \
- -o "$BINDINGS" \
- -- -std=c++14
+ -o "\"$BINDINGS\"" \
+ $FLAGS
dot -Tpng ir.dot -o ir.png