Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CI: replace compiletest-rs with trybuild #268

Merged
merged 3 commits into from
Nov 13, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
5 changes: 1 addition & 4 deletions .cargo/config
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,4 @@ runner = "qemu-system-arm -cpu cortex-m3 -machine lm3s6965evb -nographic -semiho
[target.'cfg(all(target_arch = "arm", target_os = "none"))']
rustflags = [
"-C", "link-arg=-Tlink.x",
]

[build]
target = "thumbv7m-none-eabi"
]
3 changes: 1 addition & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,7 @@ matrix:

# compile-fail tests
- env: TARGET=x86_64-unknown-linux-gnu
# FIXME revert this -- compiletest-rs v0.3.25 is broken with recent nightly
rust: nightly-2019-10-31
rust: nightly
if: (branch = staging OR branch = trying) OR (type = pull_request AND branch = master)

# heterogeneous multi-core support
Expand Down
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ features = ["exit"]
version = "0.5.2"

[target.x86_64-unknown-linux-gnu.dev-dependencies]
compiletest_rs = "0.3.22"
trybuild = "1"

[features]
heterogeneous = ["cortex-m-rtfm-macros/heterogeneous", "microamp"]
Expand Down
5 changes: 4 additions & 1 deletion ci/script.sh
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,13 @@ main() {
mkdir -p ci/builds

if [ $T = x86_64-unknown-linux-gnu ]; then
if [ $TRAVIS_RUST_VERSION = nightly ]; then
if [[ $TRAVIS_RUST_VERSION == 1.*.* ]]; then
# test on a fixed version (MSRV) to avoid problems with changes in rustc diagnostics
# compile-fail tests
cargo test --test single --target $T
fi

if [ $TRAVIS_RUST_VERSION = nightly ]; then
# multi-core compile-pass tests
pushd heterogeneous
local exs=(
Expand Down
18 changes: 3 additions & 15 deletions tests/single.rs
Original file line number Diff line number Diff line change
@@ -1,19 +1,7 @@
use std::path::PathBuf;

use compiletest_rs::{common::Mode, Config};
use trybuild::TestCases;

#[test]
fn ui() {
let mut config = Config::default();

config.mode = Mode::Ui;
config.src_base = PathBuf::from("ui/single");
config.target_rustcflags = Some(
"--edition=2018 -L target/debug/deps -Z unstable-options --extern rtfm --extern lm3s6965"
.to_owned(),
);
config.link_deps();
config.clean_rmeta();

compiletest_rs::run_tests(&config);
let t = TestCases::new();
t.compile_fail("ui/single/*.rs");
}
3 changes: 0 additions & 3 deletions ui/single/exception-invalid.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,3 @@ error: only exceptions with configurable priority can be used as hardware tasks
|
6 | fn nmi(_: nmi::Context) {}
| ^^^

error: aborting due to previous error

3 changes: 0 additions & 3 deletions ui/single/exception-systick-used.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,3 @@ error: this exception can't be used because it's being used by the runtime
|
6 | fn sys_tick(_: sys_tick::Context) {}
| ^^^^^^^^

error: aborting due to previous error

3 changes: 0 additions & 3 deletions ui/single/extern-interrupt-not-enough.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,3 @@ error: not enough `extern` interrupts to dispatch all software tasks (need: 1; g
|
6 | fn a(_: a::Context) {}
| ^

error: aborting due to previous error

3 changes: 0 additions & 3 deletions ui/single/extern-interrupt-used.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,3 @@ error: `extern` interrupts can't be used as hardware tasks
|
5 | #[task(binds = UART0)]
| ^^^^^

error: aborting due to previous error

8 changes: 6 additions & 2 deletions ui/single/locals-cfg.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,10 @@ error[E0425]: cannot find value `FOO` in this scope
44 | FOO;
| ^^^ not found in this scope

error: aborting due to 5 previous errors
error: duplicate lang item in crate `panic_halt`: `panic_impl`.
|
= note: first defined in crate `std`.

For more information about this error, try `rustc --explain E0425`.
error: duplicate lang item in crate `panic_semihosting`: `panic_impl`.
|
= note: first defined in crate `panic_halt`.
4 changes: 0 additions & 4 deletions ui/single/resources-cfg.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,3 @@ error[E0609]: no field `o5` on type `uart1Resources<'_>`
| ^^ unknown field
|
= note: available fields are: `__marker__`

error: aborting due to 15 previous errors

For more information about this error, try `rustc --explain E0609`.
12 changes: 8 additions & 4 deletions ui/single/task-priority-too-high.stderr
Original file line number Diff line number Diff line change
@@ -1,9 +1,13 @@
warning: unused import: `rtfm::app`
--> $DIR/task-priority-too-high.rs:3:5
|
3 | use rtfm::app;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Uh, spurious warning? Is this a known rustc bug?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The warning it's also present on 1.36.0. Perhaps this has been there for a while but compiletest ignores warnings by default?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, that's probably what's happening

| ^^^^^^^^^
|
= note: #[warn(unused_imports)] on by default

error[E0080]: evaluation of constant value failed
--> $DIR/task-priority-too-high.rs:5:1
|
5 | #[rtfm::app(device = lm3s6965)]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ attempt to subtract with overflow

error: aborting due to previous error

For more information about this error, try `rustc --explain E0080`.