@@ -23,6 +23,8 @@ SIX_WEEK_CYCLE="$(( ($(date +%s) / 604800 - 3) % 6 ))"
23
23
24
24
touch " $TOOLSTATE_FILE "
25
25
26
+ # Try to test all the tools and store the build/test success in the TOOLSTATE_FILE
27
+
26
28
set +e
27
29
python2.7 " $X_PY " test --no-fail-fast \
28
30
src/doc/book \
38
40
cat " $TOOLSTATE_FILE "
39
41
echo
40
42
43
+ # This function checks that if a tool's submodule changed, the tool's state must improve
41
44
verify_status () {
42
45
echo " Verifying status of $1 ..."
43
46
if echo " $CHANGED_FILES " | grep -q " ^M[[:blank:]]$2 $" ; then
@@ -57,17 +60,36 @@ verify_status() {
57
60
fi
58
61
}
59
62
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
+
60
89
# If this PR is intended to update one of these tools, do not let the build pass
61
90
# when they do not test-pass.
62
91
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"
71
93
72
94
if [ " $RUST_RELEASE_CHANNEL " = nightly -a -n " ${TOOLSTATE_REPO_ACCESS_TOKEN+is_set} " ]; then
73
95
. " $( dirname $0 ) /repo.sh"
@@ -86,6 +108,6 @@ $COMMIT\t$(cat "$TOOLSTATE_FILE")
86
108
exit 0
87
109
fi
88
110
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