Skip to content

Commit f869578

Browse files
committed
add tests for extract_perf_shas
Some real-world examples in the 2 different formats
1 parent e80fbca commit f869578

File tree

1 file changed

+70
-0
lines changed

1 file changed

+70
-0
lines changed

src/main.rs

+70
Original file line numberDiff line numberDiff line change
@@ -1354,4 +1354,74 @@ mod tests {
13541354
validate_dir(main).unwrap_err()
13551355
)
13561356
}
1357+
1358+
// Ensure the first version of the comment posted by the perf-bot works
1359+
#[test]
1360+
fn test_perf_builds_v1_format() {
1361+
// Body extracted from this v1 comment
1362+
// https://github.com/rust-lang/rust/pull/113014#issuecomment-1605868471
1363+
let body = "📌 Perf builds for each rolled up PR:
1364+
1365+
|PR# | Perf Build Sha|
1366+
|----|:-----:|
1367+
|#113009|[05b07dad146a6d43ead9bcd1e8bc10cbd017a5f5](https://github.com/rust-lang-ci/rust/commit/05b07dad146a6d43ead9bcd1e8bc10cbd017a5f5)|
1368+
|#113008|[581913b6789370def5158093b799baa6d4d875eb](https://github.com/rust-lang-ci/rust/commit/581913b6789370def5158093b799baa6d4d875eb)|
1369+
|#112956|[e294bd3827eb2e878167329648f3c8178ef344e7](https://github.com/rust-lang-ci/rust/commit/e294bd3827eb2e878167329648f3c8178ef344e7)|
1370+
|#112950|[0ed6ba504649ca1cb2672572b4ab41acfb06c86c](https://github.com/rust-lang-ci/rust/commit/0ed6ba504649ca1cb2672572b4ab41acfb06c86c)|
1371+
|#112937|[18e108ab85b78e6966c5b5bdadfd5b8efeadf080](https://github.com/rust-lang-ci/rust/commit/18e108ab85b78e6966c5b5bdadfd5b8efeadf080)|
1372+
1373+
1374+
*previous master*: [f7ca9df695](https://github.com/rust-lang-ci/rust/commit/f7ca9df69549470541fbf542f87a03eb9ed024b6)
1375+
1376+
In the case of a perf regression, run the following command for each PR you suspect might be the cause: `@rust-timer build $SHA`
1377+
<!-- rust-timer: rollup -->";
1378+
assert_eq!(
1379+
vec![
1380+
"05b07dad146a6d43ead9bcd1e8bc10cbd017a5f5",
1381+
"581913b6789370def5158093b799baa6d4d875eb",
1382+
"e294bd3827eb2e878167329648f3c8178ef344e7",
1383+
"0ed6ba504649ca1cb2672572b4ab41acfb06c86c",
1384+
"18e108ab85b78e6966c5b5bdadfd5b8efeadf080",
1385+
],
1386+
extract_perf_shas(body).expect("extracting perf builds on v1 format failed"),
1387+
);
1388+
}
1389+
1390+
// Ensure the second version of the comment posted by the perf-bot works
1391+
#[test]
1392+
fn test_perf_builds_v2_format() {
1393+
// Body extracted from this v2 comment
1394+
// https://github.com/rust-lang/rust/pull/113105#issuecomment-1610393473
1395+
let body = "📌 Perf builds for each rolled up PR:
1396+
1397+
| PR# | Message | Perf Build Sha |
1398+
|----|----|:-----:|
1399+
|#112207|Add trustzone and virtualization target features for aarch3…|`bbec6d6e413aa144c8b9346da27a0f2af299cbeb` ([link](https://github.com/rust-lang-ci/rust/commit/bbec6d6e413aa144c8b9346da27a0f2af299cbeb))|
1400+
|#112454|Make compiletest aware of targets without dynamic linking|`70b67c09ead52f4582471650202b1a189821ed5f` ([link](https://github.com/rust-lang-ci/rust/commit/70b67c09ead52f4582471650202b1a189821ed5f))|
1401+
|#112628|Allow comparing `Box`es with different allocators|`3043f4e577f41565443f38a6a16b7a1a08b063ad` ([link](https://github.com/rust-lang-ci/rust/commit/3043f4e577f41565443f38a6a16b7a1a08b063ad))|
1402+
|#112692|Provide more context for `rustc +nightly -Zunstable-options…|`4ab6f33fd50237b105999cc6d32d85cce5dad61a` ([link](https://github.com/rust-lang-ci/rust/commit/4ab6f33fd50237b105999cc6d32d85cce5dad61a))|
1403+
|#112972|Make `UnwindAction::Continue` explicit in MIR dump|`e1df9e306054655d7d41ec1ad75ade5d76a6888d` ([link](https://github.com/rust-lang-ci/rust/commit/e1df9e306054655d7d41ec1ad75ade5d76a6888d))|
1404+
|#113020|Add tests impl via obj unless denied|`affe009b94eba41777cf02997b1780e50445d6af` ([link](https://github.com/rust-lang-ci/rust/commit/affe009b94eba41777cf02997b1780e50445d6af))|
1405+
|#113084|Simplify some conditions|`0ce4618dbf5810aabb389edd4950c060b6b4d049` ([link](https://github.com/rust-lang-ci/rust/commit/0ce4618dbf5810aabb389edd4950c060b6b4d049))|
1406+
|#113103|Normalize types when applying uninhabited predicate.|`241cd8cd818cdc865cdf02f0c32a40081420b772` ([link](https://github.com/rust-lang-ci/rust/commit/241cd8cd818cdc865cdf02f0c32a40081420b772))|
1407+
1408+
1409+
*previous master*: [5ea6668646](https://github.com/rust-lang-ci/rust/commit/5ea66686467d3ec5f8c81570e7f0f16ad8dd8cc3)
1410+
1411+
In the case of a perf regression, run the following command for each PR you suspect might be the cause: `@rust-timer build $SHA`
1412+
<!-- rust-timer: rollup -->";
1413+
assert_eq!(
1414+
vec![
1415+
"bbec6d6e413aa144c8b9346da27a0f2af299cbeb",
1416+
"70b67c09ead52f4582471650202b1a189821ed5f",
1417+
"3043f4e577f41565443f38a6a16b7a1a08b063ad",
1418+
"4ab6f33fd50237b105999cc6d32d85cce5dad61a",
1419+
"e1df9e306054655d7d41ec1ad75ade5d76a6888d",
1420+
"affe009b94eba41777cf02997b1780e50445d6af",
1421+
"0ce4618dbf5810aabb389edd4950c060b6b4d049",
1422+
"241cd8cd818cdc865cdf02f0c32a40081420b772",
1423+
],
1424+
extract_perf_shas(body).expect("extracting perf builds on v2 format failed"),
1425+
);
1426+
}
13571427
}

0 commit comments

Comments
 (0)