diff options
author | Nick Fitzgerald <fitzgen@gmail.com> | 2017-04-19 10:50:21 -0700 |
---|---|---|
committer | Nick Fitzgerald <fitzgen@gmail.com> | 2017-04-19 11:13:08 -0700 |
commit | 6aa647de8d10e781571070eaef34e93feb2622ea (patch) | |
tree | 7315b920f331c3e3e2110038f4012c2a45bef37f | |
parent | f775f1f24c743505bd35da09958fcb10300b4069 (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-x | tests/test-one.sh | 11 |
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 |