diff options
| author | Jack O'Connor <[email protected]> | 2019-12-11 23:19:34 -0500 |
|---|---|---|
| committer | Jack O'Connor <[email protected]> | 2019-12-11 23:19:58 -0500 |
| commit | 6823655aedb707981d57c2e661a198a5a5302cbd (patch) | |
| tree | 059d0046acfdb00cc4b96753d07861ab0881b54e | |
| parent | c8d21fab957a0a5c9c42b9a8e657c4dec7f87f58 (diff) | |
run the test vectors on cross tests (ARM, MIPS) on CI
| -rw-r--r-- | .github/workflows/ci.yml | 26 | ||||
| -rw-r--r-- | test_vectors/Cargo.toml | 2 | ||||
| -rwxr-xr-x | test_vectors/cross_test.sh | 25 |
3 files changed, 43 insertions, 10 deletions
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 08e6891..f0d491b 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -4,7 +4,7 @@ on: [push] jobs: cargo_tests: - name: Rust ${{ matrix.rust_version }} on ${{ matrix.os }} + name: ${{ matrix.rust_version }} ${{ matrix.os }} runs-on: ${{ matrix.os }} strategy: matrix: @@ -24,16 +24,20 @@ jobs: # More features tests. Note that "c_avx512" participates in dynamic feature # detection, so it'll be built, but it probably won't run. - run: cargo test --features=c_avx512,rayon - # Test vectors. - - run: cargo test - working-directory: ./test_vectors # Test benchmarks. Nightly only. - run: cargo test --benches if: matrix.rust_version == 'nightly' + # Test vectors. + - name: test vectors + run: cargo test + working-directory: ./test_vectors cross_tests: - name: cross tests + name: cross ${{ matrix.arch }} runs-on: ubuntu-latest + strategy: + matrix: + arch: [armv7-unknown-linux-gnueabihf, aarch64-unknown-linux-gnu, mips-unknown-linux-gnu] steps: - uses: actions/checkout@v1 @@ -42,8 +46,10 @@ jobs: toolchain: stable override: true - run: cargo install cross - - run: cross test --target mips-unknown-linux-gnu - - run: cross test --target armv7-unknown-linux-gnueabihf - - run: cross test --target armv7-unknown-linux-gnueabihf --features=c_neon - - run: cross test --target aarch64-unknown-linux-gnu - - run: cross test --target aarch64-unknown-linux-gnu --features=c_neon + # Test the portable implementation on everything. + - run: cross test --target ${{ matrix.arch }} + # Test the NEON implementation on ARM targets. + - run: cross test --target ${{ matrix.arch }} --features=c_neon + if: startsWith(${{ matrix.arch }}, 'armv7-') || startsWith($${ matrix.arch }}, 'aarch64-') + # Test vectors. Note that this uses a hacky script due to path dependency limitations. + - run: ./test_vectors/cross_test.sh --target ${{ matrix.arch }} diff --git a/test_vectors/Cargo.toml b/test_vectors/Cargo.toml index aa4c0e7..47d98f1 100644 --- a/test_vectors/Cargo.toml +++ b/test_vectors/Cargo.toml @@ -4,6 +4,8 @@ version = "0.0.0" edition = "2018" [dependencies] +# If you ever change these path dependencies, you'll probably need to update +# cross_test.sh, or CI will break. I'm sorry >.< blake3 = { path = "../" } hex = "0.4.0" reference_impl = { path = "../reference_impl" } diff --git a/test_vectors/cross_test.sh b/test_vectors/cross_test.sh new file mode 100755 index 0000000..9d00c84 --- /dev/null +++ b/test_vectors/cross_test.sh @@ -0,0 +1,25 @@ +#! /usr/bin/env bash + +# This hacky script works around the fact that `cross test` does not support +# path dependencies. (It uses a docker shared folder to let the guest access +# project files, so parent directories aren't available.) Solve this problem by +# copying the entire project to a temp dir and rearranging paths to put +# "blake3" and "reference_impl" underneath "test_vectors", so that everything +# is accessible. Hopefully this will just run on CI forever and no one will +# ever read this and discover my deep shame. + +set -e -u -o pipefail + +project_root="$(realpath "$(dirname "$BASH_SOURCE")/..")" +tmpdir="$(mktemp -d)" +echo "Running cross tests in $tmpdir" +cd "$tmpdir" +git clone "$project_root" blake3 +mv blake3/test_vectors . +mv blake3/reference_impl test_vectors +mv blake3 test_vectors +cd test_vectors +sed -i 's|blake3 = { path = "../" }|blake3 = { path = "blake3" }|' Cargo.toml +sed -i 's|reference_impl = { path = "../reference_impl" }|reference_impl = { path = "reference_impl" }|' Cargo.toml + +cross test "$@" |
