Skip to content
This repository was archived by the owner on Nov 15, 2023. It is now read-only.

Commit 634520c

Browse files
bkchralvicsam
andauthored
Prepare for rust 1.60 (#5282)
* Prepare for rust 1.60 * change ci image to staging * empty commit for pipeline rerun * ci image production Co-authored-by: Alexander Samusev <[email protected]> Co-authored-by: alvicsam <[email protected]>
1 parent 256d5db commit 634520c

File tree

6 files changed

+74
-7
lines changed

6 files changed

+74
-7
lines changed

.gitlab-ci.yml

+2
Original file line numberDiff line numberDiff line change
@@ -227,6 +227,8 @@ build-linux-stable:
227227
# Enable debug assertions since we are running optimized builds for testing
228228
# but still want to have debug assertions.
229229
RUSTFLAGS: "-Cdebug-assertions=y -Dwarnings"
230+
# Ensure we run the UI tests.
231+
RUN_UI_TESTS: 1
230232
script:
231233
- time cargo build --profile testnet --features pyroscope --verbose --bin polkadot
232234
- sccache -s

Cargo.lock

+1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

node/overseer/overseer-gen/Cargo.toml

+1
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ pin-project = "1.0"
2020

2121
[dev-dependencies]
2222
trybuild = "1.0.53"
23+
rustversion = "1.0.6"
2324

2425
[features]
2526
default = []
+27-3
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,39 @@
1-
// The generated code requires quite a bit of surrounding code to work.
2-
// Please refer to [the examples](examples/dummy.rs) and
3-
// [the minimal usage example](../examples/minimal-example.rs).
1+
// Copyright 2022 Parity Technologies (UK) Ltd.
2+
// This file is part of Polkadot.
3+
4+
// Polkadot is free software: you can redistribute it and/or modify
5+
// it under the terms of the GNU General Public License as published by
6+
// the Free Software Foundation, either version 3 of the License, or
7+
// (at your option) any later version.
8+
9+
// Polkadot is distributed in the hope that it will be useful,
10+
// but WITHOUT ANY WARRANTY; without even the implied warranty of
11+
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12+
// GNU General Public License for more details.
13+
14+
// You should have received a copy of the GNU General Public License
15+
// along with Polkadot. If not, see <http://www.gnu.org/licenses/>.
416

517
#[test]
18+
#[rustversion::attr(not(stable), ignore)]
619
fn ui_compile_fail() {
20+
// Only run the ui tests when `RUN_UI_TESTS` is set.
21+
if std::env::var("RUN_UI_TESTS").is_err() {
22+
return
23+
}
24+
725
let t = trybuild::TestCases::new();
826
t.compile_fail("tests/ui/err-*.rs");
927
}
1028

1129
#[test]
30+
#[rustversion::attr(not(stable), ignore)]
1231
fn ui_pass() {
32+
// Only run the ui tests when `RUN_UI_TESTS` is set.
33+
if std::env::var("RUN_UI_TESTS").is_err() {
34+
return
35+
}
36+
1337
let t = trybuild::TestCases::new();
1438
t.pass("tests/ui/ok-*.rs");
1539
}
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,21 @@
1-
error[E0119]: conflicting implementations of trait `std::convert::From<MsgStrukt>` for type `AllMessages`
1+
error[E0119]: conflicting implementations of trait `polkadot_overseer_gen::SubsystemSender<MsgStrukt>` for type `OverseerSubsystemSender`
22
--> tests/ui/err-01-duplicate-consumer.rs:19:1
33
|
44
19 | #[overlord(signal=SigSigSig, event=Event, gen=AllMessages, error=OverseerError)]
55
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
66
| |
77
| first implementation here
8-
| conflicting implementation for `AllMessages`
8+
| conflicting implementation for `OverseerSubsystemSender`
99
|
1010
= note: this error originates in the attribute macro `overlord` (in Nightly builds, run with -Z macro-backtrace for more info)
1111

12-
error[E0119]: conflicting implementations of trait `polkadot_overseer_gen::SubsystemSender<MsgStrukt>` for type `OverseerSubsystemSender`
12+
error[E0119]: conflicting implementations of trait `std::convert::From<MsgStrukt>` for type `AllMessages`
1313
--> tests/ui/err-01-duplicate-consumer.rs:19:1
1414
|
1515
19 | #[overlord(signal=SigSigSig, event=Event, gen=AllMessages, error=OverseerError)]
1616
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
1717
| |
1818
| first implementation here
19-
| conflicting implementation for `OverseerSubsystemSender`
19+
| conflicting implementation for `AllMessages`
2020
|
2121
= note: this error originates in the attribute macro `overlord` (in Nightly builds, run with -Z macro-backtrace for more info)

scripts/update-rust-stable.sh

+39
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
#!/usr/bin/env bash
2+
#
3+
# Script for updating the UI tests for a new rust stable version.
4+
#
5+
# It needs to be called like this:
6+
#
7+
# update-rust-stable.sh 1.61
8+
#
9+
# This will run all UI tests with the rust stable 1.61. The script
10+
# requires that rustup is installed.
11+
set -e
12+
13+
if [ "$#" -ne 1 ]; then
14+
echo "Please specify the rust version to use. E.g. update-rust-stable.sh 1.61"
15+
exit
16+
fi
17+
18+
RUST_VERSION=$1
19+
20+
if ! command -v rustup &> /dev/null
21+
then
22+
echo "rustup needs to be installed"
23+
exit
24+
fi
25+
26+
rustup install $RUST_VERSION
27+
rustup component add rust-src --toolchain $RUST_VERSION
28+
29+
# Ensure we run the ui tests
30+
export RUN_UI_TESTS=1
31+
# We don't need any wasm files for ui tests
32+
export SKIP_WASM_BUILD=1
33+
# Let trybuild overwrite the .stderr files
34+
export TRYBUILD=overwrite
35+
36+
# Run all the relevant UI tests
37+
#
38+
# Any new UI tests in different crates need to be added here as well.
39+
rustup run $RUST_VERSION cargo test -p polkadot-overseer-gen ui

0 commit comments

Comments
 (0)