Skip to content

Commit be46d5e

Browse files
committed
Add testing of collector profile_local.
1 parent 48cdb26 commit be46d5e

File tree

2 files changed

+74
-0
lines changed

2 files changed

+74
-0
lines changed

.github/workflows/ci.yml

+30
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ jobs:
3232
aws_access_key_id: "${{ env.AWS_ACCESS_KEY_ID }}"
3333
aws_secret_access_key: "${{ secrets.AWS_SECRET_ACCESS_KEY }}"
3434
if: github.ref == 'refs/heads/master' || github.ref == 'refs/heads/deploy'
35+
3536
test_benchmarks:
3637
name: Test benchmarks
3738
runs-on: ubuntu-latest
@@ -60,6 +61,7 @@ jobs:
6061
run: sh -x -c "ci/check-benchmarks.sh"
6162
env:
6263
BENCH_INCLUDE_EXCLUDE_OPTS: "--exclude script-servo"
64+
6365
test_script_servo:
6466
name: Test benchmark script-servo
6567
runs-on: ubuntu-latest
@@ -92,3 +94,31 @@ jobs:
9294
env:
9395
BENCH_INCLUDE_EXCLUDE_OPTS: "--include script-servo"
9496
SHELL: "/bin/bash"
97+
98+
test_profiling:
99+
name: Test profiling
100+
runs-on: ubuntu-latest
101+
steps:
102+
- name: Checkout the source code
103+
uses: actions/checkout@v2
104+
with:
105+
fetch-depth: 1
106+
107+
- name: Install latest nightly
108+
uses: actions-rs/toolchain@v1
109+
with:
110+
toolchain: nightly
111+
override: true
112+
113+
- name: Configure environment
114+
run: |
115+
sudo apt-get update
116+
sudo apt-get install -y linux-tools-common linux-tools-generic linux-tools-`uname -r`
117+
echo -1 | sudo tee /proc/sys/kernel/perf_event_paranoid
118+
119+
- name: Build collector
120+
run: cargo build -p collector
121+
122+
- name: Check benchmarks
123+
run: sh -x -c "ci/check-profiling.sh"
124+

ci/check-profiling.sh

+44
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
#!/bin/bash
2+
#
3+
# This script is basically just a smoke test. It tests a couple of the
4+
# profiling tools on a few benchmarks.
5+
6+
set -x;
7+
8+
bash -c "while true; do sleep 30; echo \$(date) - running ...; done" &
9+
PING_LOOP_PID=$!
10+
trap - ERR
11+
12+
RUST_BACKTRACE=1 RUST_LOG=collector_raw_cargo=trace,collector=debug,rust_sysroot=debug \
13+
bindir=`cargo run -p collector --bin collector install_next` \
14+
&& \
15+
\
16+
RUST_BACKTRACE=1 RUST_LOG=collector_raw_cargo=trace,collector=debug,rust_sysroot=debug \
17+
cargo run -p collector --bin collector -- \
18+
profile_local eprintln $bindir/rustc Test \
19+
--cargo $bindir/cargo \
20+
--include helloworld \
21+
--runs Full \
22+
&& \
23+
test -f results/eprintln-Test-helloworld-Check-Full && \
24+
test -f results/eprintln-Test-helloworld-Debug-Full && \
25+
test -f results/eprintln-Test-helloworld-Opt-Full && \
26+
test ! -e results/eprintln-Test-helloworld-Doc-Full && \
27+
\
28+
RUST_BACKTRACE=1 RUST_LOG=collector_raw_cargo=trace,collector=debug,rust_sysroot=debug \
29+
cargo run -p collector --bin collector -- \
30+
profile_local self-profile $bindir/rustc Test \
31+
--builds Debug \
32+
--cargo $bindir/cargo \
33+
--include futures \
34+
--runs IncrUnchanged \
35+
&& \
36+
test -f results/crox-Test-futures-Debug-IncrUnchanged && \
37+
test -f results/flamegraph-Test-futures-Debug-IncrUnchanged && \
38+
test -f results/summarize-Test-futures-Debug-IncrUnchanged && \
39+
test -d results/Zsp-Test-futures-Debug-IncrUnchanged
40+
41+
code=$?
42+
kill $PING_LOOP_PID
43+
exit $code
44+

0 commit comments

Comments
 (0)