From 0fdf24bcf332ebc96fcc4d292e6752ea0ec58640 Mon Sep 17 00:00:00 2001 From: Mark Mansi Date: Wed, 17 Jul 2019 10:30:29 -0500 Subject: [PATCH 01/12] actually test rustc-guide with toolstate --- src/ci/docker/x86_64-gnu-tools/checktools.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/src/ci/docker/x86_64-gnu-tools/checktools.sh b/src/ci/docker/x86_64-gnu-tools/checktools.sh index 9995d2aac7f24..2b5c3cc34b847 100755 --- a/src/ci/docker/x86_64-gnu-tools/checktools.sh +++ b/src/ci/docker/x86_64-gnu-tools/checktools.sh @@ -25,6 +25,7 @@ python2.7 "$X_PY" test --no-fail-fast \ src/doc/rust-by-example \ src/doc/embedded-book \ src/doc/edition-guide \ + src/doc/rustc-guide \ src/tools/clippy \ src/tools/rls \ src/tools/rustfmt \ From 97b4156398ee693dd492f70dfc33e80a93a5faf7 Mon Sep 17 00:00:00 2001 From: Mark Mansi Date: Wed, 17 Jul 2019 11:44:33 -0500 Subject: [PATCH 02/12] don't fail builds for rustc-guide --- src/ci/docker/x86_64-gnu-tools/checkregression.py | 6 +++++- src/ci/docker/x86_64-gnu-tools/checktools.sh | 1 - 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/src/ci/docker/x86_64-gnu-tools/checkregression.py b/src/ci/docker/x86_64-gnu-tools/checkregression.py index 0cc0a6329e5bf..c1211579648eb 100755 --- a/src/ci/docker/x86_64-gnu-tools/checkregression.py +++ b/src/ci/docker/x86_64-gnu-tools/checkregression.py @@ -4,6 +4,9 @@ import sys import json +# Regressions for these tools does not cause failure +REGRESSION_OK = ["rustc-guide"] + if __name__ == '__main__': os_name = sys.argv[1] toolstate_file = sys.argv[2] @@ -32,7 +35,8 @@ 'The state of "{}" has {} from "{}" to "{}"' .format(tool, verb, state, new_state) ) - regressed = True + if tool not in REGRESSION_OK: + regressed = True if regressed: sys.exit(1) diff --git a/src/ci/docker/x86_64-gnu-tools/checktools.sh b/src/ci/docker/x86_64-gnu-tools/checktools.sh index 2b5c3cc34b847..4fb65b4e96192 100755 --- a/src/ci/docker/x86_64-gnu-tools/checktools.sh +++ b/src/ci/docker/x86_64-gnu-tools/checktools.sh @@ -89,7 +89,6 @@ status_check() { # these tools are not required for beta to successfully branch check_dispatch $1 nightly miri src/tools/miri check_dispatch $1 nightly embedded-book src/doc/embedded-book - check_dispatch $1 nightly rustc-guide src/doc/rustc-guide } # If this PR is intended to update one of these tools, do not let the build pass From 8070bb828c01c14bd16a6e9afca82c1d1fdff543 Mon Sep 17 00:00:00 2001 From: Who? Me?! Date: Thu, 18 Jul 2019 08:42:39 -0500 Subject: [PATCH 03/12] Regressions ok for miri too Co-Authored-By: kennytm --- src/ci/docker/x86_64-gnu-tools/checkregression.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/ci/docker/x86_64-gnu-tools/checkregression.py b/src/ci/docker/x86_64-gnu-tools/checkregression.py index c1211579648eb..f8d9190a066a9 100755 --- a/src/ci/docker/x86_64-gnu-tools/checkregression.py +++ b/src/ci/docker/x86_64-gnu-tools/checkregression.py @@ -5,7 +5,7 @@ import json # Regressions for these tools does not cause failure -REGRESSION_OK = ["rustc-guide"] +REGRESSION_OK = ["rustc-guide", "miri"] if __name__ == '__main__': os_name = sys.argv[1] From b2d05dba415ee7079dfcf1051a4474c7efd44bdf Mon Sep 17 00:00:00 2001 From: Ralf Jung Date: Thu, 18 Jul 2019 10:47:38 +0200 Subject: [PATCH 04/12] add a few comments for the toolstate stuff --- src/ci/docker/x86_64-gnu-tools/checktools.sh | 12 ++++++++---- src/ci/docker/x86_64-gnu-tools/repo.sh | 4 ++++ 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/src/ci/docker/x86_64-gnu-tools/checktools.sh b/src/ci/docker/x86_64-gnu-tools/checktools.sh index 4fb65b4e96192..c8ef1a0f78f80 100755 --- a/src/ci/docker/x86_64-gnu-tools/checktools.sh +++ b/src/ci/docker/x86_64-gnu-tools/checktools.sh @@ -42,7 +42,7 @@ check_tool_failed() { } # This function checks that if a tool's submodule changed, the tool's state must improve -verify_status() { +verify_submodule_changed() { echo "Verifying status of $1..." if echo "$CHANGED_FILES" | grep -q "^M[[:blank:]]$2$"; then echo "This PR updated '$2', verifying if status is 'test-pass'..." @@ -67,7 +67,7 @@ verify_status() { check_dispatch() { if [ "$1" = submodule_changed ]; then # ignore $2 (branch id) - verify_status $3 $4 + verify_submodule_changed $3 $4 elif [ "$2" = beta ]; then echo "Requiring test passing for $3..." if check_tool_failed "$3"; then @@ -76,7 +76,9 @@ check_dispatch() { fi } -# list all tools here +# List all tools here. +# This function gets called with "submodule_changed" for each PR that changed a submodule, +# and with "beta_required" for each PR that lands on beta/stable. status_check() { check_dispatch $1 beta book src/doc/book check_dispatch $1 beta nomicon src/doc/nomicon @@ -86,7 +88,8 @@ status_check() { check_dispatch $1 beta rls src/tools/rls check_dispatch $1 beta rustfmt src/tools/rustfmt check_dispatch $1 beta clippy-driver src/tools/clippy - # these tools are not required for beta to successfully branch + # These tools are not required on the beta/stable branches. + # They will still cause failure during the beta cutoff week, see `src/tools/publish_toolstate.py` for that. check_dispatch $1 nightly miri src/tools/miri check_dispatch $1 nightly embedded-book src/doc/embedded-book } @@ -97,6 +100,7 @@ status_check() { status_check "submodule_changed" CHECK_NOT="$(readlink -f "$(dirname $0)/checkregression.py")" +# This callback is called by `commit_toolstate_change`, see `repo.sh`. change_toolstate() { # only update the history if python2.7 "$CHECK_NOT" "$OS" "$TOOLSTATE_FILE" "_data/latest.json" changed; then diff --git a/src/ci/docker/x86_64-gnu-tools/repo.sh b/src/ci/docker/x86_64-gnu-tools/repo.sh index 741d4dcbd9a45..35ab7e2b8c839 100644 --- a/src/ci/docker/x86_64-gnu-tools/repo.sh +++ b/src/ci/docker/x86_64-gnu-tools/repo.sh @@ -62,6 +62,10 @@ commit_toolstate_change() { MESSAGE_FILE="$1" shift for RETRY_COUNT in 1 2 3 4 5; do + # Call the callback; this will in the end call `change_toolstate` from + # `checktools.sh` if we are in the `auto` branch (pre-landing) or + # `src/tools/publish_toolstate.py` if we are in the `master` branch + # (post-landing). "$@" # `git commit` failing means nothing to commit. FAILURE=0 From 8b87162af2a505b187fd1f9c27c084b6c4174882 Mon Sep 17 00:00:00 2001 From: Who? Me?! Date: Thu, 18 Jul 2019 08:57:55 -0500 Subject: [PATCH 05/12] Update src/ci/docker/x86_64-gnu-tools/checktools.sh Co-Authored-By: Ralf Jung --- src/ci/docker/x86_64-gnu-tools/checktools.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/ci/docker/x86_64-gnu-tools/checktools.sh b/src/ci/docker/x86_64-gnu-tools/checktools.sh index c8ef1a0f78f80..8df63c214e189 100755 --- a/src/ci/docker/x86_64-gnu-tools/checktools.sh +++ b/src/ci/docker/x86_64-gnu-tools/checktools.sh @@ -89,7 +89,7 @@ status_check() { check_dispatch $1 beta rustfmt src/tools/rustfmt check_dispatch $1 beta clippy-driver src/tools/clippy # These tools are not required on the beta/stable branches. - # They will still cause failure during the beta cutoff week, see `src/tools/publish_toolstate.py` for that. + # They will still cause failure during the beta cutoff week, see `checkregression.py` for that. check_dispatch $1 nightly miri src/tools/miri check_dispatch $1 nightly embedded-book src/doc/embedded-book } From 17c4084ebac2f5b4bd8c9b3900f492420844f3ca Mon Sep 17 00:00:00 2001 From: Who? Me?! Date: Thu, 18 Jul 2019 10:02:59 -0500 Subject: [PATCH 06/12] Update src/ci/docker/x86_64-gnu-tools/checkregression.py Co-Authored-By: Ralf Jung --- src/ci/docker/x86_64-gnu-tools/checkregression.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/ci/docker/x86_64-gnu-tools/checkregression.py b/src/ci/docker/x86_64-gnu-tools/checkregression.py index f8d9190a066a9..6bfdc9e8a14ed 100755 --- a/src/ci/docker/x86_64-gnu-tools/checkregression.py +++ b/src/ci/docker/x86_64-gnu-tools/checkregression.py @@ -4,7 +4,7 @@ import sys import json -# Regressions for these tools does not cause failure +# Regressions for these tools do not cause failure. REGRESSION_OK = ["rustc-guide", "miri"] if __name__ == '__main__': From 8940a27437f4243a27ff4def2de2590e901973b0 Mon Sep 17 00:00:00 2001 From: Mark Mansi Date: Thu, 18 Jul 2019 10:24:20 -0500 Subject: [PATCH 07/12] embedded-book failures don't block beta --- src/ci/docker/x86_64-gnu-tools/checkregression.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/ci/docker/x86_64-gnu-tools/checkregression.py b/src/ci/docker/x86_64-gnu-tools/checkregression.py index 6bfdc9e8a14ed..081beb932b201 100755 --- a/src/ci/docker/x86_64-gnu-tools/checkregression.py +++ b/src/ci/docker/x86_64-gnu-tools/checkregression.py @@ -5,7 +5,7 @@ import json # Regressions for these tools do not cause failure. -REGRESSION_OK = ["rustc-guide", "miri"] +REGRESSION_OK = ["rustc-guide", "miri", "embedded-book"] if __name__ == '__main__': os_name = sys.argv[1] From 1aa10797df9ef70bd08011811d6a822a7b58e1a3 Mon Sep 17 00:00:00 2001 From: Who? Me?! Date: Thu, 18 Jul 2019 12:20:34 -0500 Subject: [PATCH 08/12] Update src/ci/docker/x86_64-gnu-tools/checkregression.py Co-Authored-By: kennytm --- src/ci/docker/x86_64-gnu-tools/checkregression.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/ci/docker/x86_64-gnu-tools/checkregression.py b/src/ci/docker/x86_64-gnu-tools/checkregression.py index 081beb932b201..72acb107405e5 100755 --- a/src/ci/docker/x86_64-gnu-tools/checkregression.py +++ b/src/ci/docker/x86_64-gnu-tools/checkregression.py @@ -35,7 +35,7 @@ 'The state of "{}" has {} from "{}" to "{}"' .format(tool, verb, state, new_state) ) - if tool not in REGRESSION_OK: + if not (verb == 'regressed' and tool in REGRESSION_OK): regressed = True if regressed: From 9c48ed4eab3d2f6050803479f76db0aafecdd7c7 Mon Sep 17 00:00:00 2001 From: Ralf Jung Date: Tue, 23 Jul 2019 10:34:19 +0200 Subject: [PATCH 09/12] more comments for toolstate scripts --- src/ci/docker/x86_64-gnu-tools/checkregression.py | 8 +++++++- src/ci/docker/x86_64-gnu-tools/checktools.sh | 9 +++++++-- 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/src/ci/docker/x86_64-gnu-tools/checkregression.py b/src/ci/docker/x86_64-gnu-tools/checkregression.py index 72acb107405e5..4fbb8c4d20349 100755 --- a/src/ci/docker/x86_64-gnu-tools/checkregression.py +++ b/src/ci/docker/x86_64-gnu-tools/checkregression.py @@ -1,10 +1,16 @@ #!/usr/bin/env python # -*- coding: utf-8 -*- +## This script has two purposes: detect any tool that *regressed*, which is used +## during the week before the beta branches to reject PRs; and detect any tool +## that *changed* to see if we need to update the toolstate repo. + import sys import json -# Regressions for these tools do not cause failure. +# Regressions for these tools during the beta cutoff week do not cause failure. +# See `status_check` in `checktools.sh` for tools that have to pass on the +# beta/stable branches. REGRESSION_OK = ["rustc-guide", "miri", "embedded-book"] if __name__ == '__main__': diff --git a/src/ci/docker/x86_64-gnu-tools/checktools.sh b/src/ci/docker/x86_64-gnu-tools/checktools.sh index 8df63c214e189..db10c84a9977c 100755 --- a/src/ci/docker/x86_64-gnu-tools/checktools.sh +++ b/src/ci/docker/x86_64-gnu-tools/checktools.sh @@ -79,6 +79,9 @@ check_dispatch() { # List all tools here. # This function gets called with "submodule_changed" for each PR that changed a submodule, # and with "beta_required" for each PR that lands on beta/stable. +# The purpose of this function is to *reject* PRs if a tool is not "test-pass" and +# (a) the tool's submodule has been updated, or (b) we landed on beta/stable and the +# tool has to "test-pass" on that branch. status_check() { check_dispatch $1 beta book src/doc/book check_dispatch $1 beta nomicon src/doc/nomicon @@ -88,8 +91,10 @@ status_check() { check_dispatch $1 beta rls src/tools/rls check_dispatch $1 beta rustfmt src/tools/rustfmt check_dispatch $1 beta clippy-driver src/tools/clippy - # These tools are not required on the beta/stable branches. - # They will still cause failure during the beta cutoff week, see `checkregression.py` for that. + # These tools are not required on the beta/stable branches, but they *do* cause + # PRs to fail if a submodule update does not fix them. + # They will still cause failure during the beta cutoff week, unless `checkregression.py` + # exempts them from that. check_dispatch $1 nightly miri src/tools/miri check_dispatch $1 nightly embedded-book src/doc/embedded-book } From 92d432a0c710dfabf507de24ab95e491dc6a7449 Mon Sep 17 00:00:00 2001 From: Ralf Jung Date: Tue, 23 Jul 2019 10:50:45 +0200 Subject: [PATCH 10/12] more callback docs --- src/ci/docker/x86_64-gnu-tools/repo.sh | 11 +++++++---- src/tools/publish_toolstate.py | 3 +++ 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/src/ci/docker/x86_64-gnu-tools/repo.sh b/src/ci/docker/x86_64-gnu-tools/repo.sh index 35ab7e2b8c839..f06129551a464 100644 --- a/src/ci/docker/x86_64-gnu-tools/repo.sh +++ b/src/ci/docker/x86_64-gnu-tools/repo.sh @@ -62,10 +62,13 @@ commit_toolstate_change() { MESSAGE_FILE="$1" shift for RETRY_COUNT in 1 2 3 4 5; do - # Call the callback; this will in the end call `change_toolstate` from - # `checktools.sh` if we are in the `auto` branch (pre-landing) or - # `src/tools/publish_toolstate.py` if we are in the `master` branch - # (post-landing). + # Call the callback. + # - If we are in the `auto` branch (pre-landing), this is called from `checktools.sh` and + # the callback is `change_toolstate` in that file. The purpose of this is to publish the + # test results (the new commit-to-toolstate mapping) in the toolstate repo. + # - If we are in the `master` branch (post-landing), this is called by the CI pipeline + # and the callback is `src/tools/publish_toolstate.py`. The purpose is to publish + # the new "current" toolstate in the toolstate repo. "$@" # `git commit` failing means nothing to commit. FAILURE=0 diff --git a/src/tools/publish_toolstate.py b/src/tools/publish_toolstate.py index 8f9061d7c1811..0f1ae5e0eb2ed 100755 --- a/src/tools/publish_toolstate.py +++ b/src/tools/publish_toolstate.py @@ -1,6 +1,9 @@ #!/usr/bin/env python # -*- coding: utf-8 -*- +## This is set as callback for `src/ci/docker/x86_64-gnu-tools/repo.sh` by the CI scripts +## when a new commit lands on `master` (i.e., after it passed all checks on `auto`). + import sys import re import os From 82d18412d1478a5c2db8bf6ed6c32e4b1c668dfe Mon Sep 17 00:00:00 2001 From: Ralf Jung Date: Tue, 23 Jul 2019 10:54:30 +0200 Subject: [PATCH 11/12] more comments --- src/ci/docker/x86_64-gnu-tools/checktools.sh | 1 + src/tools/publish_toolstate.py | 5 ++++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/src/ci/docker/x86_64-gnu-tools/checktools.sh b/src/ci/docker/x86_64-gnu-tools/checktools.sh index db10c84a9977c..e0de51e2cb0ab 100755 --- a/src/ci/docker/x86_64-gnu-tools/checktools.sh +++ b/src/ci/docker/x86_64-gnu-tools/checktools.sh @@ -112,6 +112,7 @@ change_toolstate() { echo 'Toolstate is not changed. Not updating.' else if [ $SIX_WEEK_CYCLE -ge 35 ]; then + # Reject any regressions during the week before beta cutoff. python2.7 "$CHECK_NOT" "$OS" "$TOOLSTATE_FILE" "_data/latest.json" regressed fi sed -i "1 a\\ diff --git a/src/tools/publish_toolstate.py b/src/tools/publish_toolstate.py index 0f1ae5e0eb2ed..b8dcba3afc3a1 100755 --- a/src/tools/publish_toolstate.py +++ b/src/tools/publish_toolstate.py @@ -1,7 +1,10 @@ #!/usr/bin/env python # -*- coding: utf-8 -*- -## This is set as callback for `src/ci/docker/x86_64-gnu-tools/repo.sh` by the CI scripts +## This script publishes the new "current" toolstate in the toolstate repo (not to be +## confused with publishing the test results, which happens in +## `src/ci/docker/x86_64-gnu-tools/checktools.sh`). +## It is set as callback for `src/ci/docker/x86_64-gnu-tools/repo.sh` by the CI scripts ## when a new commit lands on `master` (i.e., after it passed all checks on `auto`). import sys From 11a3b742d8dfae9c9d4858adc5417918e13d84a5 Mon Sep 17 00:00:00 2001 From: Mark Mansi Date: Tue, 23 Jul 2019 15:33:41 -0500 Subject: [PATCH 12/12] add back check for update prs --- src/ci/docker/x86_64-gnu-tools/checktools.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/src/ci/docker/x86_64-gnu-tools/checktools.sh b/src/ci/docker/x86_64-gnu-tools/checktools.sh index e0de51e2cb0ab..04fbe728debc6 100755 --- a/src/ci/docker/x86_64-gnu-tools/checktools.sh +++ b/src/ci/docker/x86_64-gnu-tools/checktools.sh @@ -97,6 +97,7 @@ status_check() { # exempts them from that. check_dispatch $1 nightly miri src/tools/miri check_dispatch $1 nightly embedded-book src/doc/embedded-book + check_dispatch $1 nightly rustc-guide src/doc/rustc-guide } # If this PR is intended to update one of these tools, do not let the build pass