Skip to content

Commit cc0c450

Browse files
authored
[kaizen] add script for running ETS locally (#1110)
1 parent ce5236d commit cc0c450

File tree

2 files changed

+60
-0
lines changed

2 files changed

+60
-0
lines changed

ets/README.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,16 @@ options. Oh, and this readme file is in there too, of course.
88
* ETS: https://github.com/ethereum/tests
99
* retesteth: https://github.com/ethereum/retesteth
1010

11+
## Running locally
12+
13+
Use the `ets/run` wrapper script to boot Mantis and run retesteth against it.
14+
On a Mac you will want to do this using Docker:
15+
16+
nix-in-docker/run --command "ets/run"
17+
18+
Read on for more fine-grained control over running Mantis and retesteth, by
19+
running them separately.
20+
1121
## Continous integration
1222

1323
The tests are run on CI. For more details look at `.buildkite/pipeline.nix` and

ets/run

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
#!/usr/bin/env bash
2+
3+
# Boots Mantis and runs retesteth / ETS. Intended for running it locally.
4+
5+
if [ -z "$SBT" ]; then
6+
SBT="sbt"
7+
fi
8+
9+
echo "booting Mantis with log level WARN and waiting for RPC API to be up."
10+
$SBT -Dconfig.file=./src/main/resources/conf/testmode.conf -Dlogging.logs-level=WARN run &
11+
12+
while ! nc -z localhost 8546; do
13+
sleep 0.1
14+
done
15+
16+
final_exit_code=0
17+
mkdir -p out/
18+
19+
function run_and_summarize {
20+
out_file="out/retesteth-$1-log.txt"
21+
22+
echo "running retesteth $1 with output to $out_file"
23+
timeout 15m ets/retesteth -t "$1" -- --verbosity 3 &> $out_file
24+
exit_code=$?
25+
echo "retesteth $1 exit code: $exit_code"
26+
27+
style="info"
28+
if [[ "$exit_code" -gt "0" ]]; then
29+
final_exit_code="$exit_code"
30+
style="error"
31+
fi
32+
33+
summary=$(sed -n '/Total Tests Run/,$p' $out_file)
34+
if [[ -z "$summary" ]]; then
35+
summary="retesteth crashed; check the artifacts"
36+
fi
37+
passed=$(grep -oP 'Total Tests Run: \d+' $out_file)
38+
failed=$(grep -oP 'TOTAL ERRORS DETECTED: \d+' $out_file)
39+
40+
echo "retesteth: $1 -- $passed -- $failed"
41+
echo "$summary"
42+
}
43+
44+
run_and_summarize "GeneralStateTests"
45+
run_and_summarize "BlockchainTests"
46+
47+
echo "shutting down mantis"
48+
kill %1
49+
50+
exit $final_exit_code

0 commit comments

Comments
 (0)