pub struct RecordOutcome {
pub recorded: usize,
pub passed: usize,
pub commit: String,
pub working_tree: String,
pub unknown: Vec<String>,
pub dropped: Vec<EvidenceDropped>,
pub run_record: EvidenceRunRecord,
}Expand description
What a recording did: how much of the run reached the ledger, how much of it passed, the provenance every execution was stamped with, and what the run named that this repository does not have.
The last is the one worth reading. A report naming a test no runner here owns is
counted in RecordOutcome::unknown and recorded for nobody, because an execution of
a test that does not exist is evidence for nothing — and dropping it silently would
hide a runner and a matrix that have drifted apart.
use majordomus_cli::evidence::{record, Ledger, Origin, RecordOutcome, RecordRequest};
let reports = tempfile::tempdir().unwrap();
let tsv = reports.path().join("run.tsv");
std::fs::write(&tsv, "07_scope\tok\t1\tparallel\n99_ghost\tok\t1\tparallel\n").unwrap();
let outcome: RecordOutcome = record(
root.path(),
&RecordRequest { suite: Some(tsv), crate_output: None, ..RecordRequest::new(Origin::Local) },
)
.unwrap();
assert_eq!(outcome.recorded, 1, "only the case this repository actually has");
assert_eq!(outcome.passed, 1);
assert_eq!(outcome.working_tree, "unknown", "no measurement came with the report");
assert_eq!(outcome.run_record.unknown, outcome.unknown);
assert_eq!(outcome.unknown, ["suite:99_ghost"], "named here, recorded for nobody");
assert!(Ledger::load(root.path()).unwrap().latest("suite:99_ghost").is_none());§Example
A crate run’s recording: the integration binary a claim can name is recorded, and the
doctests, which ran and which no claim can name yet, are listed in
RecordOutcome::dropped rather than ignored.
use majordomus_cli::evidence::{record, EvidenceProducer, Origin, RecordOutcome, RecordRequest};
let reports = tempfile::tempdir().unwrap();
let log = reports.path().join("crate.log");
std::fs::write(
&log,
" Running tests/why.rs (target/debug/deps/why-1)\n\
test result: ok. 2 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; \
finished in 0.10s\n\
Doc-tests majordomus_cli\n\
test result: ok. 5 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; \
finished in 1.00s\n",
)
.unwrap();
let request =
RecordRequest { suite: None, crate_output: Some(log), ..RecordRequest::new(Origin::Local) };
let outcome: RecordOutcome = record(root.path(), &request).unwrap();
assert_eq!((outcome.recorded, outcome.passed), (1, 1), "the binary under tests/");
assert_eq!(outcome.dropped.len(), 1, "the doctests, listed");
assert_eq!(outcome.dropped[0].producer, EvidenceProducer::Crate);
assert_eq!(outcome.dropped[0].what, "doc-tests majordomus_cli");Fields§
§recorded: usizeHow many executions were written.
passed: usizeHow many of them passed.
commit: StringThe commit they were recorded against.
working_tree: StringThe weakest tree the reports’ own measurements stated: clean, dirty, or
unknown when a report came without one. Read from RecordOutcome::run_record.
unknown: Vec<String>Reports the run named that no runner in this repository owns; recorded for nobody and named here rather than dropped.
dropped: Vec<EvidenceDropped>What the reports held that no claim can name yet, in the order the reports held it:
the crate’s own unit-test binary, its doctests, a binary outside tests/, a result
line no binary owned. Listed rather than ignored, so a run is never silently smaller
than it was. The same list as the run record’s.
run_record: EvidenceRunRecordThe recording as a typed run.
Trait Implementations§
Source§impl Clone for RecordOutcome
impl Clone for RecordOutcome
Source§fn clone(&self) -> RecordOutcome
fn clone(&self) -> RecordOutcome
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for RecordOutcome
impl Debug for RecordOutcome
Source§impl PartialEq for RecordOutcome
impl PartialEq for RecordOutcome
Source§fn eq(&self, other: &RecordOutcome) -> bool
fn eq(&self, other: &RecordOutcome) -> bool
self and other values to be equal, and is used by ==.