| 1 | #!/usr/bin/env bash |
| 2 | |
| 3 | set -ex |
| 4 | |
| 5 | ################################################################################ |
| 6 | # Tests for calibra/curve25519-dalek |
| 7 | ################################################################################ |
| 8 | git clone https://github.com/dalek-cryptography/curve25519-dalek curve25519-dalek || exit $? |
| 9 | |
| 10 | pushd curve25519-dalek >/dev/null || exit $? |
| 11 | |
| 12 | if grep -q "^\[patch\.crates-io\]" Cargo.toml; then |
| 13 | # Add to existing [patch.crates-io] section |
| 14 | sed -i '/^\[patch\.crates-io\]/a fiat-crypto = { path = "../fiat-rust" }' Cargo.toml |
| 15 | else |
| 16 | # Create new [patch.crates-io] section |
| 17 | cat >> Cargo.toml <<EOF |
| 18 | |
| 19 | [patch.crates-io] |
| 20 | fiat-crypto = { path = "../fiat-rust" } |
| 21 | EOF |
| 22 | fi |
| 23 | |
| 24 | RUSTFLAGS='--cfg curve25519_dalek_backend="fiat" --cfg curve25519_dalek_bits="64"' cargo test || exit $? |
| 25 | RUSTFLAGS='--cfg curve25519_dalek_backend="fiat" --cfg curve25519_dalek_bits="32"' cargo test || exit $? |
| 26 | |
| 27 | popd >/dev/null |