Skip to content

Commit

Permalink
Add tests for bisect.
Browse files Browse the repository at this point in the history
  • Loading branch information
Alexhuszagh committed Jun 27, 2022
1 parent 18309a0 commit ce51acc
Show file tree
Hide file tree
Showing 3 changed files with 62 additions and 3 deletions.
14 changes: 12 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down
48 changes: 48 additions & 0 deletions ci/bisect.sh
Original file line number Diff line number Diff line change
@@ -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
3 changes: 2 additions & 1 deletion ci/remote.sh
Original file line number Diff line number Diff line change
@@ -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

Expand All @@ -13,7 +15,6 @@ source=$(dirname "${BASH_SOURCE[0]}")
. "${source}"/shared.sh

main() {
local td=
local err=

retry cargo fetch
Expand Down

0 comments on commit ce51acc

Please sign in to comment.