|
3 | 3 | //! comparison endpoints
|
4 | 4 |
|
5 | 5 | use crate::api;
|
6 |
| -use crate::db::{ArtifactId, Benchmark, Profile, Scenario}; |
| 6 | +use crate::db::{ArtifactId, Benchmark, Lookup, Profile, Scenario}; |
7 | 7 | use crate::github;
|
8 | 8 | use crate::load::SiteCtxt;
|
9 | 9 | use crate::selector::{self, Tag};
|
@@ -132,11 +132,14 @@ pub async fn handle_compare(
|
132 | 132 | })
|
133 | 133 | .collect();
|
134 | 134 |
|
| 135 | + let mut new_errors = comparison.new_errors.into_iter().collect::<Vec<_>>(); |
| 136 | + new_errors.sort(); |
135 | 137 | Ok(api::comparison::Response {
|
136 | 138 | prev,
|
137 | 139 | a: comparison.a.into(),
|
138 | 140 | b: comparison.b.into(),
|
139 | 141 | comparisons,
|
| 142 | + new_errors, |
140 | 143 | next,
|
141 | 144 | is_contiguous,
|
142 | 145 | })
|
@@ -323,6 +326,21 @@ impl ComparisonSummary {
|
323 | 326 | write!(result, "- ").unwrap();
|
324 | 327 | change.summary_line(&mut result, Some(link))
|
325 | 328 | }
|
| 329 | + |
| 330 | + if !comparison.new_errors.is_empty() { |
| 331 | + write!( |
| 332 | + result, |
| 333 | + "- New errors in {}", |
| 334 | + comparison |
| 335 | + .new_errors |
| 336 | + .keys() |
| 337 | + .map(|k| k.as_str()) |
| 338 | + .collect::<Vec<_>>() |
| 339 | + .join(", ") |
| 340 | + ) |
| 341 | + .unwrap(); |
| 342 | + } |
| 343 | + |
326 | 344 | result
|
327 | 345 | }
|
328 | 346 | }
|
@@ -368,6 +386,7 @@ async fn compare_given_commits(
|
368 | 386 | master_commits: &[collector::MasterCommit],
|
369 | 387 | calc_new_sig: bool,
|
370 | 388 | ) -> Result<Option<Comparison>, BoxedError> {
|
| 389 | + let idx = ctxt.index.load(); |
371 | 390 | let a = ctxt
|
372 | 391 | .artifact_id_for_bound(start.clone(), true)
|
373 | 392 | .ok_or(format!("could not find start commit for bound {:?}", start))?;
|
@@ -408,10 +427,22 @@ async fn compare_given_commits(
|
408 | 427 | })
|
409 | 428 | })
|
410 | 429 | .collect();
|
| 430 | + |
| 431 | + let mut errors = conn.get_error(b.lookup(&idx).unwrap()).await; |
| 432 | + for (name, error) in conn.get_error(a.lookup(&idx).unwrap()).await { |
| 433 | + if error.is_some() { |
| 434 | + errors.remove(&name); |
| 435 | + } |
| 436 | + } |
| 437 | + |
411 | 438 | Ok(Some(Comparison {
|
412 | 439 | a: ArtifactDescription::for_artifact(&*conn, a.clone(), master_commits).await,
|
413 | 440 | b: ArtifactDescription::for_artifact(&*conn, b.clone(), master_commits).await,
|
414 | 441 | statistics,
|
| 442 | + new_errors: errors |
| 443 | + .into_iter() |
| 444 | + .filter_map(|(k, v)| v.map(|v| (k, v))) |
| 445 | + .collect(), |
415 | 446 | }))
|
416 | 447 | }
|
417 | 448 |
|
@@ -557,6 +588,7 @@ pub struct Comparison {
|
557 | 588 | pub b: ArtifactDescription,
|
558 | 589 | /// Statistics based on test case
|
559 | 590 | pub statistics: HashSet<TestResultComparison>,
|
| 591 | + pub new_errors: HashMap<String, String>, |
560 | 592 | }
|
561 | 593 |
|
562 | 594 | impl Comparison {
|
|
0 commit comments