Skip to content

Commit f711e7a

Browse files
authored
Create a performance test suite and add s2n-quic as a test (rust-lang#1267)
* Add s2n-quic as a submodule * Add a script for running performance tests * Add a CI workflow for running performance tests
1 parent 217f45a commit f711e7a

File tree

6 files changed

+99
-0
lines changed

6 files changed

+99
-0
lines changed

.github/workflows/kani.yml

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,25 @@ jobs:
2626
- name: Execute Kani regression
2727
run: ./scripts/kani-regression.sh
2828

29+
perf:
30+
runs-on: ubuntu-20.04
31+
steps:
32+
- name: Checkout Kani
33+
uses: actions/checkout@v2
34+
35+
- name: Setup Kani Dependencies
36+
uses: ./.github/actions/setup
37+
with:
38+
os: ubuntu-20.04
39+
40+
- name: Build Kani
41+
run: |
42+
export RUST_BACKTRACE=1
43+
cargo build --workspace
44+
45+
- name: Execute Kani performance tests
46+
run: ./scripts/kani-perf.sh
47+
2948
bookrunner:
3049
runs-on: ubuntu-20.04
3150
permissions:

.gitmodules

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,3 +10,7 @@
1010
[submodule "firecracker"]
1111
path = firecracker
1212
url = https://github.com/firecracker-microvm/firecracker.git
13+
[submodule "tests/perf/s2n-quic"]
14+
path = tests/perf/s2n-quic
15+
url = https://github.com/aws/s2n-quic
16+
branch = main

scripts/kani-perf.sh

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
#!/usr/bin/env bash
2+
# Copyright Kani Contributors
3+
# SPDX-License-Identifier: Apache-2.0 OR MIT
4+
5+
set -o pipefail
6+
set -o nounset
7+
8+
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
9+
KANI_DIR=$SCRIPT_DIR/..
10+
11+
# Build all packages in the workspace
12+
cargo build --workspace
13+
14+
PERF_DIR="${KANI_DIR}/tests/perf"
15+
16+
# Copy expected files from overlay directories
17+
to_delete=
18+
for overlay_dir in ${PERF_DIR}/overlays/*/; do
19+
orig_dir=$(basename ${overlay_dir})
20+
echo "Copying overlays for $orig_dir"
21+
copy_output=$(cp -r -v ${overlay_dir}* ${PERF_DIR}/${orig_dir}/)
22+
copied_files=$(echo ${copy_output} | rev | cut -d' ' -f 1 | rev | tr -d "'")
23+
# Add to the list of files to delete
24+
to_delete="${to_delete} ${copied_files}"
25+
done
26+
27+
suite="perf"
28+
mode="cargo-kani"
29+
echo "Check compiletest suite=$suite mode=$mode"
30+
cargo run -p compiletest -- --suite $suite --mode $mode
31+
exit_code=$?
32+
33+
echo "Cleaning up..."
34+
rm ${to_delete}
35+
36+
echo
37+
if [ $exit_code -eq 0 ]; then
38+
echo "All Kani perf tests completed successfully."
39+
else
40+
echo "***Kani perf tests failed."
41+
fi
42+
echo

tests/perf/overlays/README.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# Copyright Kani Contributors
2+
# SPDX-License-Identifier: Apache-2.0 OR MIT
3+
4+
This directory contains "overlay" files (e.g. expected files) that should be copied into directories under perf before running compiletest.
5+
6+
Explanation: compiletest's cargo-kani mode (which is used for running the perf tests) looks for "<harness-name>.expected" files and runs `cargo kani --harness <harness-name>` for each.
7+
Some of the perf tests are external repositories that are integrated as git submodules, so we cannot commit files in their subtrees.
8+
Thus, we instead commit any files needed under the "overlays" directory, which then get copied over by `kani-perf.sh` before it calls compiletest.
9+
10+
To create overlay files for `perf/foo`, place them in a `perf/overlays/foo` directory.
11+
They will get copied over following the same directory structure.
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
Status: SUCCESS\
2+
Description: "assertion failed: a == b"
3+
4+
Status: SUCCESS\
5+
Description: "assertion failed: from.len() > from_index"
6+
7+
Status: SUCCESS\
8+
Description: "assertion failed: to.len() > to_index"
9+
10+
Status: SUCCESS\
11+
Description: "assertion failed: from.len() >= from_offset"
12+
13+
Status: SUCCESS\
14+
Description: "assertion failed: to.len() >= to_offset"
15+
16+
Status: SUCCESS\
17+
Description: "assertion failed: from.len() >= len"
18+
19+
Status: SUCCESS\
20+
Description: "assertion failed: to.len() >= len"
21+
22+
VERIFICATION:- SUCCESSFUL

tests/perf/s2n-quic

Submodule s2n-quic added at 2158407

0 commit comments

Comments
 (0)