Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
bevyengine
GitHub Repository: bevyengine/bevy
Path: blob/main/tools/ci/src/commands/compile_fail.rs
6598 views
1
use crate::{args::Args, Prepare, PreparedCommand};
2
use argh::FromArgs;
3
use xshell::cmd;
4
5
/// Runs the compile-fail tests.
6
#[derive(FromArgs, Default)]
7
#[argh(subcommand, name = "compile-fail")]
8
pub struct CompileFailCommand {}
9
10
impl Prepare for CompileFailCommand {
11
fn prepare<'a>(&self, sh: &'a xshell::Shell, args: Args) -> Vec<PreparedCommand<'a>> {
12
let no_fail_fast = args.keep_going();
13
let jobs = args.build_jobs();
14
let test_threads = args.test_threads();
15
let jobs_ref = jobs.as_ref();
16
let test_threads_ref = test_threads.as_ref();
17
18
let mut commands = vec![];
19
20
// Macro Compile Fail Tests
21
// Run tests (they do not get executed with the workspace tests)
22
// - See crates/bevy_macros_compile_fail_tests/README.md
23
commands.push(
24
PreparedCommand::new::<Self>(
25
cmd!(sh, "cargo test --target-dir ../../../target {no_fail_fast...} {jobs_ref...} -- {test_threads_ref...}"),
26
"Compiler errors of the macros compile fail tests seem to be different than expected! Check locally and compare rust versions.",
27
)
28
.with_subdir("crates/bevy_derive/compile_fail"),
29
);
30
31
// ECS Compile Fail Tests
32
// Run UI tests (they do not get executed with the workspace tests)
33
// - See crates/bevy_ecs_compile_fail_tests/README.md
34
commands.push(
35
PreparedCommand::new::<Self>(
36
cmd!(sh, "cargo test --target-dir ../../../target {no_fail_fast...} {jobs_ref...} -- {test_threads_ref...}"),
37
"Compiler errors of the ECS compile fail tests seem to be different than expected! Check locally and compare rust versions.",
38
)
39
.with_subdir("crates/bevy_ecs/compile_fail"),
40
);
41
42
// Reflect Compile Fail Tests
43
// Run tests (they do not get executed with the workspace tests)
44
// - See crates/bevy_reflect_compile_fail_tests/README.md
45
commands.push(
46
PreparedCommand::new::<Self>(
47
cmd!(sh, "cargo test --target-dir ../../../target {no_fail_fast...} {jobs...} -- {test_threads...}"),
48
"Compiler errors of the Reflect compile fail tests seem to be different than expected! Check locally and compare rust versions.",
49
)
50
.with_subdir("crates/bevy_reflect/compile_fail"),
51
);
52
53
commands
54
}
55
}
56
57