Skip to content

Commit 61d516f

Browse files
committed
add tests for extract_perf_shas
Some real-world examples in the 2 different formats
1 parent 8dfe7f7 commit 61d516f

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

0 commit comments

Comments
 (0)