From ce51accae0b37e0917111c4380c062ac0d7f2f35 Mon Sep 17 00:00:00 2001 From: Alex Huszagh Date: Sun, 26 Jun 2022 22:27:24 -0500 Subject: [PATCH] Add tests for bisect. --- .github/workflows/ci.yml | 14 ++++++++++-- ci/bisect.sh | 48 ++++++++++++++++++++++++++++++++++++++++ ci/remote.sh | 3 ++- 3 files changed, 62 insertions(+), 3 deletions(-) create mode 100755 ci/bisect.sh diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 671756329..f27120c19 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -310,7 +310,7 @@ jobs: # we should always have an artifact from a previous build. remote: - needs: [shellcheck, test, generate-matrix, check] + needs: [shellcheck, test, check] runs-on: ubuntu-latest env: TARGET: aarch64-unknown-linux-gnu @@ -319,8 +319,18 @@ jobs: - uses: ./.github/actions/setup-rust - run: ./ci/remote.sh + bisect: + needs: [shellcheck, test, check] + runs-on: ubuntu-latest + env: + TARGET: aarch64-unknown-linux-gnu + steps: + - uses: actions/checkout@v3 + - uses: ./.github/actions/setup-rust + - run: ./ci/bisect.sh + publish: - needs: [build, check, fmt, clippy, cargo-deny, remote] + needs: [build, check, fmt, clippy, cargo-deny, remote, bisect] runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 diff --git a/ci/bisect.sh b/ci/bisect.sh new file mode 100755 index 000000000..5a41e18e4 --- /dev/null +++ b/ci/bisect.sh @@ -0,0 +1,48 @@ +#!/usr/bin/env bash +# shellcheck disable=SC1091,SC1090 + +# test to see that custom toolchains work + +set -x +set -eo pipefail + +if [[ -z "${TARGET}" ]]; then + export TARGET="aarch64-unknown-linux-gnu" +fi + +source=$(dirname "${BASH_SOURCE[0]}") +. "${source}"/shared.sh + +main() { + local td= + local err= + + retry cargo fetch + cargo install --force --path . + cargo install cargo-bisect-rustc + + td="$(mktemp -d)" + git clone --depth 1 https://github.com/cross-rs/rust-cpp-hello-word "${td}" + + pushd "${td}" + retry cargo fetch + echo '#!/usr/bin/env bash +export CROSS_CUSTOM_TOOLCHAIN=1 +exec cross run --target '"${TARGET}" > bisect.sh + chmod +x bisect.sh + + if ! err=$(cargo bisect-rustc --script=./bisect.sh --target "${TARGET}" 2>&1 >/dev/null); then + if [[ "${err}" != *"does not reproduce the regression"* ]]; then + echo "${err}" + exit 1 + fi + else + echo "should have failed, instead succeeded" 1>&2 + exit 1 + fi + popd + + rm -rf "${td}" +} + +main diff --git a/ci/remote.sh b/ci/remote.sh index f263588f8..1f219c5f8 100755 --- a/ci/remote.sh +++ b/ci/remote.sh @@ -1,6 +1,8 @@ #!/usr/bin/env bash # shellcheck disable=SC1091,SC1090 +# test to see that remote docker support works. + set -x set -eo pipefail @@ -13,7 +15,6 @@ source=$(dirname "${BASH_SOURCE[0]}") . "${source}"/shared.sh main() { - local td= local err= retry cargo fetch