diff options
-rwxr-xr-x | tests/test-one.sh | 26 |
1 files changed, 24 insertions, 2 deletions
diff --git a/tests/test-one.sh b/tests/test-one.sh index cbb89eaf..a375a92e 100755 --- a/tests/test-one.sh +++ b/tests/test-one.sh @@ -8,7 +8,7 @@ # `rustc` to compile the bindings with unit tests enabled, and run the generated # layout tests. -set -eux +set -eu cd $(dirname $0) cd .. @@ -21,7 +21,7 @@ TEST=$(find ./tests/headers -type f -iname "*$1*" | head -n 1) BINDINGS=$(mktemp -t bindings.rs.XXXXXX) TEST_BINDINGS_BINARY=$(mktemp -t bindings.XXXXXX) -FLAGS="$(grep "// bindgen-flags: " "$TEST")" +FLAGS="$(grep "// bindgen-flags: " "$TEST" || echo)" FLAGS="${FLAGS/\/\/ bindgen\-flags:/}" eval ./target/debug/bindgen \ @@ -34,14 +34,36 @@ eval ./target/debug/bindgen \ dot -Tpng ir.dot -o ir.png +echo echo "=== Input header ========================================================" +echo + cat "$TEST" +echo echo "=== Generated bindings ==================================================" +echo + cat "$BINDINGS" +echo +echo "=== Diff w/ expected bindings ===========================================" +echo + +EXPECTED=${TEST/headers/expectations\/tests} +EXPECTED=${EXPECTED/.hpp/.rs} + +# Don't exit early if there is a diff. +diff -U8 "$EXPECTED" "$BINDINGS" || true + +echo echo "=== Building bindings ===================================================" +echo + rustc --test -o "$TEST_BINDINGS_BINARY" "$BINDINGS" --crate-name bindgen_test_one +echo echo "=== Testing bindings ====================================================" +echo + "$TEST_BINDINGS_BINARY" |