summaryrefslogtreecommitdiffstats
path: root/library/test
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-17 12:20:29 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-17 12:20:29 +0000
commit631cd5845e8de329d0e227aaa707d7ea228b8f8f (patch)
treea1b87c8f8cad01cf18f7c5f57a08f102771ed303 /library/test
parentAdding debian version 1.69.0+dfsg1-1. (diff)
downloadrustc-631cd5845e8de329d0e227aaa707d7ea228b8f8f.tar.xz
rustc-631cd5845e8de329d0e227aaa707d7ea228b8f8f.zip
Merging upstream version 1.70.0+dfsg1.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'library/test')
-rw-r--r--library/test/src/console.rs83
-rw-r--r--library/test/src/formatters/json.rs52
-rw-r--r--library/test/src/formatters/junit.rs14
-rw-r--r--library/test/src/formatters/mod.rs6
-rw-r--r--library/test/src/formatters/pretty.rs29
-rw-r--r--library/test/src/formatters/terse.rs14
-rw-r--r--library/test/src/lib.rs11
-rw-r--r--library/test/src/tests.rs200
-rw-r--r--library/test/src/types.rs10
9 files changed, 382 insertions, 37 deletions
diff --git a/library/test/src/console.rs b/library/test/src/console.rs
index 1ee68c854..7eee4ca23 100644
--- a/library/test/src/console.rs
+++ b/library/test/src/console.rs
@@ -41,6 +41,46 @@ impl<T: Write> Write for OutputLocation<T> {
}
}
+pub struct ConsoleTestDiscoveryState {
+ pub log_out: Option<File>,
+ pub tests: usize,
+ pub benchmarks: usize,
+ pub ignored: usize,
+ pub options: Options,
+}
+
+impl ConsoleTestDiscoveryState {
+ pub fn new(opts: &TestOpts) -> io::Result<ConsoleTestDiscoveryState> {
+ let log_out = match opts.logfile {
+ Some(ref path) => Some(File::create(path)?),
+ None => None,
+ };
+
+ Ok(ConsoleTestDiscoveryState {
+ log_out,
+ tests: 0,
+ benchmarks: 0,
+ ignored: 0,
+ options: opts.options,
+ })
+ }
+
+ pub fn write_log<F, S>(&mut self, msg: F) -> io::Result<()>
+ where
+ S: AsRef<str>,
+ F: FnOnce() -> S,
+ {
+ match self.log_out {
+ None => Ok(()),
+ Some(ref mut o) => {
+ let msg = msg();
+ let msg = msg.as_ref();
+ o.write_all(msg.as_bytes())
+ }
+ }
+ }
+}
+
pub struct ConsoleTestState {
pub log_out: Option<File>,
pub total: usize,
@@ -138,53 +178,44 @@ impl ConsoleTestState {
// List the tests to console, and optionally to logfile. Filters are honored.
pub fn list_tests_console(opts: &TestOpts, tests: Vec<TestDescAndFn>) -> io::Result<()> {
- let mut output = match term::stdout() {
+ let output = match term::stdout() {
None => OutputLocation::Raw(io::stdout().lock()),
Some(t) => OutputLocation::Pretty(t),
};
- let quiet = opts.format == OutputFormat::Terse;
- let mut st = ConsoleTestState::new(opts)?;
-
- let mut ntest = 0;
- let mut nbench = 0;
+ let mut out: Box<dyn OutputFormatter> = match opts.format {
+ OutputFormat::Pretty | OutputFormat::Junit => {
+ Box::new(PrettyFormatter::new(output, false, 0, false, None))
+ }
+ OutputFormat::Terse => Box::new(TerseFormatter::new(output, false, 0, false)),
+ OutputFormat::Json => Box::new(JsonFormatter::new(output)),
+ };
+ let mut st = ConsoleTestDiscoveryState::new(opts)?;
+ out.write_discovery_start()?;
for test in filter_tests(opts, tests).into_iter() {
use crate::TestFn::*;
- let TestDescAndFn { desc: TestDesc { name, .. }, testfn } = test;
+ let TestDescAndFn { desc, testfn } = test;
let fntype = match testfn {
StaticTestFn(..) | DynTestFn(..) => {
- ntest += 1;
+ st.tests += 1;
"test"
}
StaticBenchFn(..) | DynBenchFn(..) => {
- nbench += 1;
+ st.benchmarks += 1;
"benchmark"
}
};
- writeln!(output, "{name}: {fntype}")?;
- st.write_log(|| format!("{fntype} {name}\n"))?;
- }
+ st.ignored += if desc.ignore { 1 } else { 0 };
- fn plural(count: u32, s: &str) -> String {
- match count {
- 1 => format!("1 {s}"),
- n => format!("{n} {s}s"),
- }
+ out.write_test_discovered(&desc, fntype)?;
+ st.write_log(|| format!("{fntype} {}\n", desc.name))?;
}
- if !quiet {
- if ntest != 0 || nbench != 0 {
- writeln!(output)?;
- }
-
- writeln!(output, "{}, {}", plural(ntest, "test"), plural(nbench, "benchmark"))?;
- }
-
- Ok(())
+ out.write_discovery_finish(&st)
}
// Updates `ConsoleTestState` depending on result of the test execution.
diff --git a/library/test/src/formatters/json.rs b/library/test/src/formatters/json.rs
index 95d2faf25..40976ec5e 100644
--- a/library/test/src/formatters/json.rs
+++ b/library/test/src/formatters/json.rs
@@ -2,7 +2,7 @@ use std::{borrow::Cow, io, io::prelude::Write};
use super::OutputFormatter;
use crate::{
- console::{ConsoleTestState, OutputLocation},
+ console::{ConsoleTestDiscoveryState, ConsoleTestState, OutputLocation},
test_result::TestResult,
time,
types::TestDesc,
@@ -60,6 +60,56 @@ impl<T: Write> JsonFormatter<T> {
}
impl<T: Write> OutputFormatter for JsonFormatter<T> {
+ fn write_discovery_start(&mut self) -> io::Result<()> {
+ self.writeln_message(&format!(r#"{{ "type": "suite", "event": "discovery" }}"#))
+ }
+
+ fn write_test_discovered(&mut self, desc: &TestDesc, test_type: &str) -> io::Result<()> {
+ let TestDesc {
+ name,
+ ignore,
+ ignore_message,
+ #[cfg(not(bootstrap))]
+ source_file,
+ #[cfg(not(bootstrap))]
+ start_line,
+ #[cfg(not(bootstrap))]
+ start_col,
+ #[cfg(not(bootstrap))]
+ end_line,
+ #[cfg(not(bootstrap))]
+ end_col,
+ ..
+ } = desc;
+
+ #[cfg(bootstrap)]
+ let source_file = "";
+ #[cfg(bootstrap)]
+ let start_line = 0;
+ #[cfg(bootstrap)]
+ let start_col = 0;
+ #[cfg(bootstrap)]
+ let end_line = 0;
+ #[cfg(bootstrap)]
+ let end_col = 0;
+
+ self.writeln_message(&format!(
+ r#"{{ "type": "{test_type}", "event": "discovered", "name": "{}", "ignore": {ignore}, "ignore_message": "{}", "source_path": "{}", "start_line": {start_line}, "start_col": {start_col}, "end_line": {end_line}, "end_col": {end_col} }}"#,
+ EscapedString(name.as_slice()),
+ ignore_message.unwrap_or(""),
+ EscapedString(source_file),
+ ))
+ }
+
+ fn write_discovery_finish(&mut self, state: &ConsoleTestDiscoveryState) -> io::Result<()> {
+ let ConsoleTestDiscoveryState { tests, benchmarks, ignored, .. } = state;
+
+ let total = tests + benchmarks;
+ self.writeln_message(&format!(
+ r#"{{ "type": "suite", "event": "completed", "tests": {tests}, "benchmarks": {benchmarks}, "total": {total}, "ignored": {ignored} }}"#
+ ))
+ }
+
fn write_run_start(&mut self, test_count: usize, shuffle_seed: Option<u64>) -> io::Result<()> {
let shuffle_seed_json = if let Some(shuffle_seed) = shuffle_seed {
format!(r#", "shuffle_seed": {shuffle_seed}"#)
diff --git a/library/test/src/formatters/junit.rs b/library/test/src/formatters/junit.rs
index 7a40ce33c..2e07ce3c0 100644
--- a/library/test/src/formatters/junit.rs
+++ b/library/test/src/formatters/junit.rs
@@ -3,7 +3,7 @@ use std::time::Duration;
use super::OutputFormatter;
use crate::{
- console::{ConsoleTestState, OutputLocation},
+ console::{ConsoleTestDiscoveryState, ConsoleTestState, OutputLocation},
test_result::TestResult,
time,
types::{TestDesc, TestType},
@@ -27,6 +27,18 @@ impl<T: Write> JunitFormatter<T> {
}
impl<T: Write> OutputFormatter for JunitFormatter<T> {
+ fn write_discovery_start(&mut self) -> io::Result<()> {
+ Err(io::Error::new(io::ErrorKind::NotFound, "Not yet implemented!"))
+ }
+
+ fn write_test_discovered(&mut self, _desc: &TestDesc, _test_type: &str) -> io::Result<()> {
+ Err(io::Error::new(io::ErrorKind::NotFound, "Not yet implemented!"))
+ }
+
+ fn write_discovery_finish(&mut self, _state: &ConsoleTestDiscoveryState) -> io::Result<()> {
+ Err(io::Error::new(io::ErrorKind::NotFound, "Not yet implemented!"))
+ }
+
fn write_run_start(
&mut self,
_test_count: usize,
diff --git a/library/test/src/formatters/mod.rs b/library/test/src/formatters/mod.rs
index cb67b6491..bc6ffebc1 100644
--- a/library/test/src/formatters/mod.rs
+++ b/library/test/src/formatters/mod.rs
@@ -1,7 +1,7 @@
use std::{io, io::prelude::Write};
use crate::{
- console::ConsoleTestState,
+ console::{ConsoleTestDiscoveryState, ConsoleTestState},
test_result::TestResult,
time,
types::{TestDesc, TestName},
@@ -18,6 +18,10 @@ pub(crate) use self::pretty::PrettyFormatter;
pub(crate) use self::terse::TerseFormatter;
pub(crate) trait OutputFormatter {
+ fn write_discovery_start(&mut self) -> io::Result<()>;
+ fn write_test_discovered(&mut self, desc: &TestDesc, test_type: &str) -> io::Result<()>;
+ fn write_discovery_finish(&mut self, state: &ConsoleTestDiscoveryState) -> io::Result<()>;
+
fn write_run_start(&mut self, test_count: usize, shuffle_seed: Option<u64>) -> io::Result<()>;
fn write_test_start(&mut self, desc: &TestDesc) -> io::Result<()>;
fn write_timeout(&mut self, desc: &TestDesc) -> io::Result<()>;
diff --git a/library/test/src/formatters/pretty.rs b/library/test/src/formatters/pretty.rs
index 247778e51..22654a340 100644
--- a/library/test/src/formatters/pretty.rs
+++ b/library/test/src/formatters/pretty.rs
@@ -3,7 +3,7 @@ use std::{io, io::prelude::Write};
use super::OutputFormatter;
use crate::{
bench::fmt_bench_samples,
- console::{ConsoleTestState, OutputLocation},
+ console::{ConsoleTestDiscoveryState, ConsoleTestState, OutputLocation},
term,
test_result::TestResult,
time,
@@ -181,6 +181,33 @@ impl<T: Write> PrettyFormatter<T> {
}
impl<T: Write> OutputFormatter for PrettyFormatter<T> {
+ fn write_discovery_start(&mut self) -> io::Result<()> {
+ Ok(())
+ }
+
+ fn write_test_discovered(&mut self, desc: &TestDesc, test_type: &str) -> io::Result<()> {
+ self.write_plain(format!("{}: {test_type}\n", desc.name))
+ }
+
+ fn write_discovery_finish(&mut self, state: &ConsoleTestDiscoveryState) -> io::Result<()> {
+ fn plural(count: usize, s: &str) -> String {
+ match count {
+ 1 => format!("1 {s}"),
+ n => format!("{n} {s}s"),
+ }
+ }
+
+ if state.tests != 0 || state.benchmarks != 0 {
+ self.write_plain("\n")?;
+ }
+
+ self.write_plain(format!(
+ "{}, {}\n",
+ plural(state.tests, "test"),
+ plural(state.benchmarks, "benchmark")
+ ))
+ }
+
fn write_run_start(&mut self, test_count: usize, shuffle_seed: Option<u64>) -> io::Result<()> {
let noun = if test_count != 1 { "tests" } else { "test" };
let shuffle_seed_msg = if let Some(shuffle_seed) = shuffle_seed {
diff --git a/library/test/src/formatters/terse.rs b/library/test/src/formatters/terse.rs
index a431acfbc..2931ca6ea 100644
--- a/library/test/src/formatters/terse.rs
+++ b/library/test/src/formatters/terse.rs
@@ -3,7 +3,7 @@ use std::{io, io::prelude::Write};
use super::OutputFormatter;
use crate::{
bench::fmt_bench_samples,
- console::{ConsoleTestState, OutputLocation},
+ console::{ConsoleTestDiscoveryState, ConsoleTestState, OutputLocation},
term,
test_result::TestResult,
time,
@@ -167,6 +167,18 @@ impl<T: Write> TerseFormatter<T> {
}
impl<T: Write> OutputFormatter for TerseFormatter<T> {
+ fn write_discovery_start(&mut self) -> io::Result<()> {
+ Ok(())
+ }
+
+ fn write_test_discovered(&mut self, desc: &TestDesc, test_type: &str) -> io::Result<()> {
+ self.write_plain(format!("{}: {test_type}\n", desc.name))
+ }
+
+ fn write_discovery_finish(&mut self, _state: &ConsoleTestDiscoveryState) -> io::Result<()> {
+ Ok(())
+ }
+
fn write_run_start(&mut self, test_count: usize, shuffle_seed: Option<u64>) -> io::Result<()> {
self.total_test_count = test_count;
let noun = if test_count != 1 { "tests" } else { "test" };
diff --git a/library/test/src/lib.rs b/library/test/src/lib.rs
index 88d8e5fe9..e76d6716b 100644
--- a/library/test/src/lib.rs
+++ b/library/test/src/lib.rs
@@ -17,7 +17,6 @@
#![unstable(feature = "test", issue = "50297")]
#![doc(test(attr(deny(warnings))))]
#![feature(internal_output_capture)]
-#![feature(is_terminal)]
#![feature(staged_api)]
#![feature(process_exitcode_internals)]
#![feature(panic_can_unwind)]
@@ -220,14 +219,14 @@ pub fn assert_test_result<T: Termination>(result: T) -> Result<(), String> {
struct FilteredTests {
tests: Vec<(TestId, TestDescAndFn)>,
- benchs: Vec<(TestId, TestDescAndFn)>,
+ benches: Vec<(TestId, TestDescAndFn)>,
next_id: usize,
}
impl FilteredTests {
fn add_bench(&mut self, desc: TestDesc, testfn: TestFn) {
let test = TestDescAndFn { desc, testfn };
- self.benchs.push((TestId(self.next_id), test));
+ self.benches.push((TestId(self.next_id), test));
self.next_id += 1;
}
fn add_test(&mut self, desc: TestDesc, testfn: TestFn) {
@@ -246,7 +245,7 @@ impl FilteredTests {
self.add_test(desc, testfn);
}
fn total_len(&self) -> usize {
- self.tests.len() + self.benchs.len()
+ self.tests.len() + self.benches.len()
}
}
@@ -291,7 +290,7 @@ where
let tests_len = tests.len();
- let mut filtered = FilteredTests { tests: Vec::new(), benchs: Vec::new(), next_id: 0 };
+ let mut filtered = FilteredTests { tests: Vec::new(), benches: Vec::new(), next_id: 0 };
for test in filter_tests(opts, tests) {
let mut desc = test.desc;
@@ -458,7 +457,7 @@ where
if opts.bench_benchmarks {
// All benchmarks run at the end, in serial.
- for (id, b) in filtered.benchs {
+ for (id, b) in filtered.benches {
let event = TestEvent::TeWait(b.desc.clone());
notify_about_test_event(event)?;
let join_handle = run_test(opts, false, id, b, run_strategy, tx.clone());
diff --git a/library/test/src/tests.rs b/library/test/src/tests.rs
index 44776fb0a..5ffdbf73f 100644
--- a/library/test/src/tests.rs
+++ b/library/test/src/tests.rs
@@ -63,6 +63,16 @@ fn one_ignored_one_unignored_test() -> Vec<TestDescAndFn> {
name: StaticTestName("1"),
ignore: true,
ignore_message: None,
+ #[cfg(not(bootstrap))]
+ source_file: "",
+ #[cfg(not(bootstrap))]
+ start_line: 0,
+ #[cfg(not(bootstrap))]
+ start_col: 0,
+ #[cfg(not(bootstrap))]
+ end_line: 0,
+ #[cfg(not(bootstrap))]
+ end_col: 0,
should_panic: ShouldPanic::No,
compile_fail: false,
no_run: false,
@@ -75,6 +85,16 @@ fn one_ignored_one_unignored_test() -> Vec<TestDescAndFn> {
name: StaticTestName("2"),
ignore: false,
ignore_message: None,
+ #[cfg(not(bootstrap))]
+ source_file: "",
+ #[cfg(not(bootstrap))]
+ start_line: 0,
+ #[cfg(not(bootstrap))]
+ start_col: 0,
+ #[cfg(not(bootstrap))]
+ end_line: 0,
+ #[cfg(not(bootstrap))]
+ end_col: 0,
should_panic: ShouldPanic::No,
compile_fail: false,
no_run: false,
@@ -95,6 +115,16 @@ pub fn do_not_run_ignored_tests() {
name: StaticTestName("whatever"),
ignore: true,
ignore_message: None,
+ #[cfg(not(bootstrap))]
+ source_file: "",
+ #[cfg(not(bootstrap))]
+ start_line: 0,
+ #[cfg(not(bootstrap))]
+ start_col: 0,
+ #[cfg(not(bootstrap))]
+ end_line: 0,
+ #[cfg(not(bootstrap))]
+ end_col: 0,
should_panic: ShouldPanic::No,
compile_fail: false,
no_run: false,
@@ -118,6 +148,16 @@ pub fn ignored_tests_result_in_ignored() {
name: StaticTestName("whatever"),
ignore: true,
ignore_message: None,
+ #[cfg(not(bootstrap))]
+ source_file: "",
+ #[cfg(not(bootstrap))]
+ start_line: 0,
+ #[cfg(not(bootstrap))]
+ start_col: 0,
+ #[cfg(not(bootstrap))]
+ end_line: 0,
+ #[cfg(not(bootstrap))]
+ end_col: 0,
should_panic: ShouldPanic::No,
compile_fail: false,
no_run: false,
@@ -143,6 +183,16 @@ fn test_should_panic() {
name: StaticTestName("whatever"),
ignore: false,
ignore_message: None,
+ #[cfg(not(bootstrap))]
+ source_file: "",
+ #[cfg(not(bootstrap))]
+ start_line: 0,
+ #[cfg(not(bootstrap))]
+ start_col: 0,
+ #[cfg(not(bootstrap))]
+ end_line: 0,
+ #[cfg(not(bootstrap))]
+ end_col: 0,
should_panic: ShouldPanic::Yes,
compile_fail: false,
no_run: false,
@@ -168,6 +218,16 @@ fn test_should_panic_good_message() {
name: StaticTestName("whatever"),
ignore: false,
ignore_message: None,
+ #[cfg(not(bootstrap))]
+ source_file: "",
+ #[cfg(not(bootstrap))]
+ start_line: 0,
+ #[cfg(not(bootstrap))]
+ start_col: 0,
+ #[cfg(not(bootstrap))]
+ end_line: 0,
+ #[cfg(not(bootstrap))]
+ end_col: 0,
should_panic: ShouldPanic::YesWithMessage("error message"),
compile_fail: false,
no_run: false,
@@ -198,6 +258,16 @@ fn test_should_panic_bad_message() {
name: StaticTestName("whatever"),
ignore: false,
ignore_message: None,
+ #[cfg(not(bootstrap))]
+ source_file: "",
+ #[cfg(not(bootstrap))]
+ start_line: 0,
+ #[cfg(not(bootstrap))]
+ start_col: 0,
+ #[cfg(not(bootstrap))]
+ end_line: 0,
+ #[cfg(not(bootstrap))]
+ end_col: 0,
should_panic: ShouldPanic::YesWithMessage(expected),
compile_fail: false,
no_run: false,
@@ -232,6 +302,16 @@ fn test_should_panic_non_string_message_type() {
name: StaticTestName("whatever"),
ignore: false,
ignore_message: None,
+ #[cfg(not(bootstrap))]
+ source_file: "",
+ #[cfg(not(bootstrap))]
+ start_line: 0,
+ #[cfg(not(bootstrap))]
+ start_col: 0,
+ #[cfg(not(bootstrap))]
+ end_line: 0,
+ #[cfg(not(bootstrap))]
+ end_col: 0,
should_panic: ShouldPanic::YesWithMessage(expected),
compile_fail: false,
no_run: false,
@@ -260,6 +340,16 @@ fn test_should_panic_but_succeeds() {
name: StaticTestName("whatever"),
ignore: false,
ignore_message: None,
+ #[cfg(not(bootstrap))]
+ source_file: "",
+ #[cfg(not(bootstrap))]
+ start_line: 0,
+ #[cfg(not(bootstrap))]
+ start_col: 0,
+ #[cfg(not(bootstrap))]
+ end_line: 0,
+ #[cfg(not(bootstrap))]
+ end_col: 0,
should_panic,
compile_fail: false,
no_run: false,
@@ -288,6 +378,16 @@ fn report_time_test_template(report_time: bool) -> Option<TestExecTime> {
name: StaticTestName("whatever"),
ignore: false,
ignore_message: None,
+ #[cfg(not(bootstrap))]
+ source_file: "",
+ #[cfg(not(bootstrap))]
+ start_line: 0,
+ #[cfg(not(bootstrap))]
+ start_col: 0,
+ #[cfg(not(bootstrap))]
+ end_line: 0,
+ #[cfg(not(bootstrap))]
+ end_col: 0,
should_panic: ShouldPanic::No,
compile_fail: false,
no_run: false,
@@ -325,6 +425,16 @@ fn time_test_failure_template(test_type: TestType) -> TestResult {
name: StaticTestName("whatever"),
ignore: false,
ignore_message: None,
+ #[cfg(not(bootstrap))]
+ source_file: "",
+ #[cfg(not(bootstrap))]
+ start_line: 0,
+ #[cfg(not(bootstrap))]
+ start_col: 0,
+ #[cfg(not(bootstrap))]
+ end_line: 0,
+ #[cfg(not(bootstrap))]
+ end_col: 0,
should_panic: ShouldPanic::No,
compile_fail: false,
no_run: false,
@@ -364,6 +474,16 @@ fn typed_test_desc(test_type: TestType) -> TestDesc {
name: StaticTestName("whatever"),
ignore: false,
ignore_message: None,
+ #[cfg(not(bootstrap))]
+ source_file: "",
+ #[cfg(not(bootstrap))]
+ start_line: 0,
+ #[cfg(not(bootstrap))]
+ start_col: 0,
+ #[cfg(not(bootstrap))]
+ end_line: 0,
+ #[cfg(not(bootstrap))]
+ end_col: 0,
should_panic: ShouldPanic::No,
compile_fail: false,
no_run: false,
@@ -476,6 +596,16 @@ pub fn exclude_should_panic_option() {
name: StaticTestName("3"),
ignore: false,
ignore_message: None,
+ #[cfg(not(bootstrap))]
+ source_file: "",
+ #[cfg(not(bootstrap))]
+ start_line: 0,
+ #[cfg(not(bootstrap))]
+ start_col: 0,
+ #[cfg(not(bootstrap))]
+ end_line: 0,
+ #[cfg(not(bootstrap))]
+ end_col: 0,
should_panic: ShouldPanic::Yes,
compile_fail: false,
no_run: false,
@@ -500,6 +630,16 @@ pub fn exact_filter_match() {
name: StaticTestName(name),
ignore: false,
ignore_message: None,
+ #[cfg(not(bootstrap))]
+ source_file: "",
+ #[cfg(not(bootstrap))]
+ start_line: 0,
+ #[cfg(not(bootstrap))]
+ start_col: 0,
+ #[cfg(not(bootstrap))]
+ end_line: 0,
+ #[cfg(not(bootstrap))]
+ end_col: 0,
should_panic: ShouldPanic::No,
compile_fail: false,
no_run: false,
@@ -591,6 +731,16 @@ fn sample_tests() -> Vec<TestDescAndFn> {
name: DynTestName((*name).clone()),
ignore: false,
ignore_message: None,
+ #[cfg(not(bootstrap))]
+ source_file: "",
+ #[cfg(not(bootstrap))]
+ start_line: 0,
+ #[cfg(not(bootstrap))]
+ start_col: 0,
+ #[cfg(not(bootstrap))]
+ end_line: 0,
+ #[cfg(not(bootstrap))]
+ end_col: 0,
should_panic: ShouldPanic::No,
compile_fail: false,
no_run: false,
@@ -720,6 +870,16 @@ pub fn test_bench_no_iter() {
name: StaticTestName("f"),
ignore: false,
ignore_message: None,
+ #[cfg(not(bootstrap))]
+ source_file: "",
+ #[cfg(not(bootstrap))]
+ start_line: 0,
+ #[cfg(not(bootstrap))]
+ start_col: 0,
+ #[cfg(not(bootstrap))]
+ end_line: 0,
+ #[cfg(not(bootstrap))]
+ end_col: 0,
should_panic: ShouldPanic::No,
compile_fail: false,
no_run: false,
@@ -743,6 +903,16 @@ pub fn test_bench_iter() {
name: StaticTestName("f"),
ignore: false,
ignore_message: None,
+ #[cfg(not(bootstrap))]
+ source_file: "",
+ #[cfg(not(bootstrap))]
+ start_line: 0,
+ #[cfg(not(bootstrap))]
+ start_col: 0,
+ #[cfg(not(bootstrap))]
+ end_line: 0,
+ #[cfg(not(bootstrap))]
+ end_col: 0,
should_panic: ShouldPanic::No,
compile_fail: false,
no_run: false,
@@ -759,6 +929,16 @@ fn should_sort_failures_before_printing_them() {
name: StaticTestName("a"),
ignore: false,
ignore_message: None,
+ #[cfg(not(bootstrap))]
+ source_file: "",
+ #[cfg(not(bootstrap))]
+ start_line: 0,
+ #[cfg(not(bootstrap))]
+ start_col: 0,
+ #[cfg(not(bootstrap))]
+ end_line: 0,
+ #[cfg(not(bootstrap))]
+ end_col: 0,
should_panic: ShouldPanic::No,
compile_fail: false,
no_run: false,
@@ -769,6 +949,16 @@ fn should_sort_failures_before_printing_them() {
name: StaticTestName("b"),
ignore: false,
ignore_message: None,
+ #[cfg(not(bootstrap))]
+ source_file: "",
+ #[cfg(not(bootstrap))]
+ start_line: 0,
+ #[cfg(not(bootstrap))]
+ start_col: 0,
+ #[cfg(not(bootstrap))]
+ end_line: 0,
+ #[cfg(not(bootstrap))]
+ end_col: 0,
should_panic: ShouldPanic::No,
compile_fail: false,
no_run: false,
@@ -816,6 +1006,16 @@ fn test_dyn_bench_returning_err_fails_when_run_as_test() {
name: StaticTestName("whatever"),
ignore: false,
ignore_message: None,
+ #[cfg(not(bootstrap))]
+ source_file: "",
+ #[cfg(not(bootstrap))]
+ start_line: 0,
+ #[cfg(not(bootstrap))]
+ start_col: 0,
+ #[cfg(not(bootstrap))]
+ end_line: 0,
+ #[cfg(not(bootstrap))]
+ end_col: 0,
should_panic: ShouldPanic::No,
compile_fail: false,
no_run: false,
diff --git a/library/test/src/types.rs b/library/test/src/types.rs
index 6f2e03309..8d4e204c8 100644
--- a/library/test/src/types.rs
+++ b/library/test/src/types.rs
@@ -119,6 +119,16 @@ pub struct TestDesc {
pub name: TestName,
pub ignore: bool,
pub ignore_message: Option<&'static str>,
+ #[cfg(not(bootstrap))]
+ pub source_file: &'static str,
+ #[cfg(not(bootstrap))]
+ pub start_line: usize,
+ #[cfg(not(bootstrap))]
+ pub start_col: usize,
+ #[cfg(not(bootstrap))]
+ pub end_line: usize,
+ #[cfg(not(bootstrap))]
+ pub end_col: usize,
pub should_panic: options::ShouldPanic,
pub compile_fail: bool,
pub no_run: bool,