diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index efb779e21..d763ba0a4 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -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 @@ -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 @@ -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" + diff --git a/ci/check-benchmarks.sh b/ci/check-benchmarks.sh index 07228bc28..ca2b62d8d 100755 --- a/ci/check-benchmarks.sh +++ b/ci/check-benchmarks.sh @@ -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 \ @@ -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 diff --git a/ci/check-profiling.sh b/ci/check-profiling.sh new file mode 100755 index 000000000..846d9d98e --- /dev/null +++ b/ci/check-profiling.sh @@ -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