Skip to content

Commit

Permalink
add tests for extract_perf_shas
Browse files Browse the repository at this point in the history
Some real-world examples in the 2 different formats
  • Loading branch information
lqd committed Jul 3, 2023
1 parent e80fbca commit f869578
Showing 1 changed file with 70 additions and 0 deletions.
70 changes: 70 additions & 0 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1354,4 +1354,74 @@ mod tests {
validate_dir(main).unwrap_err()
)
}

// Ensure the first version of the comment posted by the perf-bot works
#[test]
fn test_perf_builds_v1_format() {
// Body extracted from this v1 comment
// https://github.com/rust-lang/rust/pull/113014#issuecomment-1605868471
let body = "📌 Perf builds for each rolled up PR:
|PR# | Perf Build Sha|
|----|:-----:|
|#113009|[05b07dad146a6d43ead9bcd1e8bc10cbd017a5f5](https://github.com/rust-lang-ci/rust/commit/05b07dad146a6d43ead9bcd1e8bc10cbd017a5f5)|
|#113008|[581913b6789370def5158093b799baa6d4d875eb](https://github.com/rust-lang-ci/rust/commit/581913b6789370def5158093b799baa6d4d875eb)|
|#112956|[e294bd3827eb2e878167329648f3c8178ef344e7](https://github.com/rust-lang-ci/rust/commit/e294bd3827eb2e878167329648f3c8178ef344e7)|
|#112950|[0ed6ba504649ca1cb2672572b4ab41acfb06c86c](https://github.com/rust-lang-ci/rust/commit/0ed6ba504649ca1cb2672572b4ab41acfb06c86c)|
|#112937|[18e108ab85b78e6966c5b5bdadfd5b8efeadf080](https://github.com/rust-lang-ci/rust/commit/18e108ab85b78e6966c5b5bdadfd5b8efeadf080)|
*previous master*: [f7ca9df695](https://github.com/rust-lang-ci/rust/commit/f7ca9df69549470541fbf542f87a03eb9ed024b6)
In the case of a perf regression, run the following command for each PR you suspect might be the cause: `@rust-timer build $SHA`
<!-- rust-timer: rollup -->";
assert_eq!(
vec![
"05b07dad146a6d43ead9bcd1e8bc10cbd017a5f5",
"581913b6789370def5158093b799baa6d4d875eb",
"e294bd3827eb2e878167329648f3c8178ef344e7",
"0ed6ba504649ca1cb2672572b4ab41acfb06c86c",
"18e108ab85b78e6966c5b5bdadfd5b8efeadf080",
],
extract_perf_shas(body).expect("extracting perf builds on v1 format failed"),
);
}

// Ensure the second version of the comment posted by the perf-bot works
#[test]
fn test_perf_builds_v2_format() {
// Body extracted from this v2 comment
// https://github.com/rust-lang/rust/pull/113105#issuecomment-1610393473
let body = "📌 Perf builds for each rolled up PR:
| PR# | Message | Perf Build Sha |
|----|----|:-----:|
|#112207|Add trustzone and virtualization target features for aarch3…|`bbec6d6e413aa144c8b9346da27a0f2af299cbeb` ([link](https://github.com/rust-lang-ci/rust/commit/bbec6d6e413aa144c8b9346da27a0f2af299cbeb))|
|#112454|Make compiletest aware of targets without dynamic linking|`70b67c09ead52f4582471650202b1a189821ed5f` ([link](https://github.com/rust-lang-ci/rust/commit/70b67c09ead52f4582471650202b1a189821ed5f))|
|#112628|Allow comparing `Box`es with different allocators|`3043f4e577f41565443f38a6a16b7a1a08b063ad` ([link](https://github.com/rust-lang-ci/rust/commit/3043f4e577f41565443f38a6a16b7a1a08b063ad))|
|#112692|Provide more context for `rustc +nightly -Zunstable-options…|`4ab6f33fd50237b105999cc6d32d85cce5dad61a` ([link](https://github.com/rust-lang-ci/rust/commit/4ab6f33fd50237b105999cc6d32d85cce5dad61a))|
|#112972|Make `UnwindAction::Continue` explicit in MIR dump|`e1df9e306054655d7d41ec1ad75ade5d76a6888d` ([link](https://github.com/rust-lang-ci/rust/commit/e1df9e306054655d7d41ec1ad75ade5d76a6888d))|
|#113020|Add tests impl via obj unless denied|`affe009b94eba41777cf02997b1780e50445d6af` ([link](https://github.com/rust-lang-ci/rust/commit/affe009b94eba41777cf02997b1780e50445d6af))|
|#113084|Simplify some conditions|`0ce4618dbf5810aabb389edd4950c060b6b4d049` ([link](https://github.com/rust-lang-ci/rust/commit/0ce4618dbf5810aabb389edd4950c060b6b4d049))|
|#113103|Normalize types when applying uninhabited predicate.|`241cd8cd818cdc865cdf02f0c32a40081420b772` ([link](https://github.com/rust-lang-ci/rust/commit/241cd8cd818cdc865cdf02f0c32a40081420b772))|
*previous master*: [5ea6668646](https://github.com/rust-lang-ci/rust/commit/5ea66686467d3ec5f8c81570e7f0f16ad8dd8cc3)
In the case of a perf regression, run the following command for each PR you suspect might be the cause: `@rust-timer build $SHA`
<!-- rust-timer: rollup -->";
assert_eq!(
vec![
"bbec6d6e413aa144c8b9346da27a0f2af299cbeb",
"70b67c09ead52f4582471650202b1a189821ed5f",
"3043f4e577f41565443f38a6a16b7a1a08b063ad",
"4ab6f33fd50237b105999cc6d32d85cce5dad61a",
"e1df9e306054655d7d41ec1ad75ade5d76a6888d",
"affe009b94eba41777cf02997b1780e50445d6af",
"0ce4618dbf5810aabb389edd4950c060b6b4d049",
"241cd8cd818cdc865cdf02f0c32a40081420b772",
],
extract_perf_shas(body).expect("extracting perf builds on v2 format failed"),
);
}
}

0 comments on commit f869578

Please sign in to comment.