Skip to content

Run EVM tests with --rts-statistics and collect the results #2533

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 26 commits into from
May 6, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
aad86c6
Run tests with --rts-statistics and collect the results
andreiburdusa Apr 7, 2021
49d73e9
Merge branch 'master' into issue-2455
ttuegel Apr 9, 2021
772cc17
test-statistics.sh: Output a CSV file for easy manipulation
ttuegel Apr 23, 2021
6d69770
Add scripts/join-statistics.sh
ttuegel Apr 27, 2021
699f8b1
Allow running test-statistics.sh from test.nix shell
ttuegel Apr 27, 2021
7a4d0ff
Add Performance workflow
ttuegel Apr 27, 2021
fc0a36f
Do not run Performance workflow on macOS
ttuegel Apr 27, 2021
38d9d75
Fix statistics script invocation
ttuegel Apr 28, 2021
2a7cec7
Pull from runtimeverification in Performance workflow
ttuegel Apr 28, 2021
5961ad8
Use test.nix for running test-statistics.sh
ttuegel Apr 28, 2021
c3172ce
Use nix/shell.performance.nix for performance testing
ttuegel Apr 28, 2021
0f8c667
Fetch from origin in Performance workflow
ttuegel Apr 28, 2021
b35795c
test-statistics.sh: Build own kore-exec
ttuegel Apr 28, 2021
bc08b55
test-statistics.sh: Build kore-exec from other trees
ttuegel Apr 28, 2021
ada5d5e
Use test.nix for running test-statistics.sh
ttuegel Apr 28, 2021
8290362
Merge branch 'master' into issue-2455
ttuegel Apr 28, 2021
a12facb
Use tabular JSON format
ttuegel Apr 29, 2021
1d52d0c
Fix path to test-statistics.sh
ttuegel Apr 29, 2021
77a3b0d
Comment on pull request with performance data
ttuegel Apr 29, 2021
5225c1d
Use CSV for intermediate tables
ttuegel May 3, 2021
ccdbbf7
Merge branch 'master' into issue-2455
ttuegel May 4, 2021
ceaa893
Integrate performance testing into Test workflow
ttuegel May 4, 2021
4cde50e
test-statistics.sh: accept multiple test directories
ttuegel May 5, 2021
209caf9
test.yml: Test wasm-semantics, too
ttuegel May 5, 2021
df0fc3c
Merge branch 'master' into issue-2455
ttuegel May 5, 2021
4670195
Merge branch 'master' into issue-2455
rv-jenkins May 6, 2021
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
46 changes: 46 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -214,3 +214,49 @@ jobs:

- name: Run hlint
run: curl -sSL https://raw.github.com/ndmitchell/hlint/master/misc/run.sh | sh -s kore -j

performance:
needs: [nix-build]
name: 'Performance'
runs-on: ubuntu-latest
steps:
- name: Check out code
uses: actions/[email protected]
with:
# Check out pull request HEAD instead of merge commit.
ref: ${{ github.event.pull_request.head.sha }}
submodules: recursive

- name: Install Nix
uses: cachix/install-nix-action@v12
with:
extra_nix_config: |
substituters = http://cache.nixos.org https://hydra.iohk.io
trusted-public-keys = cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY= hydra.iohk.io:f/Ea+s+dFdN+3Y/G+FDgSq+a5NEWhJGzdjvKNGv0/EQ=

- name: Install Cachix
uses: cachix/cachix-action@v8
with:
name: kore
extraPullNames: runtimeverification
signingKey: '${{ secrets.KORE_CACHIX_SIGNING_KEY }}'
skipPush: true

- name: Collect performance statistics
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
./scripts/test-statistics.sh ./. \
test/regression-evm \
test/regression-wasm \
> pull-request.json
git fetch origin
git worktree add kore-master master
./scripts/test-statistics.sh ./kore-master \
test/regression-evm \
test/regression-wasm \
> master.json
./scripts/join-statistics.sh master.json pull-request.json \
| ./scripts/format-statistics.sh \
> comment.md
gh pr comment ${{ github.event.pull_request.number }} -F comment.md
4 changes: 4 additions & 0 deletions scripts/format-statistics.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/usr/bin/env nix-shell
#!nix-shell ../test.nix -i bash

mlr --icsv --omd cut -o -f name,allocated_bytes,diff_allocated_bytes,max_live_bytes,diff_max_live_bytes
12 changes: 12 additions & 0 deletions scripts/join-statistics.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#!/usr/bin/env nix-shell
#!nix-shell ../test.nix -i bash

old=${1:?}; shift
new=${1:?}; shift

# 1. Join the statistics files by row according to name.
# Give the columns from each file a unique prefix.
# 2. Add a column for the (relative) difference between old and new values.
mlr --ijson --ocsv join -j name --lp old_ --rp new_ -f "$old" "$new" \
| mlr --csv put '$diff_allocated_bytes = ($new_allocated_bytes - $old_allocated_bytes) / $old_allocated_bytes' \
| mlr --csv put '$diff_max_live_bytes = ($new_max_live_bytes - $old_max_live_bytes) / $old_max_live_bytes'
28 changes: 28 additions & 0 deletions scripts/test-statistics.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
#!/usr/bin/env nix-shell
#!nix-shell ../test.nix -i bash

# Usage: test-statistics.sh KORE_DIR TEST_DIR TEST_DIR ...
# Output: tabular JSON on standard output

set -eou pipefail

kore_dir="${1:?}"; shift
export KORE_EXEC="$(nix-build "$kore_dir" -A kore --arg release true --no-out-link)/bin/kore-exec"

while [[ $# -gt 0 ]]
do
test_dir="${1:?}"; shift
(
cd "$test_dir"
for each in $(find ./ -name 'test-*.sh')
do
json="${each%sh}.json"
"${each}" --rts-statistics "$json" >/dev/null
jq ". | { name: \"$test_dir${each#.}\", allocated_bytes: .allocated_bytes, max_live_bytes: .max_live_bytes }" < "$json"
rm "$json"
done
)
done



4 changes: 3 additions & 1 deletion test.nix
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ in

let
inherit (pkgs) stdenv lib;
inherit (pkgs) bison diffutils ncurses z3;
inherit (pkgs) bison diffutils jq miller ncurses z3;

ttuegel =
let
Expand Down Expand Up @@ -44,11 +44,13 @@ stdenv.mkDerivation {
buildInputs = [
k kore # some tests use kore-exec directly, others run through the frontend
ncurses # TODO: .../lib/kframework/setenv: line 31: tput: command not found
jq miller # processing test statistics
z3
];
configurePhase = ''
export TOP=$(pwd)
'';
KORE_EXEC = "${lib.getBin kore}/bin/kore-exec";
buildFlags =
[
"KORE_PARSER=kore-parser"
Expand Down