Skip to content

Commit c622840

Browse files
committed
Auto merge of #86098 - pietroalbini:test-stable, r=Mark-Simulacrum
Add the x86_64-gnu-stable builder During the 1.52 release process we had to deal with some commits that passed the test suite on the nightly branch but failed on the beta or stable branch. In that case it was due to some UI tests including the channel name in the output, but other changes might also be dependent on the channel. This commit adds a new CI job that runs the Linux x86_64 test suite with the stable branch, ensuring nightly changes also work as stable. To ensure the new job works the following other changes are present: * The `ui-fulldeps/session-derive-errors.rs` test has been disabled on beta and stable, which required adding support for `// ignore-{channel}` and `// only-{channel}`. * The `rustdoc/intra-doc/field.rs` has been fixed. r? `@Mark-Simulacrum` fixes rust-lang/release-team#11
2 parents 1f949e9 + 12d37e6 commit c622840

File tree

12 files changed

+72
-22
lines changed

12 files changed

+72
-22
lines changed

.github/workflows/ci.yml

+5
Original file line numberDiff line numberDiff line change
@@ -259,6 +259,11 @@ jobs:
259259
- name: x86_64-gnu
260260
os: ubuntu-latest-xl
261261
env: {}
262+
- name: x86_64-gnu-stable
263+
env:
264+
IMAGE: x86_64-gnu
265+
RUST_CI_OVERRIDE_RELEASE_CHANNEL: stable
266+
os: ubuntu-latest-xl
262267
- name: x86_64-gnu-aux
263268
os: ubuntu-latest-xl
264269
env: {}

src/bootstrap/test.rs

+2
Original file line numberDiff line numberDiff line change
@@ -1503,6 +1503,8 @@ note: if you're sure you want to do this, please open an issue as to why. In the
15031503

15041504
cmd.env("BOOTSTRAP_CARGO", &builder.initial_cargo);
15051505

1506+
cmd.arg("--channel").arg(&builder.config.channel);
1507+
15061508
builder.ci_env.force_coloring_in_ci(&mut cmd);
15071509

