Skip to content

Commit bc27ad9

Browse files
committed
[nextest-runner] display run ID and profile name during runs
We're going to make the run ID more prominent soon, so display it. Also display the profile name since I think it's useful information. In the future we're also going to record the command arguments.
1 parent 50a85e9 commit bc27ad9

File tree

3 files changed

+37
-3
lines changed

3 files changed

+37
-3
lines changed

nextest-runner/src/config/config_impl.rs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -522,6 +522,7 @@ impl NextestConfig {
522522
.chain(self.compiled.default.clone());
523523

524524
Ok(NextestProfile {
525+
name: name.to_owned(),
525526
store_dir,
526527
default_profile: &self.inner.default_profile,
527528
custom_profile,
@@ -573,6 +574,7 @@ pub struct FinalConfig {
573574
/// Returned by [`NextestConfig::profile`].
574575
#[derive(Clone, Debug)]
575576
pub struct NextestProfile<'cfg, State = FinalConfig> {
577+
name: String,
576578
store_dir: Utf8PathBuf,
577579
default_profile: &'cfg DefaultProfileImpl,
578580
custom_profile: Option<&'cfg CustomProfileImpl>,
@@ -583,6 +585,11 @@ pub struct NextestProfile<'cfg, State = FinalConfig> {
583585
}
584586

585587
impl<'cfg, State> NextestProfile<'cfg, State> {
588+
/// Returns the name of the profile.
589+
pub fn name(&self) -> &str {
590+
&self.name
591+
}
592+
586593
/// Returns the absolute profile-specific store directory.
587594
pub fn store_dir(&self) -> &Utf8Path {
588595
&self.store_dir
@@ -612,6 +619,7 @@ impl<'cfg> NextestProfile<'cfg, PreBuildPlatform> {
612619
pub fn apply_build_platforms(self, build_platforms: &BuildPlatforms) -> NextestProfile<'cfg> {
613620
let compiled_data = self.compiled_data.apply_build_platforms(build_platforms);
614621
NextestProfile {
622+
name: self.name,
615623
store_dir: self.store_dir,
616624
default_profile: self.default_profile,
617625
custom_profile: self.custom_profile,

nextest-runner/src/reporter.rs

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -594,7 +594,11 @@ impl<'a> TestReporterImpl<'a> {
594594
writer: &mut dyn Write,
595595
) -> io::Result<()> {
596596
match &event.kind {
597-
TestEventKind::RunStarted { test_list, .. } => {
597+
TestEventKind::RunStarted {
598+
test_list,
599+
run_id,
600+
profile_name,
601+
} => {
598602
write!(writer, "{:>12} ", "Starting".style(self.styles.pass))?;
599603

600604
let count_style = self.styles.count;
@@ -611,9 +615,18 @@ impl<'a> TestReporterImpl<'a> {
611615

612616
let skip_count = test_list.skip_count();
613617
if skip_count > 0 {
614-
write!(writer, " ({} skipped)", skip_count.style(count_style))?;
618+
write!(writer, " ({} skipped; ", skip_count.style(count_style))?;
619+
} else {
620+
write!(writer, " (")?;
615621
}
616622

623+
write!(
624+
writer,
625+
"run ID: {}, nextest profile: {})",
626+
run_id.style(self.styles.count),
627+
profile_name.style(self.styles.count),
628+
)?;
629+
617630
writeln!(writer)?;
618631
}
619632
TestEventKind::SetupScriptStarted {
@@ -1659,6 +1672,9 @@ pub enum TestEventKind<'a> {
16591672

16601673
/// The UUID for this run.
16611674
run_id: Uuid,
1675+
1676+
/// The nextest profile chosen for this run.
1677+
profile_name: String,
16621678
},
16631679

16641680
/// A setup script started.

nextest-runner/src/runner.rs

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -285,6 +285,7 @@ impl<'a> TestRunnerInner<'a> {
285285
let mut ctx = CallbackContext::new(
286286
callback,
287287
self.run_id,
288+
self.profile.name(),
288289
self.test_list.run_count(),
289290
self.fail_fast,
290291
);
@@ -1679,6 +1680,7 @@ enum ShutdownForwardEvent {
16791680
struct CallbackContext<F, E> {
16801681
callback: F,
16811682
run_id: Uuid,
1683+
profile_name: String,
16821684
stopwatch: StopwatchStart,
16831685
run_stats: RunStats,
16841686
fail_fast: bool,
@@ -1693,11 +1695,18 @@ impl<'a, F, E> CallbackContext<F, E>
16931695
where
16941696
F: FnMut(TestEvent<'a>) -> Result<(), E> + Send,
16951697
{
1696-
fn new(callback: F, run_id: Uuid, initial_run_count: usize, fail_fast: bool) -> Self {
1698+
fn new(
1699+
callback: F,
1700+
run_id: Uuid,
1701+
profile_name: &str,
1702+
initial_run_count: usize,
1703+
fail_fast: bool,
1704+
) -> Self {
16971705
Self {
16981706
callback,
16991707
run_id,
17001708
stopwatch: crate::time::stopwatch(),
1709+
profile_name: profile_name.to_owned(),
17011710
run_stats: RunStats {
17021711
initial_run_count,
17031712
..RunStats::default()
@@ -1715,6 +1724,7 @@ where
17151724
self.basic_callback(TestEventKind::RunStarted {
17161725
test_list,
17171726
run_id: self.run_id,
1727+
profile_name: self.profile_name.clone(),
17181728
})
17191729
}
17201730

0 commit comments

Comments
 (0)