Skip to content

Add testing of collector profile_local. #702

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 23, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 30 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ jobs:
aws_access_key_id: "${{ env.AWS_ACCESS_KEY_ID }}"
aws_secret_access_key: "${{ secrets.AWS_SECRET_ACCESS_KEY }}"
if: github.ref == 'refs/heads/master' || github.ref == 'refs/heads/deploy'

test_benchmarks:
name: Test benchmarks
runs-on: ubuntu-latest
Expand Down Expand Up @@ -60,6 +61,7 @@ jobs:
run: sh -x -c "ci/check-benchmarks.sh"
env:
BENCH_INCLUDE_EXCLUDE_OPTS: "--exclude script-servo"

test_script_servo:
name: Test benchmark script-servo
runs-on: ubuntu-latest
Expand Down Expand Up @@ -92,3 +94,31 @@ jobs:
env:
BENCH_INCLUDE_EXCLUDE_OPTS: "--include script-servo"
SHELL: "/bin/bash"

test_profiling:
name: Test profiling
runs-on: ubuntu-latest
steps:
- name: Checkout the source code
uses: actions/checkout@v2
with:
fetch-depth: 1

- name: Install latest beta
uses: actions-rs/toolchain@v1
with:
toolchain: beta
override: true

- name: Configure environment
run: |
sudo apt-get update
sudo apt-get install -y linux-tools-common linux-tools-generic linux-tools-`uname -r`
echo -1 | sudo tee /proc/sys/kernel/perf_event_paranoid

- name: Build collector
run: cargo build -p collector

- name: Check benchmarks
run: sh -x -c "ci/check-profiling.sh"

15 changes: 9 additions & 6 deletions ci/check-benchmarks.sh
Original file line number Diff line number Diff line change
@@ -1,13 +1,16 @@
#!/bin/bash

set -x;
set -e -x;

bash -c "while true; do sleep 30; echo \$(date) - running ...; done" &
PING_LOOP_PID=$!
trap - ERR
trap 'kill $PING_LOOP_PID' ERR

# Install a toolchain.
RUST_BACKTRACE=1 RUST_LOG=collector_raw_cargo=trace,collector=debug,rust_sysroot=debug \
bindir=`cargo run -p collector --bin collector install_next` \
&& \
bindir=`cargo run -p collector --bin collector install_next`

# Do some benchmarking.
RUST_BACKTRACE=1 RUST_LOG=collector_raw_cargo=trace,collector=debug,rust_sysroot=debug \
cargo run -p collector --bin collector -- \
bench_local $bindir/rustc Test \
Expand All @@ -16,6 +19,6 @@ RUST_BACKTRACE=1 RUST_LOG=collector_raw_cargo=trace,collector=debug,rust_sysroot
--runs All \
--rustdoc $bindir/rustdoc \
$BENCH_INCLUDE_EXCLUDE_OPTS
code=$?

kill $PING_LOOP_PID
exit $code
exit 0
32 changes: 32 additions & 0 deletions ci/check-profiling.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
#!/bin/bash
#
# This script is basically just a smoke test. It only tests `eprintln`
# profiling because setting up the other profilers is something of a hassle.

set -e -x;

bash -c "while true; do sleep 30; echo \$(date) - running ...; done" &
PING_LOOP_PID=$!
trap 'kill $PING_LOOP_PID' ERR

# Install a toolchain.
RUST_BACKTRACE=1 RUST_LOG=collector_raw_cargo=trace,collector=debug,rust_sysroot=debug \
bindir=`cargo run -p collector --bin collector install_next`

# Profile with eprintln.
RUST_BACKTRACE=1 RUST_LOG=collector_raw_cargo=trace,collector=debug,rust_sysroot=debug \
cargo run -p collector --bin collector -- \
profile_local eprintln $bindir/rustc Test \
--cargo $bindir/cargo \
--include helloworld \
--runs Full

# Check that Check/Debug/Opt files are present, and that Doc files aren't
# present, becuase they're not done by default.
test -f results/eprintln-Test-helloworld-Check-Full
test -f results/eprintln-Test-helloworld-Debug-Full
test -f results/eprintln-Test-helloworld-Opt-Full
test ! -e results/eprintln-Test-helloworld-Doc-Full

kill $PING_LOOP_PID
exit 0