Runs the benchmarks from bench-cargo-miri in hyperfine. hyperfine needs to be installed.
<benches> can explicitly list the benchmarks to run; by default, all of them are run.
-./miri rustc-pull:
-Pull and merge Miri changes from the rustc repo.
-
-./miri rustc-push <github user> <branch>:
-Push Miri changes back to the rustc repo. This will update the 'master' branch
-in the Rust fork of the given user to upstream. It will also pull a copy of the
-rustc history into the Miri repo, unless you set the RUSTC_GIT env var to an
-existing clone of the rustc repo.
-
-./miri toolchain <commit> <flags>:
-Update and activate the rustup toolchain 'miri'. If no commit is given, updates
-to the commit given in the `rust-version` file. If the commit is `HEAD`, updates
-to the latest upstream rustc commit.
+./miri toolchain <flags>:
+Update and activate the rustup toolchain 'miri' to the commit given in the
+`rust-version` file.
`rustup-toolchain-install-master` must be installed for this to work. Any extra
flags are passed to `rustup-toolchain-install-master`.
+./miri rustc-pull <commit>:
+Pull and merge Miri changes from the rustc repo. Defaults to fetching the latest
+rustc commit. The fetched commit is stored in the `rust-version` file, so the
+next `./miri toolchain` will install the rustc that just got pulled.
+
+./miri rustc-push <github user> <branch>:
+Push Miri changes back to the rustc repo. This will pull a copy of the rustc
+history into the Miri repo, unless you set the RUSTC_GIT env var to an existing
+clone of the rustc repo.
+
ENVIRONMENT VARIABLES
MIRI_SYSROOT:
case "$COMMAND" in
toolchain)
cd "$MIRIDIR"
+ NEW_COMMIT=$(cat rust-version)
# Make sure rustup-toolchain-install-master is installed.
if ! which rustup-toolchain-install-master >/dev/null; then
echo "Please install rustup-toolchain-install-master by running 'cargo install rustup-toolchain-install-master'"
exit 1
fi
- # Determine new commit.
- if [[ "$1" == "" ]]; then
- NEW_COMMIT=$(cat rust-version)
- elif [[ "$1" == "HEAD" ]]; then
- NEW_COMMIT=$(git ls-remote https://github.com/rust-lang/rust/ HEAD | cut -f 1)
- else
- NEW_COMMIT="$1"
- fi
- echo "$NEW_COMMIT" > rust-version
- shift || true # don't fail if shifting fails because no commit was given
# Check if we already are at that commit.
CUR_COMMIT=$(rustc +miri --version -v 2>/dev/null | grep "^commit-hash: " | cut -d " " -f 2)
if [[ "$CUR_COMMIT" == "$NEW_COMMIT" ]]; then
;;
rustc-pull)
cd "$MIRIDIR"
- git fetch http://localhost:8000/rust-lang/rust.git$JOSH_FILTER.git master
+ FETCH_COMMIT="$1"
+ if [ -z "$FETCH_COMMIT" ]; then
+ FETCH_COMMIT=$(git ls-remote https://github.com/rust-lang/rust/ HEAD | cut -f 1)
+ fi
+ # Update rust-version file. As a separate commit, since making it part of
+ # the merge has confused the heck out of josh in the past.
+ echo "$FETCH_COMMIT" > rust-version
+ git commit rust-version -m "Preparing for merge from rustc"
+ # Fetch given rustc commit and note down which one that was
+ git fetch http://localhost:8000/rust-lang/rust.git@$FETCH_COMMIT$JOSH_FILTER.git
git merge FETCH_HEAD --no-ff -m "Merge from rustc"
exit 0
;;
fi
cd "$MIRIDIR"
fi
- # Prepare the branches. For reliable pushing we need to push to a non-existent branch
- # and set `-o base` to a branch that holds current rustc master.
- echo "Preparing $USER/rust..."
- if git fetch https://github.com/$USER/rust $BRANCH &>/dev/null; then
- echo "The branch '$BRANCH' seems to already exist in $USER/rust. Please delete it and try again."
+ # Prepare the branch. Pushing works much better if we use as base exactly
+ # the commit that we pulled from last time, so we use the `rust-version`
+ # file as a good approximation of that.
+ BASE=$(cat "$MIRIDIR/rust-version")
+ echo "Preparing $USER/rust (base: $BASE)..."
+ if git fetch "https://github.com/$USER/rust" "$BRANCH" &>/dev/null; then
+ echo "The branch '$BRANCH' seems to already exist in 'https://github.com/$USER/rust'. Please delete it and try again."
exit 1
fi
- git fetch https://github.com/rust-lang/rust master
- git push https://github.com/$USER/rust FETCH_HEAD:master
+ git fetch https://github.com/rust-lang/rust $BASE
+ git push https://github.com/$USER/rust $BASE:refs/heads/$BRANCH -f
+ echo
# Do the actual push.
cd "$MIRIDIR"
echo "Pushing Miri changes..."
- git push http://localhost:8000/$USER/rust.git$JOSH_FILTER.git HEAD:$BRANCH -o base=master
- exit 0
+ git push http://localhost:8000/$USER/rust.git$JOSH_FILTER.git HEAD:$BRANCH
+ # Do a round-trip check to make sure the push worked as expected.
+ echo
+ git fetch http://localhost:8000/$USER/rust.git@$JOSH_FILTER.git $BRANCH &>/dev/null
+ if [[ $(git rev-parse HEAD) != $(git rev-parse FETCH_HEAD) ]]; then
+ echo "ERROR: Josh created a non-roundtrip push! Do NOT merge this into rustc!"
+ exit 1
+ else
+ echo "Confirmed that the push round-trips back to Miri properly. Please create a rustc PR:"
+ echo " https://github.com/$USER/rust/pull/new/$BRANCH"
+ exit 0
+ fi
;;
many-seeds)
- for SEED in $({ echo obase=16; seq 0 255; } | bc); do
+ for SEED in $(seq 0 255); do
echo "Trying seed: $SEED"
- MIRIFLAGS="$MIRIFLAGS -Zmiri-seed=$SEED" $@ || { echo "Failing seed: $SEED"; break; }
+ MIRIFLAGS="$MIRIFLAGS -Zlayout-seed=$SEED -Zmiri-seed=$SEED" $@ || { echo "Failing seed: $SEED"; break; }
done
exit 0
;;