15081510
builder.info(&format!(

src/ci/docker/run.sh

+1
Original file line numberDiff line numberDiff line change
@@ -235,6 +235,7 @@ docker \
235235
--env TOOLSTATE_REPO_ACCESS_TOKEN \
236236
--env TOOLSTATE_REPO \
237237
--env TOOLSTATE_PUBLISH \
238+
--env RUST_CI_OVERRIDE_RELEASE_CHANNEL \
238239
--env CI_JOB_NAME="${CI_JOB_NAME-$IMAGE}" \
239240
--init \
240241
--rm \

src/ci/github-actions/ci.yml

+11
Original file line numberDiff line numberDiff line change
@@ -407,6 +407,17 @@ jobs:
407407
- name: x86_64-gnu
408408
<<: *job-linux-xl
409409

410+
# This job ensures commits landing on nightly still pass the full
411+
# test suite on the stable channel. There are some UI tests that
412+
# depend on the channel being built (for example if they include the
413+
# channel name on the output), and this builder prevents landing
414+
# changes that would result in broken builds after a promotion.
415+
- name: x86_64-gnu-stable
416+
env:
417+
IMAGE: x86_64-gnu
418+
RUST_CI_OVERRIDE_RELEASE_CHANNEL: stable
419+
<<: *job-linux-xl
420+
410421
- name: x86_64-gnu-aux
411422
<<: *job-linux-xl
412423

src/ci/run.sh

+5-1
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,11 @@ fi
6565
# Always set the release channel for bootstrap; this is normally not important (i.e., only dist
6666
# builds would seem to matter) but in practice bootstrap wants to know whether we're targeting
6767
# master, beta, or stable with a build to determine whether to run some checks (notably toolstate).
68-
export RUST_RELEASE_CHANNEL="$(cat "${ci_dir}/channel")"
68+
if [[ -z "${RUST_CI_OVERRIDE_RELEASE_CHANNEL+x}" ]]; then
69+
export RUST_RELEASE_CHANNEL="$(cat "${ci_dir}/channel")"
70+
else
71+
export RUST_RELEASE_CHANNEL="${RUST_CI_OVERRIDE_RELEASE_CHANNEL}"
72+
fi
6973
RUST_CONFIGURE_ARGS="$RUST_CONFIGURE_ARGS --release-channel=$RUST_RELEASE_CHANNEL"
7074

7175
if [ "$DEPLOY$DEPLOY_ALT" = "1" ]; then

src/test/rustdoc/intra-doc/field.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// @has field/index.html '//a[@href="https://doc.rust-lang.org/nightly/core/ops/range/struct.Range.html#structfield.start"]' 'start'
2-
// @has field/index.html '//a[@href="https://doc.rust-lang.org/nightly/std/io/error/enum.ErrorKind.html#variant.NotFound"]' 'not_found'
1+
// @has field/index.html '//a[@href="{{channel}}/core/ops/range/struct.Range.html#structfield.start"]' 'start'
2+
// @has field/index.html '//a[@href="{{channel}}/std/io/error/enum.ErrorKind.html#variant.NotFound"]' 'not_found'
33
//! [start][std::ops::Range::start]
44
//! [not_found][std::io::ErrorKind::NotFound]

src/test/ui-fulldeps/session-derive-errors.rs

+6
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,12 @@
11
// check-fail
22
// Tests error conditions for specifying diagnostics using #[derive(SessionDiagnostic)]
33

4+
// The proc_macro2 crate handles spans differently when on beta/stable release rather than nightly,
5+
// changing the output of this test. Since SessionDiagnostic is strictly internal to the compiler
6+
// the test is just ignored on stable and beta:
7+
// ignore-beta
8+
// ignore-stable
9+
410
#![feature(rustc_private)]
511
#![crate_type = "lib"]
612

src/test/ui-fulldeps/session-derive-errors.stderr

+18-18
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
error: `#[derive(SessionDiagnostic)]` can only be used on structs
2-
--> $DIR/session-derive-errors.rs:28:1
2+
--> $DIR/session-derive-errors.rs:34:1
33
|
44
LL | / #[error = "E0123"]
55
LL | |
@@ -10,51 +10,51 @@ LL | | }
1010
| |_^
1111

1212
error: `#[label = ...]` is not a valid SessionDiagnostic struct attribute
13-
--> $DIR/session-derive-errors.rs:37:1
13+
--> $DIR/session-derive-errors.rs:43:1
1414
|
1515
LL | #[label = "This is in the wrong place"]
1616
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
1717

1818
error: `#[suggestion = ...]` is not a valid SessionDiagnostic field attribute
19-
--> $DIR/session-derive-errors.rs:44:5
19+
--> $DIR/session-derive-errors.rs:50:5
2020
|
2121
LL | #[suggestion = "this is the wrong kind of attribute"]
2222
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2323

2424
error: `error` specified multiple times
25-
--> $DIR/session-derive-errors.rs:52:11
25+
--> $DIR/session-derive-errors.rs:58:11
2626
|
2727
LL | #[error = "E0456"]
2828
| ^^^^^^^
2929

3030
error: `lint` specified when `error` was already specified
31-
--> $DIR/session-derive-errors.rs:58:10
31+
--> $DIR/session-derive-errors.rs:64:10
3232
|
3333
LL | #[lint = "some_useful_lint"]
3434
| ^^^^^^^^^^^^^^^^^^
3535

3636
error: `code` not specified
37-
--> $DIR/session-derive-errors.rs:67:1
37+
--> $DIR/session-derive-errors.rs:73:1
3838
|
3939
LL | struct ErrorCodeNotProvided {}
4040
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
4141
|
4242
= help: use the [code = "..."] attribute to set this diagnostic's error code
4343

4444
error: the `#[message = "..."]` attribute can only be applied to fields of type Span
45-
--> $DIR/session-derive-errors.rs:95:5
45+
--> $DIR/session-derive-errors.rs:101:5
4646
|
4747
LL | #[message = "this message is applied to a String field"]
4848
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
4949

5050
error: `name` doesn't refer to a field on this type
51-
--> $DIR/session-derive-errors.rs:102:1
51+
--> $DIR/session-derive-errors.rs:108:1
5252
|
5353
LL | #[message = "This error has a field, and references {name}"]
5454
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
5555

5656
error: invalid format string: expected `'}'` but string was terminated
57-
--> $DIR/session-derive-errors.rs:110:1
57+
--> $DIR/session-derive-errors.rs:116:1
5858
|
5959
LL | #[error = "E0123"]
6060
| - because of this opening brace
@@ -65,7 +65,7 @@ LL | #[message = "This is missing a closing brace: {name"]
6565
= note: this error originates in the derive macro `SessionDiagnostic` (in Nightly builds, run with -Z macro-backtrace for more info)
6666

6767
error: invalid format string: unmatched `}` found
68-
--> $DIR/session-derive-errors.rs:119:1
68+
--> $DIR/session-derive-errors.rs:125:1
6969
|
7070
LL | #[message = "This is missing an opening brace: name}"]
7171
| ^ unmatched `}` in format string
@@ -74,33 +74,33 @@ LL | #[message = "This is missing an opening brace: name}"]
7474
= note: this error originates in the derive macro `SessionDiagnostic` (in Nightly builds, run with -Z macro-backtrace for more info)
7575

7676
error: The `#[label = ...]` attribute can only be applied to fields of type Span
77-
--> $DIR/session-derive-errors.rs:138:5
77+
--> $DIR/session-derive-errors.rs:144:5
7878
|
7979
LL | #[label = "See here"]
8080
| ^^^^^^^^^^^^^^^^^^^^^
8181

8282
error: `nonsense` is not a valid key for `#[suggestion(...)]`
83-
--> $DIR/session-derive-errors.rs:163:18
83+
--> $DIR/session-derive-errors.rs:169:18
8484
|
8585
LL | #[suggestion(nonsense = "This is nonsense")]
8686
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
8787

8888
error: `msg` is not a valid key for `#[suggestion(...)]`
89-
--> $DIR/session-derive-errors.rs:171:18
89+
--> $DIR/session-derive-errors.rs:177:18
9090
|
9191
LL | #[suggestion(msg = "This is a suggestion")]
9292
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
9393

9494
error: missing suggestion message
95-
--> $DIR/session-derive-errors.rs:179:7
95+
--> $DIR/session-derive-errors.rs:185:7
9696
|
9797
LL | #[suggestion(code = "This is suggested code")]
9898
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
9999
|
100100
= help: provide a suggestion message using #[suggestion(message = "...")]
101101

102102
error: wrong field type for suggestion
103-
--> $DIR/session-derive-errors.rs:194:5
103+
--> $DIR/session-derive-errors.rs:200:5
104104
|
105105
LL | / #[suggestion(message = "This is a message", code = "This is suggested code")]
106106
LL | |
@@ -110,23 +110,23 @@ LL | | suggestion: Applicability,
110110
= help: #[suggestion(...)] should be applied to fields of type Span or (Span, Applicability)
111111

112112
error: type of field annotated with `#[suggestion(...)]` contains more than one Span
113-
--> $DIR/session-derive-errors.rs:209:5
113+
--> $DIR/session-derive-errors.rs:215:5
114114
|
115115
LL | / #[suggestion(message = "This is a message", code = "This is suggested code")]
116116
LL | |
117117
LL | | suggestion: (Span, Span, Applicability),
118118
| |___________________________________________^
119119

120120
error: type of field annotated with `#[suggestion(...)]` contains more than one Applicability
121-
--> $DIR/session-derive-errors.rs:217:5
121+
--> $DIR/session-derive-errors.rs:223:5
122122
|
123123
LL | / #[suggestion(message = "This is a message", code = "This is suggested code")]
124124
LL | |
125125
LL | | suggestion: (Applicability, Applicability, Span),
126126
| |____________________________________________________^
127127

128128
error: invalid annotation list `#[label(...)]`
129-
--> $DIR/session-derive-errors.rs:225:7
129+
--> $DIR/session-derive-errors.rs:231:7
130130
|
131131
LL | #[label("wrong kind of annotation for label")]
132132
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

src/tools/compiletest/src/common.rs

+3
Original file line numberDiff line numberDiff line change
@@ -346,6 +346,9 @@ pub struct Config {
346346
/// whether to run `tidy` when a rustdoc test fails
347347
pub has_tidy: bool,
348348

349+
/// The current Rust channel
350+
pub channel: String,
351+
349352
// Configuration for various run-make tests frobbing things like C compilers
350353
// or querying about various LLVM component information.
351354
pub cc: String,

src/tools/compiletest/src/header.rs

+1
Original file line numberDiff line numberDiff line change
@@ -879,6 +879,7 @@ impl Config {
879879
name == util::get_arch(&self.target) || // architecture
880880
name == util::get_pointer_width(&self.target) || // pointer width
881881
name == self.stage_id.split('-').next().unwrap() || // stage
882+
name == self.channel || // channel
882883
(self.target != self.host && name == "cross-compile") ||
883884
(name == "endian-big" && util::is_big_endian(&self.target)) ||
884885
(self.remote_test_client.is_some() && name == "remote") ||

src/tools/compiletest/src/header/tests.rs

+15
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ fn config() -> Config {
5555
"--llvm-components=",
5656
"--android-cross-path=",
5757
"--target=x86_64-unknown-linux-gnu",
58+
"--channel=nightly",
5859
];
5960
let args = args.iter().map(ToString::to_string).collect();
6061
crate::parse_config(args)
@@ -234,6 +235,20 @@ fn asm_support() {
234235
assert!(!parse_rs(&config, "// needs-asm-support").ignore);
235236
}
236237

238+
#[test]
239+
fn channel() {
240+
let mut config = config();
241+
config.channel = "beta".into();
242+
243+
assert!(parse_rs(&config, "// ignore-beta").ignore);
244+
assert!(parse_rs(&config, "// only-nightly").ignore);
245+
assert!(parse_rs(&config, "// only-stable").ignore);
246+
247+
assert!(!parse_rs(&config, "// only-beta").ignore);
248+
assert!(!parse_rs(&config, "// ignore-nightly").ignore);
249+
assert!(!parse_rs(&config, "// ignore-stable").ignore);
250+
}
251+
237252
#[test]
238253
fn test_extract_version_range() {
239254
use super::{extract_llvm_version, extract_version_range};

src/tools/compiletest/src/main.rs

+3-1
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,8 @@ pub fn parse_config(args: Vec<String>) -> Config {
144144
"enable this to generate a Rustfix coverage file, which is saved in \
145145
`./<build_base>/rustfix_missing_coverage.txt`",
146146
)
147-
.optflag("h", "help", "show this message");
147+
.optflag("h", "help", "show this message")
148+
.reqopt("", "channel", "current Rust channel", "CHANNEL");
148149

149150
let (argv0, args_) = args.split_first().unwrap();
150151
if args.len() == 1 || args[1] == "-h" || args[1] == "--help" {
@@ -278,6 +279,7 @@ pub fn parse_config(args: Vec<String>) -> Config {
278279
compare_mode: matches.opt_str("compare-mode").map(CompareMode::parse),
279280
rustfix_coverage: matches.opt_present("rustfix-coverage"),
280281
has_tidy,
282+
channel: matches.opt_str("channel").unwrap(),
281283

282284
cc: matches.opt_str("cc").unwrap(),
283285
cxx: matches.opt_str("cxx").unwrap(),

0 commit comments

Comments
 (0)