@@ -42,21 +42,21 @@ many different seeds.
42
42
Runs the benchmarks from bench-cargo-miri in hyperfine. hyperfine needs to be installed.
43
43
<benches> can explicitly list the benchmarks to run; by default, all of them are run.
44
44
45
+ ./miri toolchain <flags>:
46
+ Update and activate the rustup toolchain 'miri' to the commit given in the
47
+ `rust-version` file.
48
+ `rustup-toolchain-install-master` must be installed for this to work. Any extra
49
+ flags are passed to `rustup-toolchain-install-master`.
50
+
45
51
./miri rustc-pull:
46
- Pull and merge Miri changes from the rustc repo.
52
+ Pull and merge Miri changes from the rustc repo. The fetched commit is stored in
53
+ the `rust-version` file, so the next `./miri toolchain` will install the rustc
54
+ we just pulled.
47
55
48
56
./miri rustc-push <github user> <branch>:
49
- Push Miri changes back to the rustc repo. This will update the 'master' branch
50
- in the Rust fork of the given user to upstream. It will also pull a copy of the
51
- rustc history into the Miri repo, unless you set the RUSTC_GIT env var to an
52
- existing clone of the rustc repo.
53
-
54
- ./miri toolchain <commit> <flags>:
55
- Update and activate the rustup toolchain 'miri'. If no commit is given, updates
56
- to the commit given in the `rust-version` file. If the commit is `HEAD`, updates
57
- to the latest upstream rustc commit.
58
- `rustup-toolchain-install-master` must be installed for this to work. Any extra
59
- flags are passed to `rustup-toolchain-install-master`.
57
+ Push Miri changes back to the rustc repo. This will pull a copy of the rustc
58
+ history into the Miri repo, unless you set the RUSTC_GIT env var to an existing
59
+ clone of the rustc repo.
60
60
61
61
ENVIRONMENT VARIABLES
62
62
@@ -78,29 +78,20 @@ shift
78
78
# macOS does not have a useful readlink/realpath so we have to use Python instead...
79
79
MIRIDIR=$( python3 -c ' import os, sys; print(os.path.dirname(os.path.realpath(sys.argv[1])))' " $0 " )
80
80
# Used for rustc syncs.
81
- JOSH_FILTER=" :at_commit= 75dd959a3a40eb5b4574f8d2e23aa6efbeb33573[ :prefix=src/tools/miri] :/src/tools/miri"
81
+ JOSH_FILTER=" :rev( 75dd959a3a40eb5b4574f8d2e23aa6efbeb33573:prefix=src/tools/miri) :/src/tools/miri"
82
82
# Needed for `./miri bench`.
83
83
TOOLCHAIN=$( cd " $MIRIDIR " ; rustup show active-toolchain | head -n 1 | cut -d ' ' -f 1)
84
84
85
85
# # Early commands, that don't do auto-things and don't want the environment-altering things happening below.
86
86
case " $COMMAND " in
87
87
toolchain)
88
88
cd " $MIRIDIR "
89
+ NEW_COMMIT=$( cat rust-version)
89
90
# Make sure rustup-toolchain-install-master is installed.
90
91
if ! which rustup-toolchain-install-master > /dev/null; then
91
92
echo " Please install rustup-toolchain-install-master by running 'cargo install rustup-toolchain-install-master'"
92
93
exit 1
93
94
fi
94
- # Determine new commit.
95
- if [[ " $1 " == " " ]]; then
96
- NEW_COMMIT=$( cat rust-version)
97
- elif [[ " $1 " == " HEAD" ]]; then
98
- NEW_COMMIT=$( git ls-remote https://github.com/rust-lang/rust/ HEAD | cut -f 1)
99
- else
100
- NEW_COMMIT=" $1 "
101
- fi
102
- echo " $NEW_COMMIT " > rust-version
103
- shift || true # don't fail if shifting fails because no commit was given
104
95
# Check if we already are at that commit.
105
96
CUR_COMMIT=$( rustc +miri --version -v 2> /dev/null | grep " ^commit-hash: " | cut -d " " -f 2)
106
97
if [[ " $CUR_COMMIT " == " $NEW_COMMIT " ]]; then
@@ -122,8 +113,18 @@ toolchain)
122
113
;;
123
114
rustc-pull)
124
115
cd " $MIRIDIR "
116
+ FETCH_COMMIT=$( git ls-remote https://github.com/rust-lang/rust/ HEAD | cut -f 1)
117
+ # We can't pull from a commit with josh
118
+ # (https://github.com/josh-project/josh/issues/1034), so we just hope that
119
+ # nothing gets merged into rustc *during* this pull.
125
120
git fetch http://localhost:8000/rust-lang/rust.git$JOSH_FILTER .git master
121
+ # Just verify that `master` didn't move.
122
+ if [[ $FETCH_COMMIT != $( git ls-remote https://github.com/rust-lang/rust/ HEAD | cut -f 1) ]]; then
123
+ echo " Looks like something got merged into Rust *while we were pulling*. Aborting. Please try again."
124
+ fi
125
+ echo " $FETCH_COMMIT " > rust-version # do this *before* merging as merging will fail in case of conflicts
126
126
git merge FETCH_HEAD --no-ff -m " Merge from rustc"
127
+ git commit rust-version --amend -m " Merge from rustc"
127
128
exit 0
128
129
;;
129
130
rustc-push)
@@ -145,19 +146,21 @@ rustc-push)
145
146
fi
146
147
cd " $MIRIDIR "
147
148
fi
148
- # Prepare the branches. For reliable pushing we need to push to a non-existent branch
149
- # and set `-o base` to a branch that holds current rustc master.
150
- echo " Preparing $USER /rust..."
151
- if git fetch https://github.com/$USER /rust $BRANCH & > /dev/null; then
152
- echo " The '$BRANCH ' seems to already exist in $USER /rust. Please delete it and try again."
149
+ # Prepare the branch. Pushing works much better if we use as base exactly
150
+ # the commit that we pulled from last time, so we use the `rust-version`
151
+ # file as a good approximation of that.
152
+ BASE=$( cat " $MIRIDIR /rust-version" )
153
+ echo " Preparing $USER /rust (base: $BASE )..."
154
+ if git fetch " https://github.com/$USER /rust" " $BRANCH " & > /dev/null; then
155
+ echo " The branch '$BRANCH ' seems to already exist in 'https://github.com/$USER /rust'. Please delete it and try again."
153
156
exit 1
154
157
fi
155
- git fetch https://github.com/rust-lang/rust master
156
- git push https://github.com/$USER /rust FETCH_HEAD:master
158
+ git fetch https://github.com/rust-lang/rust $BASE
159
+ git push https://github.com/$USER /rust $BASE :refs/heads/ $BRANCH -f
157
160
# Do the actual push.
158
161
cd " $MIRIDIR "
159
162
echo " Pushing Miri changes..."
160
- git push http://localhost:8000/$USER /rust.git$JOSH_FILTER .git HEAD:$BRANCH -o base=master
163
+ git push http://localhost:8000/$USER /rust.git$JOSH_FILTER .git HEAD:$BRANCH
161
164
exit 0
162
165
;;
163
166
many-seeds)
0 commit comments