Skip to content

Commit

Permalink
Merge pull request #748 from Mark-Simulacrum/debug-crater
Browse files Browse the repository at this point in the history
Debug crater
  • Loading branch information
Mark-Simulacrum authored Dec 7, 2024
2 parents 6d18714 + 605f32c commit 0e15868
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 11 deletions.
6 changes: 3 additions & 3 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 4 additions & 7 deletions src/report/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -228,21 +228,18 @@ pub fn generate_report<DB: ReadResults>(
.iter()
.map(|krate| {
// Any errors here will turn into unknown results
let crate_results = ex.toolchains.iter().map(|tc| -> Fallible<BuildTestResult> {
let res = db
.load_test_result(ex, tc, krate)?
.ok_or_else(|| err_msg("no result"))?;
let mut crate_results = ex.toolchains.iter().map(|tc| -> Option<BuildTestResult> {
// Convert errors to None with ok()
let res = db.load_test_result(ex, tc, krate).ok()??;

Ok(BuildTestResult {
Some(BuildTestResult {
res,
log: crate_to_path_fragment(tc, krate, SanitizationContext::Url)
.to_str()
.unwrap()
.replace('\'', "/"), // Normalize paths in reports generated on Windows
})
});
// Convert errors to Nones
let mut crate_results = crate_results.map(|r| r.ok());
let crate1 = crate_results.next().unwrap();
let crate2 = crate_results.next().unwrap();
let comp = compare(
Expand Down
4 changes: 4 additions & 0 deletions src/results/db.rs
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,10 @@ impl<'a> DatabaseDB<'a> {
res: &TestResult,
log: EncodedLog,
) -> Fallible<usize> {
log::info!(
"insert {krate:?} for ex={ex:?} with tc={toolchain:?}; result={res:?}",
ex = &ex.name
);
self.db.execute(
"INSERT INTO results (experiment, crate, toolchain, result, log, encoding) \
VALUES (?1, ?2, ?3, ?4, ?5, ?6);",
Expand Down
2 changes: 1 addition & 1 deletion src/utils/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -95,5 +95,5 @@ fn is_backtrace_runtime_enabled() -> bool {
std::env::var("RUST_BACKTRACE")
.ok()
.and_then(|s| i32::from_str(&s).ok())
.map_or(false, |val| val != 0)
.is_some_and(|val| val != 0)
}

0 comments on commit 0e15868

Please sign in to comment.