Skip to content

Commit 947a599

Browse files
author
Leo
authored
Merge pull request #12441 from ethereum/benchmarking-ext-tests
Benchmarking external tests
2 parents e3e77c0 + 60d9aa0 commit 947a599

22 files changed

+1261
-39
lines changed

.circleci/config.yml

Lines changed: 46 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -583,7 +583,7 @@ defaults:
583583
project: uniswap
584584
binary_type: native
585585
nodejs_version: '16'
586-
- job_native_test_prb_math: &job_native_test_prb_math
586+
- job_native_test_ext_prb_math: &job_native_test_ext_prb_math
587587
<<: *workflow_ubuntu2004_static
588588
name: t_native_test_ext_prb_math
589589
project: prb-math
@@ -1206,8 +1206,34 @@ jobs:
12061206
name: External <<parameters.project>> tests (native)
12071207
command: |
12081208
test/externalTests/<<parameters.project>>.sh native /tmp/workspace/solc/solc
1209+
- store_artifacts:
1210+
path: reports/externalTests/
1211+
# persist_to_workspace fails if the directory does not exist and the test script will create
1212+
# it only if it actually has benchmark results.
1213+
- run: mkdir -p reports/externalTests/
1214+
- persist_to_workspace:
1215+
root: .
1216+
paths:
1217+
- reports/externalTests/
12091218
- gitter_notify_failure_unless_pr
12101219

1220+
c_ext_benchmarks:
1221+
<<: *base_node_small
1222+
steps:
1223+
- checkout
1224+
- attach_workspace:
1225+
at: .
1226+
- run:
1227+
name: Combine benchmark reports
1228+
command: cat reports/externalTests/benchmark-*.json | scripts/externalTests/merge_benchmarks.sh > reports/externalTests/all-benchmarks.json
1229+
- run:
1230+
name: Summarize reports
1231+
command: cat reports/externalTests/all-benchmarks.json | scripts/externalTests/summarize_benchmarks.sh > reports/externalTests/summarized-benchmarks.json
1232+
- store_artifacts:
1233+
path: reports/externalTests/all-benchmarks.json
1234+
- store_artifacts:
1235+
path: reports/externalTests/summarized-benchmarks.json
1236+
12111237
b_win: &b_win
12121238
<<: *base_win_powershell_large
12131239
steps:
@@ -1455,9 +1481,27 @@ workflows:
14551481
- t_ems_ext: *job_native_test_ext_pool_together
14561482
- t_ems_ext: *job_native_test_ext_perpetual_pools
14571483
- t_ems_ext: *job_native_test_ext_uniswap
1458-
- t_ems_ext: *job_native_test_prb_math
1484+
- t_ems_ext: *job_native_test_ext_prb_math
14591485
- t_ems_ext: *job_native_test_ext_elementfi
14601486

1487+
- c_ext_benchmarks:
1488+
<<: *workflow_trigger_on_tags
1489+
requires:
1490+
- t_ems_compile_ext_colony
1491+
- t_native_compile_ext_gnosis
1492+
- t_native_test_ext_gnosis_v2
1493+
- t_native_test_ext_zeppelin
1494+
- t_native_test_ext_ens
1495+
- t_native_test_ext_trident
1496+
- t_native_test_ext_euler
1497+
- t_native_test_ext_yield_liquidator
1498+
- t_native_test_ext_bleeps
1499+
- t_native_test_ext_pool_together
1500+
- t_native_test_ext_perpetual_pools
1501+
- t_native_test_ext_uniswap
1502+
- t_native_test_ext_prb_math
1503+
- t_native_test_ext_elementfi
1504+
14611505
# Windows build and tests
14621506
- b_win: *workflow_trigger_on_tags
14631507
- b_win_release: *workflow_trigger_on_tags
Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
#!/usr/bin/env bash
2+
3+
# ------------------------------------------------------------------------------
4+
# Reads multiple individual benchmark reports produced by scripts from
5+
# test/externalTests/ from standard input and creates a combined report.
6+
#
7+
# Usage:
8+
# <script name>.sh < <CONCATENATED_REPORTS>
9+
#
10+
# CONCATENATED_REPORTS: JSON report files concatenated into a single stream (e.g. using cat).
11+
#
12+
# Example:
13+
# cat reports/externalTests/benchmark-*.json | <script name>.sh
14+
# ------------------------------------------------------------------------------
15+
# This file is part of solidity.
16+
#
17+
# solidity is free software: you can redistribute it and/or modify
18+
# it under the terms of the GNU General Public License as published by
19+
# the Free Software Foundation, either version 3 of the License, or
20+
# (at your option) any later version.
21+
#
22+
# solidity is distributed in the hope that it will be useful,
23+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
24+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
25+
# GNU General Public License for more details.
26+
#
27+
# You should have received a copy of the GNU General Public License
28+
# along with solidity. If not, see <http://www.gnu.org/licenses/>
29+
#
30+
# (c) 2021 solidity contributors.
31+
#------------------------------------------------------------------------------
32+
33+
set -euo pipefail
34+
35+
# We expect a series of dicts of the form {"<project>": {"<preset>": {...}}}.
36+
# Unfortunately jq's built-in `add` filter can't handle nested dicts and
37+
# would just overwrite values sharing a project name instead of merging them.
38+
39+
# This is done by first grouping the dicts into an array of the form
40+
# [
41+
# [{"key": "<project1>", "value": {"<preset1>": {...}}}, {"key": "<project1>", "value": {"<preset2>": {...}}, ...],
42+
# [{"key": "<project2>", "value": {"<preset1>": {...}}}, {"key": "<project2>", "value": {"<preset2>": {...}}, ...],
43+
# ...
44+
# ]
45+
# and then using reduce() on each group sharing the same project name to convert it into a
46+
# dict having preset names as keys.
47+
jq --slurp --indent 4 --sort-keys '
48+
map(to_entries[]) |
49+
group_by(.key) |
50+
map({
51+
(.[0].key): (
52+
reduce (.[].value | to_entries[]) as {$key, $value} (
53+
{}; . + {
54+
($key): $value
55+
}
56+
)
57+
)
58+
}) |
59+
add
60+
'

0 commit comments

Comments
 (0)