diff --git a/crates/libtest-json/event.schema.json b/crates/libtest-json/event.schema.json index bd3820c..218a358 100644 --- a/crates/libtest-json/event.schema.json +++ b/crates/libtest-json/event.schema.json @@ -44,14 +44,6 @@ "elapsed_s": { "$ref": "#/$defs/Elapsed" }, - "seed": { - "type": [ - "integer", - "null" - ], - "format": "uint64", - "minimum": 0 - }, "event": { "type": "string", "const": "discover-complete" diff --git a/crates/libtest-json/src/event.rs b/crates/libtest-json/src/event.rs index 251ee14..7925d22 100644 --- a/crates/libtest-json/src/event.rs +++ b/crates/libtest-json/src/event.rs @@ -13,7 +13,6 @@ pub enum Event { DiscoverComplete { #[allow(dead_code)] elapsed_s: Elapsed, - seed: Option, }, SuiteStart, CaseStart { diff --git a/crates/libtest-lexarg/src/lib.rs b/crates/libtest-lexarg/src/lib.rs index 99e686c..631086d 100644 --- a/crates/libtest-lexarg/src/lib.rs +++ b/crates/libtest-lexarg/src/lib.rs @@ -24,19 +24,14 @@ pub struct TestOpts { pub list: bool, pub filters: Vec, pub filter_exact: bool, - pub force_run_in_process: bool, - pub exclude_should_panic: bool, pub run_ignored: RunIgnored, pub run_tests: bool, pub bench_benchmarks: bool, pub nocapture: bool, pub color: ColorConfig, pub format: OutputFormat, - pub shuffle: bool, - pub shuffle_seed: Option, pub test_threads: Option, pub skip: Vec, - pub time_options: Option, /// Stop at first failing test. /// May run a few more tests due to threading, but will /// abort as soon as possible. @@ -83,8 +78,6 @@ pub enum OutputFormat { Terse, /// JSON output Json, - /// JUnit output - Junit, } impl Default for OutputFormat { @@ -93,90 +86,6 @@ impl Default for OutputFormat { } } -/// Structure with parameters for calculating test execution time (see [`TestOpts::time_options`]) -#[derive(Copy, Clone, Debug, PartialEq, Eq)] -pub struct TestTimeOptions { - /// Denotes if the test critical execution time limit excess should be considered - /// a test failure. - pub error_on_excess: bool, - pub unit_threshold: TimeThreshold, - pub integration_threshold: TimeThreshold, - pub doctest_threshold: TimeThreshold, -} - -impl Default for TestTimeOptions { - fn default() -> Self { - Self { - error_on_excess: false, - unit_threshold: TimeThreshold { - warn: std::time::Duration::from_millis(50), - critical: std::time::Duration::from_millis(100), - }, - integration_threshold: TimeThreshold { - warn: std::time::Duration::from_millis(50), - critical: std::time::Duration::from_millis(100), - }, - doctest_threshold: TimeThreshold { - warn: std::time::Duration::from_millis(50), - critical: std::time::Duration::from_millis(100), - }, - } - } -} - -/// Structure denoting time limits for test execution (see [`TestTimeOptions`]) -#[derive(Copy, Clone, Debug, Default, PartialEq, Eq)] -pub struct TimeThreshold { - pub warn: std::time::Duration, - pub critical: std::time::Duration, -} - -impl TimeThreshold { - /// Attempts to create a `TimeThreshold` instance with values obtained - /// from the environment variable, and returns `None` if the variable - /// is not set. - /// Environment variable format is expected to match `\d+,\d+`. - /// - /// # Panics - /// - /// Panics if variable with provided name is set but contains inappropriate - /// value. - fn from_env_var(env_var_name: &str) -> Result, ErrorContext<'static>> { - use std::str::FromStr; - - let durations_str = match std::env::var(env_var_name) { - Ok(value) => value, - Err(_) => { - return Ok(None); - } - }; - let (warn_str, critical_str) = durations_str.split_once(',').ok_or_else(|| { - ErrorContext::msg(format_args!( - "Duration variable {env_var_name} expected to have 2 numbers separated by comma, but got {durations_str}" - )) - })?; - - let parse_u64 = |v| { - u64::from_str(v).map_err(|_err| { - ErrorContext::msg(format_args!( - "Duration value in variable {env_var_name} is expected to be a number, but got {v}" - )) - }) - }; - - let warn = parse_u64(warn_str)?; - let critical = parse_u64(critical_str)?; - if warn > critical { - panic!("Test execution warn time should be less or equal to the critical time"); - } - - Ok(Some(Self { - warn: std::time::Duration::from_millis(warn), - critical: std::time::Duration::from_millis(critical), - })) - } -} - /// Options for the test run defined by the caller (instead of CLI arguments) (see /// [`TestOpts::options`]) /// @@ -194,10 +103,6 @@ Options: --include-ignored Run ignored and not ignored tests --ignored Run only ignored tests - --force-run-in-process - Forces tests to run in-process when panic=abort - --exclude-should-panic - Excludes tests marked as should_panic --test Run tests and not benchmarks --bench Run benchmarks instead of tests --list List all tests and benchmarks @@ -216,12 +121,11 @@ Options: on serially (default); always = always colorize output; never = never colorize output; - --format pretty|terse|json|junit + --format pretty|terse|json Configure formatting of output: pretty = Print verbose output; terse = Display one character per test; json = Output a json document; - junit = Output a JUnit document --show-output Show captured stdout of successful tests -Z unstable-options Enable nightly-only flags: unstable-options = Allow use of experimental features @@ -247,10 +151,6 @@ Options: `VARIABLE=WARN_TIME,CRITICAL_TIME`. `CRITICAL_TIME` here means the limit that should not be exceeded by test. - --shuffle Run tests in random order - --shuffle-seed SEED - Run tests in random order; seed the random number - generator with SEED "#; pub const AFTER_HELP: &str = r#" @@ -262,12 +162,6 @@ By default, all tests are run in parallel. This can be altered with the --test-threads flag or the RUST_TEST_THREADS environment variable when running tests (set it to 1). -By default, the tests are run in alphabetical order. Use --shuffle or set -RUST_TEST_SHUFFLE to run the tests in random order. Pass the generated -"shuffle seed" to --shuffle-seed (or set RUST_TEST_SHUFFLE_SEED) to run the -tests in the same order again. Note that --shuffle and --shuffle-seed do not -affect whether the tests are run in parallel. - All tests have their standard output and standard error captured by default. This can be overridden with the --nocapture flag or setting RUST_TEST_NOCAPTURE environment variable to a value other than "0". Logging is not captured by default. @@ -318,12 +212,6 @@ impl TestOptsBuilder { self.include_ignored = true; } Long("ignored") => self.ignored = true, - Long("force-run-in-process") => { - self.opts.force_run_in_process = true; - } - Long("exclude-should-panic") => { - self.opts.exclude_should_panic = true; - } Long("test") => { self.opts.run_tests = true; } @@ -377,13 +265,12 @@ impl TestOptsBuilder { let format = parser .next_flag_value() .ok_or_missing(Value(std::ffi::OsStr::new("FORMAT"))) - .one_of(&["pretty", "terse", "json", "junit"]) + .one_of(&["pretty", "terse", "json"]) .within(arg)?; self.format = Some(match format { "pretty" => OutputFormat::Pretty, "terse" => OutputFormat::Terse, "json" => OutputFormat::Json, - "junit" => OutputFormat::Junit, _ => unreachable!("`one_of` should prevent this"), }); } @@ -402,34 +289,6 @@ impl TestOptsBuilder { // Don't validate `feature` as other parsers might provide values self.opts.allowed_unstable.push(feature.to_owned()); } - Long("report-time") => { - self.opts.time_options.get_or_insert_with(Default::default); - } - Long("ensure-time") => { - let time = self.opts.time_options.get_or_insert_with(Default::default); - time.error_on_excess = true; - if let Some(threshold) = TimeThreshold::from_env_var("RUST_TEST_TIME_UNIT")? { - time.unit_threshold = threshold; - } - if let Some(threshold) = TimeThreshold::from_env_var("RUST_TEST_TIME_INTEGRATION")? - { - time.integration_threshold = threshold; - } - if let Some(threshold) = TimeThreshold::from_env_var("RUST_TEST_TIME_DOCTEST")? { - time.doctest_threshold = threshold; - } - } - Long("shuffle") => { - self.opts.shuffle = true; - } - Long("shuffle-seed") => { - let seed = parser - .next_flag_value() - .ok_or_missing(Value(std::ffi::OsStr::new("SEED"))) - .parse() - .within(arg)?; - self.opts.shuffle_seed = Some(seed); - } Value(filter) => { let filter = filter.string("FILTER")?; self.opts.filters.push(filter.to_owned()); @@ -449,49 +308,6 @@ impl TestOptsBuilder { .iter() .any(|f| f == UNSTABLE_OPTIONS); - if self.opts.force_run_in_process && !allow_unstable_options { - return Err(ErrorContext::msg( - "`--force-run-in-process` requires `-Zunstable-options`", - )); - } - - if self.opts.exclude_should_panic && !allow_unstable_options { - return Err(ErrorContext::msg( - "`--exclude-should-panic` requires `-Zunstable-options`", - )); - } - - if self.opts.shuffle && !allow_unstable_options { - return Err(ErrorContext::msg( - "`--shuffle` requires `-Zunstable-options`", - )); - } - if !self.opts.shuffle && allow_unstable_options { - self.opts.shuffle = match std::env::var("RUST_TEST_SHUFFLE") { - Ok(val) => &val != "0", - Err(_) => false, - }; - } - - if self.opts.shuffle_seed.is_some() && !allow_unstable_options { - return Err(ErrorContext::msg( - "`--shuffle-seed` requires `-Zunstable-options`", - )); - } - if self.opts.shuffle_seed.is_none() && allow_unstable_options { - self.opts.shuffle_seed = match std::env::var("RUST_TEST_SHUFFLE_SEED") { - Ok(val) => match val.parse::() { - Ok(n) => Some(n), - Err(_) => { - return Err(ErrorContext::msg( - "RUST_TEST_SHUFFLE_SEED is `{val}`, should be a number.", - )); - } - }, - Err(_) => None, - }; - } - if !self.opts.nocapture { self.opts.nocapture = match std::env::var("RUST_TEST_NOCAPTURE") { Ok(val) => &val != "0", diff --git a/crates/libtest2-harness/Cargo.toml b/crates/libtest2-harness/Cargo.toml index deee49c..fd93203 100644 --- a/crates/libtest2-harness/Cargo.toml +++ b/crates/libtest2-harness/Cargo.toml @@ -27,7 +27,6 @@ pre-release-replacements = [ default = [] color = ["dep:anstream", "dep:anstyle"] json = ["libtest-json/serde", "dep:serde", "dep:serde_json"] -junit = [] threads = [] [dependencies] diff --git a/crates/libtest2-harness/src/harness.rs b/crates/libtest2-harness/src/harness.rs index 352ed7d..6b4cc0e 100644 --- a/crates/libtest2-harness/src/harness.rs +++ b/crates/libtest2-harness/src/harness.rs @@ -1,6 +1,6 @@ use libtest_lexarg::OutputFormat; -use crate::{cli, notify, shuffle, Case, RunError, RunMode, State}; +use crate::{cli, notify, Case, RunError, RunMode, State}; pub struct Harness { raw: Vec, @@ -149,15 +149,6 @@ fn notifier(opts: &libtest_lexarg::TestOpts) -> std::io::Result Box::new(notify::TerseListNotifier::new(stdout)), OutputFormat::Pretty => Box::new(notify::PrettyRunNotifier::new(stdout)), OutputFormat::Terse => Box::new(notify::TerseRunNotifier::new(stdout)), - #[cfg(feature = "junit")] - OutputFormat::Junit => Box::new(notify::JunitRunNotifier::new(stdout)), - #[cfg(not(feature = "junit"))] - OutputFormat::Junit => { - return Err(std::io::Error::new( - std::io::ErrorKind::Other, - "`--format=junit` is not supported", - )); - } }; Ok(notifier) } @@ -172,10 +163,6 @@ fn discover( // Do this first so it applies to both discover and running cases.sort_unstable_by_key(|case| case.name().to_owned()); - let seed = shuffle::get_shuffle_seed(opts); - if let Some(seed) = seed { - shuffle::shuffle_tests(seed, cases); - } let matches_filter = |case: &dyn Case, filter: &str| { let test_name = case.name(); @@ -207,7 +194,6 @@ fn discover( notifier.notify(notify::Event::DiscoverComplete { elapsed_s: notify::Elapsed(timer.elapsed()), - seed, })?; Ok(()) @@ -221,18 +207,9 @@ fn run( notifier.notify(notify::Event::SuiteStart)?; let timer = std::time::Instant::now(); - if opts.force_run_in_process { - todo!("`--force-run-in-process` is not yet supported"); - } - if opts.exclude_should_panic { - todo!("`--exclude-should-panic` is not yet supported"); - } if opts.nocapture { todo!("`--nocapture` is not yet supported"); } - if opts.time_options.is_some() { - todo!("`--report-time` / `--ensure-time` are not yet supported"); - } if opts.options.display_output { todo!("`--show-output` is not yet supported"); } diff --git a/crates/libtest2-harness/src/lib.rs b/crates/libtest2-harness/src/lib.rs index dc6ffe8..6f3bd0c 100644 --- a/crates/libtest2-harness/src/lib.rs +++ b/crates/libtest2-harness/src/lib.rs @@ -28,7 +28,6 @@ mod case; mod harness; mod notify; -mod shuffle; mod state; pub mod cli; diff --git a/crates/libtest2-harness/src/notify/junit.rs b/crates/libtest2-harness/src/notify/junit.rs deleted file mode 100644 index de8dbf7..0000000 --- a/crates/libtest2-harness/src/notify/junit.rs +++ /dev/null @@ -1,121 +0,0 @@ -use super::Event; -use super::RunStatus; - -#[derive(Debug)] -pub(crate) struct JunitRunNotifier { - writer: W, - events: Vec, -} - -impl JunitRunNotifier { - pub(crate) fn new(writer: W) -> Self { - Self { - writer, - events: Vec::new(), - } - } -} - -impl super::Notifier for JunitRunNotifier { - fn notify(&mut self, event: Event) -> std::io::Result<()> { - let finished = matches!(&event, Event::SuiteComplete { .. }); - self.events.push(event); - if finished { - let mut num_run = 0; - let mut num_failed = 0; - let mut num_ignored = 0; - for event in &self.events { - match event { - Event::DiscoverStart => {} - Event::DiscoverCase { run, .. } => { - if *run { - num_run += 1; - } - } - Event::DiscoverComplete { .. } => {} - Event::SuiteStart => {} - Event::CaseStart { .. } => {} - Event::CaseComplete { status, .. } => match status { - Some(RunStatus::Ignored) => { - num_ignored += 1; - } - Some(RunStatus::Failed) => { - num_failed += 1; - } - None => {} - }, - Event::SuiteComplete { .. } => {} - } - } - - writeln!(self.writer, "")?; - writeln!(self.writer, "")?; - - writeln!( - self.writer, - "" - )?; - for event in std::mem::take(&mut self.events) { - if let Event::CaseComplete { - name, - status, - message, - elapsed_s, - .. - } = event - { - let (class_name, test_name) = parse_class_name(&name); - let elapsed_s = elapsed_s.unwrap_or_default(); - match status { - Some(RunStatus::Ignored) => {} - Some(RunStatus::Failed) => { - writeln!( - self.writer, - "", - )?; - if let Some(message) = message { - writeln!( - self.writer, - "" - )?; - } else { - writeln!(self.writer, "")?; - } - writeln!(self.writer, "")?; - } - None => { - writeln!( - self.writer, - "", - )?; - } - } - } - } - writeln!(self.writer, "")?; - writeln!(self.writer, "")?; - writeln!(self.writer, "")?; - writeln!(self.writer, "")?; - } - Ok(()) - } -} - -fn parse_class_name(name: &str) -> (String, String) { - // Module path => classname - // Function name => name - let module_segments: Vec<&str> = name.split("::").collect(); - let (class_name, test_name) = match module_segments[..] { - [test] => (String::from("crate"), String::from(test)), - [ref path @ .., test] => (path.join("::"), String::from(test)), - [..] => unreachable!(), - }; - (class_name, test_name) -} diff --git a/crates/libtest2-harness/src/notify/mod.rs b/crates/libtest2-harness/src/notify/mod.rs index b8d39c7..c74930d 100644 --- a/crates/libtest2-harness/src/notify/mod.rs +++ b/crates/libtest2-harness/src/notify/mod.rs @@ -1,7 +1,5 @@ #[cfg(feature = "json")] mod json; -#[cfg(feature = "junit")] -mod junit; #[cfg(not(feature = "color"))] mod no_style; mod pretty; @@ -12,8 +10,6 @@ mod terse; #[cfg(feature = "json")] pub(crate) use json::*; -#[cfg(feature = "junit")] -pub(crate) use junit::*; #[cfg(not(feature = "color"))] pub(crate) use no_style::*; pub(crate) use pretty::*; diff --git a/crates/libtest2-harness/src/notify/summary.rs b/crates/libtest2-harness/src/notify/summary.rs index caa65ef..4f72aa9 100644 --- a/crates/libtest2-harness/src/notify/summary.rs +++ b/crates/libtest2-harness/src/notify/summary.rs @@ -5,7 +5,6 @@ use super::OK; #[derive(Default, Clone, Debug)] pub(crate) struct Summary { - pub(crate) seed: Option, pub(crate) failures: std::collections::BTreeMap>, pub(crate) elapsed_s: super::Elapsed, @@ -29,13 +28,9 @@ impl Summary { pub(crate) fn write_start(&self, writer: &mut dyn std::io::Write) -> std::io::Result<()> { let s = if self.num_run == 1 { "" } else { "s" }; - let seed = self - .seed - .map(|s| format!(" (shuffle seed: {s})")) - .unwrap_or_default(); writeln!(writer)?; - writeln!(writer, "running {} test{s}{seed}", self.num_run)?; + writeln!(writer, "running {} test{s}", self.num_run)?; Ok(()) } @@ -95,9 +90,7 @@ impl super::Notifier for Summary { self.num_filtered_out += 1; } } - Event::DiscoverComplete { seed, .. } => { - self.seed = seed; - } + Event::DiscoverComplete { .. } => {} Event::SuiteStart => {} Event::CaseStart { .. } => {} Event::CaseComplete { diff --git a/crates/libtest2-harness/src/shuffle.rs b/crates/libtest2-harness/src/shuffle.rs deleted file mode 100644 index 444e664..0000000 --- a/crates/libtest2-harness/src/shuffle.rs +++ /dev/null @@ -1,63 +0,0 @@ -use std::collections::hash_map::DefaultHasher; -use std::hash::Hasher; -use std::time::{SystemTime, UNIX_EPOCH}; - -use crate::Case; - -pub(crate) fn get_shuffle_seed(opts: &libtest_lexarg::TestOpts) -> Option { - opts.shuffle_seed.or_else(|| { - opts.shuffle.then(|| { - SystemTime::now() - .duration_since(UNIX_EPOCH) - .expect("Failed to get system time") - .as_nanos() as u64 - }) - }) -} - -pub(crate) fn shuffle_tests(shuffle_seed: u64, tests: &mut [Box]) { - let test_names: Vec<&str> = tests.iter().map(|test| test.name()).collect(); - let test_names_hash = calculate_hash(&test_names); - let mut rng = Rng::new(shuffle_seed, test_names_hash); - shuffle(&mut rng, tests); -} - -// `shuffle` is from `rust-analyzer/src/cli/analysis_stats.rs`. -fn shuffle(rng: &mut Rng, slice: &mut [T]) { - for i in 0..slice.len() { - randomize_first(rng, &mut slice[i..]); - } - - fn randomize_first(rng: &mut Rng, slice: &mut [T]) { - assert!(!slice.is_empty()); - let idx = rng.rand_range(0..slice.len() as u64) as usize; - slice.swap(0, idx); - } -} - -struct Rng { - state: u64, - extra: u64, -} - -impl Rng { - fn new(seed: u64, extra: u64) -> Self { - Self { state: seed, extra } - } - - fn rand_range(&mut self, range: core::ops::Range) -> u64 { - self.rand_u64() % (range.end - range.start) + range.start - } - - fn rand_u64(&mut self) -> u64 { - self.state = calculate_hash(&(self.state, self.extra)); - self.state - } -} - -// `calculate_hash` is from `core/src/hash/mod.rs`. -fn calculate_hash(t: &T) -> u64 { - let mut s = DefaultHasher::new(); - t.hash(&mut s); - s.finish() -} diff --git a/crates/libtest2-mimic/Cargo.toml b/crates/libtest2-mimic/Cargo.toml index eefac8d..6e03675 100644 --- a/crates/libtest2-mimic/Cargo.toml +++ b/crates/libtest2-mimic/Cargo.toml @@ -24,10 +24,9 @@ pre-release-replacements = [ ] [features] -default = ["color", "json", "junit", "threads"] +default = ["color", "json", "threads"] color = ["libtest2-harness/color"] json = ["libtest2-harness/json"] -junit = ["libtest2-harness/junit"] threads = ["libtest2-harness/threads"] [dependencies] diff --git a/crates/libtest2-mimic/tests/testsuite/mixed_bag.rs b/crates/libtest2-mimic/tests/testsuite/mixed_bag.rs index 2957af9..9f90376 100644 --- a/crates/libtest2-mimic/tests/testsuite/mixed_bag.rs +++ b/crates/libtest2-mimic/tests/testsuite/mixed_bag.rs @@ -629,7 +629,7 @@ fn list_json() { {"event":"discover-case","name":"fox","mode":"test","run":false} {"event":"discover-case","name":"frog","mode":"test","run":false} {"event":"discover-case","name":"owl","mode":"test","run":false} -{"event":"discover-complete","elapsed_s":"[..]","seed":null} +{"event":"discover-complete","elapsed_s":"[..]"} "#, r#"{"event":"discover-start"} {"event":"discover-case","name":"bear","mode":"test","run":true} @@ -640,7 +640,7 @@ fn list_json() { {"event":"discover-case","name":"fox","mode":"test","run":false} {"event":"discover-case","name":"frog","mode":"test","run":false} {"event":"discover-case","name":"owl","mode":"test","run":false} -{"event":"discover-complete","elapsed_s":"[..]","seed":null} +{"event":"discover-complete","elapsed_s":"[..]"} "#, ); } @@ -660,7 +660,7 @@ fn test_json() { {"event":"discover-case","name":"fox","mode":"test","run":false} {"event":"discover-case","name":"frog","mode":"test","run":false} {"event":"discover-case","name":"owl","mode":"test","run":false} -{"event":"discover-complete","elapsed_s":"[..]","seed":null} +{"event":"discover-complete","elapsed_s":"[..]"} {"event":"suite-start"} {"event":"case-start","name":"bear"} {"event":"case-complete","name":"bear","mode":"test","status":"ignored","message":"fails","elapsed_s":"[..]"} @@ -677,7 +677,7 @@ fn test_json() { {"event":"discover-case","name":"fox","mode":"test","run":false} {"event":"discover-case","name":"frog","mode":"test","run":false} {"event":"discover-case","name":"owl","mode":"test","run":false} -{"event":"discover-complete","elapsed_s":"[..]","seed":null} +{"event":"discover-complete","elapsed_s":"[..]"} {"event":"suite-start"} [..] [..] @@ -688,54 +688,6 @@ fn test_json() { ); } -#[test] -#[cfg(feature = "junit")] -fn list_junit() { - check( - &["-Zunstable-options", "--format=junit", "--list", "a"], - 0, - r#"bear: test -cat: test - -2 tests - -"#, - r#"bear: test -cat: test - -2 tests - -"#, - ); -} - -#[test] -#[cfg(feature = "junit")] -fn test_junit() { - check( - &["-Zunstable-options", "--format=junit", "a"], - 0, - r#" - - - - - - - -"#, - r#" - - - - - - - -"#, - ); -} - #[test] fn terse_output() { check( @@ -773,63 +725,3 @@ test result: FAILED. 2 passed; 1 failed; 5 ignored; 0 filtered out; finished in "#, ); } - -#[test] -fn shuffle() { - check( - &["-Zunstable-options", "--list", "--shuffle-seed=1"], - 0, - r#"fox: test -cat: test -fly: test -bear: test -owl: test -frog: test -bunny: test -dog: test - -8 tests - -"#, - r#"fox: test -cat: test -fly: test -bear: test -owl: test -frog: test -bunny: test -dog: test - -8 tests - -"#, - ); - check( - &["-Zunstable-options", "--list", "--shuffle-seed=2"], - 0, - r#"owl: test -dog: test -fox: test -frog: test -bear: test -fly: test -bunny: test -cat: test - -8 tests - -"#, - r#"owl: test -dog: test -fox: test -frog: test -bear: test -fly: test -bunny: test -cat: test - -8 tests - -"#, - ); -} diff --git a/crates/libtest2/Cargo.toml b/crates/libtest2/Cargo.toml index 23402e5..ca33579 100644 --- a/crates/libtest2/Cargo.toml +++ b/crates/libtest2/Cargo.toml @@ -24,10 +24,9 @@ pre-release-replacements = [ ] [features] -default = ["color", "json", "junit", "threads"] +default = ["color", "json", "threads"] color = ["libtest2-harness/color"] json = ["libtest2-harness/json"] -junit = ["libtest2-harness/junit"] threads = ["libtest2-harness/threads"] [dependencies] diff --git a/crates/libtest2/tests/testsuite/mixed_bag.rs b/crates/libtest2/tests/testsuite/mixed_bag.rs index 82ccf52..c845b76 100644 --- a/crates/libtest2/tests/testsuite/mixed_bag.rs +++ b/crates/libtest2/tests/testsuite/mixed_bag.rs @@ -636,7 +636,7 @@ fn list_json() { {"event":"discover-case","name":"fox","mode":"test","run":false} {"event":"discover-case","name":"frog","mode":"test","run":false} {"event":"discover-case","name":"owl","mode":"test","run":false} -{"event":"discover-complete","elapsed_s":"[..]","seed":null} +{"event":"discover-complete","elapsed_s":"[..]"} "#, r#"{"event":"discover-start"} {"event":"discover-case","name":"bear","mode":"test","run":true} @@ -647,7 +647,7 @@ fn list_json() { {"event":"discover-case","name":"fox","mode":"test","run":false} {"event":"discover-case","name":"frog","mode":"test","run":false} {"event":"discover-case","name":"owl","mode":"test","run":false} -{"event":"discover-complete","elapsed_s":"[..]","seed":null} +{"event":"discover-complete","elapsed_s":"[..]"} "#, ); } @@ -667,7 +667,7 @@ fn test_json() { {"event":"discover-case","name":"fox","mode":"test","run":false} {"event":"discover-case","name":"frog","mode":"test","run":false} {"event":"discover-case","name":"owl","mode":"test","run":false} -{"event":"discover-complete","elapsed_s":"[..]","seed":null} +{"event":"discover-complete","elapsed_s":"[..]"} {"event":"suite-start"} {"event":"case-start","name":"bear"} {"event":"case-complete","name":"bear","mode":"test","status":"ignored","message":"fails","elapsed_s":"[..]"} @@ -684,7 +684,7 @@ fn test_json() { {"event":"discover-case","name":"fox","mode":"test","run":false} {"event":"discover-case","name":"frog","mode":"test","run":false} {"event":"discover-case","name":"owl","mode":"test","run":false} -{"event":"discover-complete","elapsed_s":"[..]","seed":null} +{"event":"discover-complete","elapsed_s":"[..]"} {"event":"suite-start"} [..] [..] @@ -695,54 +695,6 @@ fn test_json() { ); } -#[test] -#[cfg(feature = "junit")] -fn list_junit() { - check( - &["-Zunstable-options", "--format=junit", "--list", "a"], - 0, - r#"bear: test -cat: test - -2 tests - -"#, - r#"bear: test -cat: test - -2 tests - -"#, - ); -} - -#[test] -#[cfg(feature = "junit")] -fn test_junit() { - check( - &["-Zunstable-options", "--format=junit", "a"], - 0, - r#" - - - - - - - -"#, - r#" - - - - - - - -"#, - ); -} - #[test] fn terse_output() { check( @@ -780,63 +732,3 @@ test result: FAILED. 2 passed; 1 failed; 5 ignored; 0 filtered out; finished in "#, ); } - -#[test] -fn shuffle() { - check( - &["-Zunstable-options", "--list", "--shuffle-seed=1"], - 0, - r#"fox: test -cat: test -fly: test -bear: test -owl: test -frog: test -bunny: test -dog: test - -8 tests - -"#, - r#"fox: test -cat: test -fly: test -bear: test -owl: test -frog: test -bunny: test -dog: test - -8 tests - -"#, - ); - check( - &["-Zunstable-options", "--list", "--shuffle-seed=2"], - 0, - r#"owl: test -dog: test -fox: test -frog: test -bear: test -fly: test -bunny: test -cat: test - -8 tests - -"#, - r#"owl: test -dog: test -fox: test -frog: test -bear: test -fly: test -bunny: test -cat: test - -8 tests - -"#, - ); -}