@@ -23,6 +23,8 @@ SIX_WEEK_CYCLE="$(( ($(date +%s) / 604800 - 3) % 6 ))"
2323
2424touch " $TOOLSTATE_FILE "
2525
26+ # Try to test all the tools and store the build/test success in the TOOLSTATE_FILE
27+
2628set +e
2729python2.7 " $X_PY " test --no-fail-fast \
2830 src/doc/book \
3840cat " $TOOLSTATE_FILE "
3941echo
4042
43+ # This function checks that if a tool's submodule changed, the tool's state must improve
4144verify_status () {
4245 echo " Verifying status of $1 ..."
4346 if echo " $CHANGED_FILES " | grep -q " ^M[[:blank:]]$2 $" ; then
@@ -57,17 +60,36 @@ verify_status() {
5760 fi
5861}
5962
63+ # deduplicates the submodule check and the assertion that on beta some tools MUST be passing
64+ check_dispatch () {
65+ if [ " $1 " = submodule_changed ]; then
66+ # ignore $2 (branch id)
67+ verify_status $3 $4
68+ elif [ " $2 " = beta ]; then
69+ echo " Requiring test passing for $3 ..."
70+ if grep -q ' "' " $3 " ' ":"\(test\|build\)-fail"' " $TOOLSTATE_FILE " ; then
71+ exit 4
72+ fi
73+ fi
74+ }
75+
76+ # list all tools here
77+ status_check () {
78+ check_dispatch $1 beta book src/doc/book
79+ check_dispatch $1 beta nomicon src/doc/nomicon
80+ check_dispatch $1 beta reference src/doc/reference
81+ check_dispatch $1 beta rust-by-example src/doc/rust-by-example
82+ check_dispatch $1 beta rls src/tool/rls
83+ check_dispatch $1 beta rustfmt src/tool/rustfmt
84+ # these tools are not required for beta to successfully branch
85+ check_dispatch $1 nightly clippy-driver src/tool/clippy
86+ check_dispatch $1 nightly miri src/tool/miri
87+ }
88+
6089# If this PR is intended to update one of these tools, do not let the build pass
6190# when they do not test-pass.
6291
63- verify_status book src/doc/book
64- verify_status nomicon src/doc/nomicon
65- verify_status reference src/doc/reference
66- verify_status rust-by-example src/doc/rust-by-example
67- verify_status rls src/tool/rls
68- verify_status rustfmt src/tool/rustfmt
69- verify_status clippy-driver src/tool/clippy
70- verify_status miri src/tool/miri
92+ status_check " submodule_changed"
7193
7294if [ " $RUST_RELEASE_CHANNEL " = nightly -a -n " ${TOOLSTATE_REPO_ACCESS_TOKEN+is_set} " ]; then
7395 . " $( dirname $0 ) /repo.sh"
@@ -86,6 +108,6 @@ $COMMIT\t$(cat "$TOOLSTATE_FILE")
86108 exit 0
87109fi
88110
89- if grep -q fail " $TOOLSTATE_FILE " ; then
90- exit 4
91- fi
111+ # abort compilation if an important tool doesn't build
112+ # (this code is reachable if not on the nightly channel)
113+ status_check " beta_required "
0 commit comments