Skip to content

Commit

Permalink
Update ui_test dependency to newest version (0.29.0)
Browse files Browse the repository at this point in the history
  • Loading branch information
Brezak committed Mar 1, 2025
1 parent 73ffd9a commit b305f82
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 18 deletions.
4 changes: 2 additions & 2 deletions tools/ci/src/commands/compile_fail.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ impl Prepare for CompileFailCommand {

// Macro Compile Fail Tests
// Run tests (they do not get executed with the workspace tests)
// - See crates/bevy_macros_compile_fail_tests/README.md
// - See crates/bevy_derive/compile_fail/README.md
commands.push(
PreparedCommand::new::<Self>(
cmd!(sh, "cargo test --target-dir ../../../target {no_fail_fast}"),
Expand All @@ -29,7 +29,7 @@ impl Prepare for CompileFailCommand {

// ECS Compile Fail Tests
// Run UI tests (they do not get executed with the workspace tests)
// - See crates/bevy_ecs_compile_fail_tests/README.md
// - See crates/bevy_ec/compile_fail/README.md
commands.push(
PreparedCommand::new::<Self>(
cmd!(sh, "cargo test --target-dir ../../../target {no_fail_fast}"),
Expand Down
2 changes: 1 addition & 1 deletion tools/compile_fail_utils/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ license = "MIT OR Apache-2.0"
publish = false

[dependencies]
ui_test = "0.23.0"
ui_test = "0.29.0"

[[test]]
name = "example"
Expand Down
35 changes: 20 additions & 15 deletions tools/compile_fail_utils/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ use ui_test::{
run_tests_generic,
spanned::Spanned,
status_emitter::{Gha, StatusEmitter, Text},
Args, Config, OutputConflictHandling,
Args, Config,
};

/// Use this instead of hand rolling configs.
Expand Down Expand Up @@ -44,30 +44,35 @@ fn basic_config(root_dir: impl Into<PathBuf>, args: &Args) -> ui_test::Result<Co
.to_string(),
),
output_conflict_handling: if env::var_os("BLESS").is_some() {
OutputConflictHandling::Bless
ui_test::bless_output_files
} else {
// stderr output changes between rust versions so we just rely on annotations
OutputConflictHandling::Ignore
ui_test::error_on_output_conflict
},
..Config::rustc(root_dir)
};

config.with_args(args);

// Window paths (cargo should already be doing this, but just in case).
config.stderr_filter(r"\\", "/");
// Replace line and column numbers (regex patterns shamelessly stolen from miri).
config.stderr_filter(r"\.rs:[0-9]+:[0-9]+(: [0-9]+:[0-9]+)?", ".rs:LL:CC");
// Replace stdlib path (stolen from miri again).
config.stderr_filter(
r"[^ \n`]*/(?:rust[^/]*|checkout|[0-9a-fA-F]*)/library/",
"RUSTLIB/",
);
// Replace long type file names since they contain random numbers
config.stderr_filter(r"[\p{L}\p{N}_]+\.long-type-\d+\.txt", "long-type.sr'");
// The number of spaces in diagnostics isn't consistent across platforms
config.stderr_filter(r"\n +-->", "\n -->");
config.stderr_filter(r"\n\d+ +\|", "\nLL |");
config.stderr_filter(r"\n +\|", "\n |");

let bevy_root = "..";

// Don't leak contributor filesystem paths
config.path_stderr_filter(Path::new(bevy_root), b"$BEVY_ROOT");
config.path_stderr_filter(Path::new(env!("RUSTUP_HOME")), b"$RUSTUP_HOME");

// ui_test doesn't compile regex with perl character classes.
// \pL = unicode class for letters, \pN = unicode class for numbers
config.stderr_filter(r"\/home\/[\pL\pN_@#\-\. ]+", "$HOME");
// Paths in .stderr seem to always be normalized to use /. Handle both anyway.
config.stderr_filter(
r"[a-zA-Z]:(?:\\|\/)users(?:\\|\/)[\pL\pN_@#\-\. ]+", // NOTE: [\pL\pN_@#\-\. ] is a poor attempt at handling usernames
"$HOME",
);
config.path_stderr_filter(Path::new(bevy_root), b"BEVY_ROOT");

// Manually insert @aux-build:<dep> comments into test files. This needs to
// be done to build and link dependencies. Dependencies will be pulled from a
Expand Down

0 comments on commit b305f82

Please sign in to comment.