Skip to content

Commit e56aacb

Browse files
authored
Merge pull request #1475 from rust-lang/ci-runtime-test
Test runtime benchmarks on CI
2 parents b0fa2b9 + c48be4d commit e56aacb

File tree

4 files changed

+23
-13
lines changed

4 files changed

+23
-13
lines changed

.github/workflows/ci.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ jobs:
108108
- name: Build collector
109109
run: cargo build -p collector
110110

111-
- name: Check benchmarks
111+
- name: Check compile benchmarks
112112
run: sh -x -c "ci/check-compile-benchmarks.sh"
113113
env:
114114
JEMALLOC_OVERRIDE: /usr/lib/x86_64-linux-gnu/libjemalloc.so
@@ -195,7 +195,7 @@ jobs:
195195
- name: Build collector
196196
run: cargo build -p collector
197197

198-
- name: Check benchmarks
198+
- name: Check profiling
199199
run: sh -x -c "ci/check-profiling.sh"
200200

201201
database-check:

ci/check-runtime-benchmarks.sh

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,17 @@ bash -c "while true; do sleep 30; echo \$(date) - running ...; done" &
66
PING_LOOP_PID=$!
77
trap 'kill $PING_LOOP_PID' ERR 1 2 3 6
88

9-
# Check if the runtime benchmarks can be compiled.
10-
# Once we can actually run the benchmarks on CI, we will also execute them here.
11-
# Currently it is not possible because of `perf` permission issues when gathering perf. counters.
12-
cd collector/runtime-benchmarks
13-
cargo check
9+
# Install a toolchain.
10+
RUST_BACKTRACE=1 RUST_LOG=raw_cargo_messages=trace,collector=debug,rust_sysroot=debug \
11+
bindir=`cargo run -p collector --bin collector install_next`
12+
13+
# Do some benchmarking.
14+
RUST_LOG=raw_cargo_messages=trace,collector=debug,rust_sysroot=debug \
15+
cargo run -p collector --bin collector -- \
16+
bench_runtime_local $bindir/rustc \
17+
--cargo $bindir/cargo \
18+
--iterations 1 \
19+
--id Test
1420

1521
kill $PING_LOOP_PID
1622
exit 0

collector/src/bin/collector.rs

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -704,9 +704,16 @@ fn main_result() -> anyhow::Result<i32> {
704704

705705
match args.command {
706706
Commands::BenchRuntimeLocal { local, iterations } => {
707-
bench_runtime(
707+
let toolchain = get_local_toolchain(
708+
&[Profile::Opt],
708709
&local.rustc,
710+
None,
711+
local.cargo.as_deref(),
709712
local.id.as_deref(),
713+
"",
714+
)?;
715+
bench_runtime(
716+
toolchain,
710717
BenchmarkFilter::new(local.exclude, local.include),
711718
runtime_benchmark_dir,
712719
iterations,

collector/src/runtime/mod.rs

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
mod benchmark;
22

3-
use crate::benchmark::profile::Profile;
4-
use crate::toolchain::get_local_toolchain;
3+
use crate::toolchain::LocalToolchain;
54
use benchlib::comm::messages::{BenchmarkMessage, BenchmarkResult, BenchmarkStats};
65
use std::io::{BufRead, BufReader};
76
use std::path::{Path, PathBuf};
@@ -14,13 +13,11 @@ pub use benchmark::BenchmarkFilter;
1413
/// to a Cargo crate. All binaries built by that crate will are expected to be runtime benchmark
1514
/// groups that leverage `benchlib`.
1615
pub fn bench_runtime(
17-
rustc: &str,
18-
id: Option<&str>,
16+
toolchain: LocalToolchain,
1917
filter: BenchmarkFilter,
2018
benchmark_dir: PathBuf,
2119
iterations: u32,
2220
) -> anyhow::Result<()> {
23-
let toolchain = get_local_toolchain(&[Profile::Opt], rustc, None, None, id, "")?;
2421
let suite = benchmark::discover_benchmarks(&toolchain, &benchmark_dir)?;
2522

2623
let total_benchmark_count = suite.total_benchmark_count();

0 commit comments

Comments
 (0)