Skip to content

Commit 3cb12b4

Browse files
authored
Merge pull request #283 from oli-obk/miri
Various changes needed for miri
2 parents 71a3fa8 + d84336e commit 3cb12b4

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

55 files changed

+1658
-1297
lines changed

CHANGELOG.md

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,26 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1313

1414
### Changed
1515

16+
## [0.27.0] - 2024-10-07
17+
18+
### Added
19+
20+
* debug status emitter for when you have problems with ui_test
21+
* cargo features to disable gha or CLI refreshing
22+
23+
### Fixed
24+
25+
* CLI refreshing is now reliable and not leaving around fragments
26+
* Can run multiple `Config`s that test the same files in parallel.
27+
28+
### Changed
29+
1630
* `only`/`ignore` filters now only accept integers, alphabetic characters, `-` and `_`
1731
* `only`/ `ignore` filters allow comments by ignoring everything from an `#` onwards
32+
* `OutputConflictHandling` has been replaced by `error_on_output_conflict`, `bless_output_files`,
33+
and `ignore_output_conflict` functions. Custom functions can now be used to implement special
34+
handling of output conflicts.
35+
* `Run` now forwards env vars passed to the compiler to the executable, too
1836

1937
### Removed
2038

Cargo.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "ui_test"
3-
version = "0.26.5"
3+
version = "0.27.0"
44
edition = "2021"
55
license = "MIT OR Apache-2.0"
66
description = "A test framework for testing rustc diagnostics output"
@@ -23,7 +23,7 @@ rustfix = "0.8.1"
2323
cargo-platform = { version = "0.1.2", optional = true }
2424
comma = "1.0.0"
2525
anyhow = "1.0.6"
26-
indicatif = "0.17.6"
26+
indicatif = { version = "0.17.6", optional = true }
2727
prettydiff = { version = "0.7", default-features = false }
2828
annotate-snippets = { version = "0.11.2" }
2929
levenshtein = "1.0.5"
@@ -52,5 +52,6 @@ name = "build_std"
5252
test = false
5353

5454
[features]
55-
default = ["rustc"]
55+
default = ["rustc", "indicatif", "gha"]
56+
gha = []
5657
rustc = ["dep:cargo-platform", "dep:cargo_metadata"]

examples/rustc_basic.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ use std::sync::atomic::Ordering;
44
use ui_test::{run_tests, Config};
55

66
#[cfg(feature = "rustc")]
7+
#[cfg_attr(test, test)]
78
fn main() -> ui_test::color_eyre::Result<()> {
89
let config = Config::rustc("examples_tests/rustc_basic");
910
let abort_check = config.abort_check.clone();
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
#[cfg(feature = "rustc")]
2+
use std::sync::atomic::Ordering;
3+
#[cfg(feature = "rustc")]
4+
use ui_test::{
5+
default_file_filter, default_per_file_config, run_tests_generic, status_emitter, Config,
6+
};
7+
8+
#[cfg(feature = "rustc")]
9+
#[cfg_attr(test, test)]
10+
fn main() -> ui_test::color_eyre::Result<()> {
11+
let config = Config::rustc("examples_tests/rustc_basic");
12+
let abort_check = config.abort_check.clone();
13+
ctrlc::set_handler(move || abort_check.store(true, Ordering::Relaxed))?;
14+
15+
// Compile all `.rs` files in the given directory (relative to your
16+
// Cargo.toml) and compare their output against the corresponding
17+
// `.stderr` files.
18+
run_tests_generic(
19+
vec![config.clone(), config],
20+
default_file_filter,
21+
default_per_file_config,
22+
status_emitter::Text::verbose(),
23+
)
24+
}
25+
26+
#[cfg(not(feature = "rustc"))]
27+
fn main() -> ui_test::color_eyre::Result<()> {
28+
Ok(())
29+
}

examples_tests/rustc_basic/aux_derive.stderr

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,12 +20,14 @@ error[E0384]: cannot assign twice to immutable variable `x`
2020
--> examples_tests/rustc_basic/aux_derive.rs:8:5
2121
|
2222
7 | let x = Foo;
23-
| -
24-
| |
25-
| first assignment to `x`
26-
| help: consider making this binding mutable: `mut x`
23+
| - first assignment to `x`
2724
8 | x = Foo;
2825
| ^^^^^^^ cannot assign twice to immutable variable
26+
|
27+
help: consider making this binding mutable
28+
|
29+
7 | let mut x = Foo;
30+
| +++
2931

3032
error: aborting due to 1 previous error; 2 warnings emitted
3133

examples_tests/rustc_basic/executable.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
//@run
2+
//@revisions: a b c d e f g h i j k l m n
23

34
fn main() {
45
std::thread::sleep(std::time::Duration::from_secs(5));

examples_tests/rustc_basic/filtered_out.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
//@[foo] only-target-asdfasdf
1+
//@[foo] only-target: asdfasdf
22

33
//@ revisions: foo bar
44

src/aux_builds.rs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,6 @@
11
//! Everything needed to build auxilary files with rustc
22
// lol we can't name this file `aux.rs` on windows
33

4-
use bstr::ByteSlice;
5-
use spanned::Spanned;
6-
use std::{ffi::OsString, path::PathBuf, process::Command, sync::Arc};
7-
84
use crate::{
95
build_manager::{Build, BuildManager},
106
custom_flags::Flag,
@@ -13,6 +9,9 @@ use crate::{
139
status_emitter::SilentStatus,
1410
CrateType, Error, Errored,
1511
};
12+
use bstr::ByteSlice;
13+
use spanned::Spanned;
14+
use std::{ffi::OsString, path::PathBuf, process::Command, sync::Arc};
1615

1716
impl Flag for AuxBuilder {
1817
fn must_be_unique(&self) -> bool {

src/build_manager.rs

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,17 @@
11
//! Auxiliary and dependency builder. Extendable to custom builds.
22
3-
use std::{
4-
collections::{hash_map::Entry, HashMap},
5-
ffi::OsString,
6-
sync::{Arc, OnceLock, RwLock},
7-
};
8-
9-
use color_eyre::eyre::Result;
10-
use crossbeam_channel::{bounded, Sender};
11-
123
use crate::{
134
status_emitter::{RevisionStyle, TestStatus},
145
test_result::TestRun,
156
Config, Errored,
167
};
8+
use color_eyre::eyre::Result;
9+
use crossbeam_channel::{bounded, Sender};
10+
use std::{
11+
collections::{hash_map::Entry, HashMap},
12+
ffi::OsString,
13+
sync::{Arc, OnceLock, RwLock},
14+
};
1715

1816
/// A build shared between all tests of the same `BuildManager`
1917
pub trait Build {

0 commit comments

Comments
 (0)