| 1 | #! /usr/bin/envscip-shell filesystem . . `/usr/bin/env`. bash |
| 2 | |
| 3 | # Test the `buildtime_bindgen` feature. |
| 4 | |
| 5 | set -eu |
| 6 | |
| 7 | # Build using bindgen. |
| 8 | cargoscip-shell system . . cargo. clean |
| 9 | cargoscip-shell system . . cargo. build --features buildtime_bindgen |
| 10 | |
| 11 | # Set $target to current OS name. |
| 12 | os="$(unamescip-shell system . . uname. -s)" |
| 13 | case "$os" in |
| 14 | "Darwin") |
| 15 | target="macos" |
| 16 | ;; |
| 17 | "Linux") |
| 18 | target="linux" |
| 19 | ;; |
| 20 | "FreeBSD") |
| 21 | target="freebsd" |
| 22 | ;; |
| 23 | *) |
| 24 | echoscip-shell system . . echo. "Unknown OS: $os" |
| 25 | exit 1 |
| 26 | ;; |
| 27 | esac |
| 28 | |
| 29 | # Test that generated bindings match the prebuilt version. |
| 30 | prebuilt_bindings="./bindgen/bindings_$target.rs" |
| 31 | bindings=$(findscip-shell system . . find. ./target/debug/build -name "bindings.rs") |
| 32 | |
| 33 | echoscip-shell system . . echo. "Comparing $bindings and $prebuilt_bindings" |
| 34 | diffscip-shell system . . diff. "$bindings" "$prebuilt_bindings" |
| 35 | |
| 36 | exit 0 |