|
| 1 | +#!/bin/bash |
| 2 | + |
1 | 3 | target=$1 |
| 4 | +testcrate_dir="$(pwd)/testcrate" |
2 | 5 | set -ex |
3 | 6 |
|
4 | 7 | if [ "$1" = "aarch64-apple-darwin" ] ; then |
5 | | - export CARGO_TARGET_AARCH64_APPLE_DARWIN_RUNNER=echo |
| 8 | + export CARGO_TARGET_AARCH64_APPLE_DARWIN_RUNNER=echo |
6 | 9 | fi |
7 | 10 |
|
8 | | -cargo test --manifest-path testcrate/Cargo.toml --target $1 -vv |
9 | | -cargo test --manifest-path testcrate/Cargo.toml --target $1 -vv --release |
| 11 | +cargo test --manifest-path "$testcrate_dir/Cargo.toml" --target $1 -vv |
| 12 | +cargo test --manifest-path "$testcrate_dir/Cargo.toml" --target $1 -vv --release |
| 13 | + |
10 | 14 | if [ "$1" = "x86_64-unknown-linux-gnu" ] ; then |
11 | | - cargo test --manifest-path testcrate/Cargo.toml --target $1 -vv --all-features |
| 15 | + cargo test --manifest-path "$testcrate_dir/Cargo.toml" --target $1 -vv --all-features |
| 16 | + |
| 17 | + # Run a few tests here: |
| 18 | + # |
| 19 | + # * Make sure the packaged crate file isn't bigger than 10MB which is |
| 20 | + # crate.io's limit. |
| 21 | + # * Make sure that the package crate itself works. |
| 22 | + # |
| 23 | + # A lot of OpenSSL's source code is excluded on crates.io because it makes the |
| 24 | + # crate file much too large, so the test here should inform us if we're |
| 25 | + # missing anything actually required to build OpenSSL. |
| 26 | + rm -rf target/ci |
| 27 | + cargo package --allow-dirty --target-dir target/ci |
| 28 | + crate=`ls target/ci/package/*.crate` |
| 29 | + filesize=$(stat -c%s "$crate") |
| 30 | + echo "tarball is $filesize bytes" |
| 31 | + if (( filesize > 10000000 )); then |
| 32 | + echo "file size too big" |
| 33 | + exit 1 |
| 34 | + fi |
| 35 | + rm "$crate" |
| 36 | + cd target/ci/package/openssl-src-* |
| 37 | + cp -r "$testcrate_dir" . |
| 38 | + cargo test --manifest-path "testcrate/Cargo.toml" --target $1 -vv |
12 | 39 | fi |
0 commit comments