teach ./miri how to do Josh syncs
This commit is contained in:
parent
a0fbf0d077
commit
4f3a9881da
2 changed files with 91 additions and 46 deletions
|
|
@ -290,14 +290,12 @@ cargo run --release -p josh-proxy -- --local=$(pwd)/local --remote=https://githu
|
|||
|
||||
### Importing changes from the rustc repo
|
||||
|
||||
Josh needs to be running, as described above.
|
||||
We assume we start on an up-to-date master branch in the Miri repo.
|
||||
|
||||
```sh
|
||||
# Fetch rustc side of the history. Takes ca 5 min the first time.
|
||||
# Do NOT change that commit ID, it needs to be exactly this!
|
||||
git fetch http://localhost:8000/rust-lang/rust.git:at_commit=75dd959a3a40eb5b4574f8d2e23aa6efbeb33573[:prefix=src/tools/miri]:/src/tools/miri.git master
|
||||
# Include that history into ours.
|
||||
git merge FETCH_HEAD -m "merge rustc history"
|
||||
# Fetch and merge rustc side of the history. Takes ca 5 min the first time.
|
||||
./miri rustc-pull
|
||||
# Update toolchain reference and apply formatting.
|
||||
./rustup-toolchain HEAD && ./miri fmt
|
||||
git commit -am "rustup"
|
||||
|
|
@ -310,16 +308,15 @@ needed.
|
|||
|
||||
### Exporting changes to the rustc repo
|
||||
|
||||
We will use the josh proxy to push to your fork of rustc. You need to make sure
|
||||
that the master branch of your fork is up-to-date. Also make sure that there
|
||||
exists no branch called `miri` in your fork. Then run the following in the Miri
|
||||
repo, assuming we are on an up-to-date master branch:
|
||||
Josh needs to be running, as described above. We will use the josh proxy to push
|
||||
to your fork of rustc. Run the following in the Miri repo, assuming we are on an
|
||||
up-to-date master branch:
|
||||
|
||||
```sh
|
||||
# Push the Miri changes to your rustc fork (substitute your github handle for YOUR_NAME).
|
||||
# Do NOT change that commit ID, it needs to be exactly this!
|
||||
git push http://localhost:8000/YOUR_NAME/rust.git:at_commit=75dd959a3a40eb5b4574f8d2e23aa6efbeb33573[:prefix=src/tools/miri]:/src/tools/miri.git -o base=master HEAD:miri
|
||||
./miri rustc-push YOUR_NAME miri
|
||||
```
|
||||
|
||||
This will create a new branch in your fork, and the output should include a link
|
||||
to create a rustc PR that will integrate those changes into the main repository.
|
||||
This will create a new branch called 'miri' in your fork, and the output should
|
||||
include a link to create a rustc PR that will integrate those changes into the
|
||||
main repository.
|
||||
|
|
|
|||
|
|
@ -42,6 +42,15 @@ many different seeds.
|
|||
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.
|
||||
|
||||
ENVIRONMENT VARIABLES
|
||||
|
||||
MIRI_SYSROOT:
|
||||
|
|
@ -52,37 +61,60 @@ Pass extra flags to all cargo invocations. (Ignored by `./miri cargo`.)
|
|||
EOF
|
||||
)
|
||||
|
||||
## We need to know where we are.
|
||||
## We need to know which command to run and some global constants.
|
||||
COMMAND="$1"
|
||||
if [ -z "$COMMAND" ]; then
|
||||
echo "$USAGE"
|
||||
exit 1
|
||||
fi
|
||||
shift
|
||||
# macOS does not have a useful readlink/realpath so we have to use Python instead...
|
||||
MIRIDIR=$(python3 -c 'import os, sys; print(os.path.dirname(os.path.realpath(sys.argv[1])))' "$0")
|
||||
# Used for rustc syncs.
|
||||
JOSH_FILTER=":at_commit=75dd959a3a40eb5b4574f8d2e23aa6efbeb33573[:prefix=src/tools/miri]:/src/tools/miri"
|
||||
|
||||
## Run the auto-things.
|
||||
if [ -z "$MIRI_AUTO_OPS" ]; then
|
||||
export MIRI_AUTO_OPS=42
|
||||
|
||||
# Run this first, so that the toolchain doesn't change after
|
||||
# other code has run.
|
||||
if [ -f "$MIRIDIR/.auto-everything" ] || [ -f "$MIRIDIR/.auto-toolchain" ] ; then
|
||||
(cd "$MIRIDIR" && ./rustup-toolchain)
|
||||
fi
|
||||
|
||||
if [ -f "$MIRIDIR/.auto-everything" ] || [ -f "$MIRIDIR/.auto-fmt" ] ; then
|
||||
$0 fmt
|
||||
fi
|
||||
|
||||
if [ -f "$MIRIDIR/.auto-everything" ] || [ -f "$MIRIDIR/.auto-clippy" ] ; then
|
||||
$0 clippy -- -D warnings
|
||||
fi
|
||||
fi
|
||||
|
||||
## Determine command and toolchain.
|
||||
COMMAND="$1"
|
||||
[ $# -gt 0 ] && shift
|
||||
# Doing this *after* auto-toolchain logic above, since that might change the toolchain.
|
||||
TOOLCHAIN=$(cd "$MIRIDIR"; rustup show active-toolchain | head -n 1 | cut -d ' ' -f 1)
|
||||
|
||||
## Handle some commands early, since they should *not* alter the environment.
|
||||
## Early commands, that don't do auto-things and don't want the environment-altering things happening below.
|
||||
case "$COMMAND" in
|
||||
rustc-pull)
|
||||
cd "$MIRIDIR"
|
||||
git fetch http://localhost:8000/rust-lang/rust.git$JOSH_FILTER.git master
|
||||
git merge FETCH_HEAD
|
||||
exit 0
|
||||
;;
|
||||
rustc-push)
|
||||
USER="$1"
|
||||
BRANCH="$2"
|
||||
if [ -z "$USER" ] || [ -z "$BRANCH" ]; then
|
||||
echo "Usage: $0 rustc-push <github user> <branch>"
|
||||
exit 1
|
||||
fi
|
||||
if [ -n "$RUSTC_GIT" ]; then
|
||||
# Use an existing fork for the branch updates.
|
||||
cd "$RUSTC_GIT"
|
||||
else
|
||||
# Do this in the local Miri repo.
|
||||
echo "This will pull a copy of the rust-lang/rust history into this Miri checkout, growing it by about 1GB."
|
||||
read -r -p "To avoid that, abort now and set the RUSTC_GIT environment variable to an existing rustc checkout. Proceed? [y/N] "
|
||||
if [[ ! $REPLY =~ ^[Yy]$ ]]; then
|
||||
exit 1
|
||||
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' seems to already exist in $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
|
||||
# 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
|
||||
;;
|
||||
many-seeds)
|
||||
for SEED in $({ echo obase=16; seq 0 255; } | bc); do
|
||||
echo "Trying seed: $SEED"
|
||||
|
|
@ -106,9 +138,28 @@ bench)
|
|||
;;
|
||||
esac
|
||||
|
||||
## Run the auto-things.
|
||||
if [ -z "$MIRI_AUTO_OPS" ]; then
|
||||
export MIRI_AUTO_OPS=42
|
||||
|
||||
# Run this first, so that the toolchain doesn't change after
|
||||
# other code has run.
|
||||
if [ -f "$MIRIDIR/.auto-everything" ] || [ -f "$MIRIDIR/.auto-toolchain" ] ; then
|
||||
(cd "$MIRIDIR" && ./rustup-toolchain)
|
||||
fi
|
||||
|
||||
if [ -f "$MIRIDIR/.auto-everything" ] || [ -f "$MIRIDIR/.auto-fmt" ] ; then
|
||||
$0 fmt
|
||||
fi
|
||||
|
||||
if [ -f "$MIRIDIR/.auto-everything" ] || [ -f "$MIRIDIR/.auto-clippy" ] ; then
|
||||
$0 clippy -- -D warnings
|
||||
fi
|
||||
fi
|
||||
|
||||
## Prepare the environment
|
||||
# Determine some toolchain properties
|
||||
# export the target so its available in miri
|
||||
TOOLCHAIN=$(cd "$MIRIDIR"; rustup show active-toolchain | head -n 1 | cut -d ' ' -f 1)
|
||||
TARGET=$(rustc +$TOOLCHAIN --version --verbose | grep "^host:" | cut -d ' ' -f 2)
|
||||
SYSROOT=$(rustc +$TOOLCHAIN --print sysroot)
|
||||
LIBDIR=$SYSROOT/lib/rustlib/$TARGET/lib
|
||||
|
|
@ -227,10 +278,7 @@ cargo)
|
|||
$CARGO "$@"
|
||||
;;
|
||||
*)
|
||||
if [ -n "$COMMAND" ]; then
|
||||
echo "Unknown command: $COMMAND"
|
||||
echo
|
||||
fi
|
||||
echo "$USAGE"
|
||||
echo "Unknown command: $COMMAND"
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue