Skip to content

Commit

Permalink
chore(levm): daily report levm tests & diff (#1668)
Browse files Browse the repository at this point in the history
**Motivation**
We want to compare the default feature build vs the one using levm,
since we want
to be aware of possible regressions while using said vm.

Closes #1645.
Closes #1627
  • Loading branch information
fkrause98 authored Jan 10, 2025
1 parent f393683 commit affb8e9
Show file tree
Hide file tree
Showing 6 changed files with 171 additions and 6 deletions.
87 changes: 87 additions & 0 deletions .github/scripts/levm_revm_diff.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
#!/bin/bash

if [ "$#" -ne 2 ]; then
echo "Usage: $0 <revm_file> <levm_file>"
exit 1
fi

revm_file=$1
levm_file=$2

# Check if files exist
if [ ! -f "$revm_file" ]; then
echo "Error: Revm file '$revm_file' not found"
exit 1
fi

if [ ! -f "$levm_file" ]; then
echo "Error: LEVM file '$levm_file' not found"
exit 1
fi

# Create a temporary file
TEMP_FILE=$(mktemp)
trap 'rm -f $TEMP_FILE' EXIT

get_last_section() {
tac "$1" | sed -n "1,/\*Total:/p" | tac
}

parse_results() {
while IFS= read -r line; do
if [[ $line =~ ^[[:space:]]*[^*] && $line =~ : ]]; then
name=$(echo "$line" | cut -d':' -f1 | tr -d '\t' | sed 's/^[[:space:]]*//;s/[[:space:]]*$//')
values=$(echo "$line" | cut -d':' -f2 | tr -d ' ')
passed=$(echo "$values" | cut -d'/' -f1)
total=$(echo "$values" | cut -d'/' -f2 | cut -d'(' -f1)
percentage=$(echo "$values" | grep -o "[0-9.]*%" | tr -d '%')
echo "$name|$passed|$total|$percentage"
fi
done < <(get_last_section "$1")
}

revm_results=$(parse_results "$revm_file")
levm_results=$(parse_results "$levm_file")

found_differences=false

echo "$revm_results" > "$TEMP_FILE"

while IFS='|' read -r name revm_passed revm_total revm_percentage; do
if [ -n "$name" ]; then
levm_line=$(echo "$levm_results" | grep "^$name|" || true)
if [ -n "$levm_line" ]; then
levm_passed=$(echo "$levm_line" | cut -d'|' -f2)
levm_total=$(echo "$levm_line" | cut -d'|' -f3)
levm_percentage=$(echo "$levm_line" | cut -d'|' -f4)

if [ "$levm_passed" != "$revm_passed" ]; then
if [ "$found_differences" = false ]; then
echo "Found differences between LEVM and revm: :warning:"
echo
found_differences=true
fi
if [ "$levm_passed" -gt "$revm_passed" ]; then
echo "• *$name* (improvement :arrow_up:):"
else
echo "• *$name* (regression :arrow_down:):"
fi
echo " - Revm: $revm_passed/$revm_total ($revm_percentage%)"
echo " - LEVM: $levm_passed/$levm_total ($levm_percentage%)"
echo 1 >> "$TEMP_FILE.diff"
fi
else
if [ "$found_differences" = false ]; then
echo "Found differences between LEVM and revm: :warning:"
echo
found_differences=true
fi
echo "• *$name*: Test present in revm but missing in LEVM :x:"
echo 1 >> "$TEMP_FILE.diff"
fi
fi
done < "$TEMP_FILE"

if [ ! -f "$TEMP_FILE.diff" ]; then
echo "No differences found between revm and LEVM implementations! :white_check_mark:"
fi
2 changes: 1 addition & 1 deletion .github/scripts/publish.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
curl -X POST $url \
-H 'Content-Type: application/json; charset=utf-8' \
--data @- <<EOF
$(jq -n --arg text "$(cat results.md)" '{
$(jq -n --arg text "$(cat results_default.md)" '{
"blocks": [
{
"type": "header",
Expand Down
22 changes: 22 additions & 0 deletions .github/scripts/publish_diff.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
curl -X POST $url \
-H 'Content-Type: application/json; charset=utf-8' \
--data @- <<EOF
$(jq -n --arg text "$(cat results_default.md)" '{
"blocks": [
{
"type": "header",
"text": {
"type": "plain_text",
"text": "Daily Hive Coverage report"
}
},
{
"type": "section",
"text": {
"type": "mrkdwn",
"text": $text
}
}
]
}')
EOF
2 changes: 1 addition & 1 deletion .github/scripts/publish_levm_hive.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
curl -X POST $url \
-H 'Content-Type: application/json; charset=utf-8' \
--data @- <<EOF
$(jq -n --arg text "$(cat results.md)" '{
$(jq -n --arg text "$(cat results_levm.md)" '{
"blocks": [
{
"type": "header",
Expand Down
22 changes: 22 additions & 0 deletions .github/scripts/publish_revm_levm_diff.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
curl -X POST $url \
-H 'Content-Type: application/json; charset=utf-8' \
--data @- <<EOF
$(jq -n --arg text "$(cat diff.md)" '{
"blocks": [
{
"type": "header",
"text": {
"type": "plain_text",
"text": "Hive tests revm vs levm diff"
}
},
{
"type": "section",
"text": {
"type": "mrkdwn",
"text": $text
}
}
]
}')
EOF
42 changes: 38 additions & 4 deletions .github/workflows/daily_reports.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ jobs:
with:
name: ${{ matrix.test.file_name }}_${{ matrix.vm }}_logs
path: hive/workspace/logs/*-*.json
if-no-files-found: error

hive-report:
name: Generate report and upload to slack (${{ matrix.vm }})
Expand Down Expand Up @@ -89,6 +90,13 @@ jobs:
- name: Generate the hive report
run: cargo run -p hive_report > results.md

- name: Upload ${{matrix.vm}} result
uses: actions/upload-artifact@v4
with:
name: results_${{matrix.vm}}.md
path: results.md
if-no-files-found: error

- name: Post results in summary
run: |
echo "# Hive coverage report (${{ matrix.vm }})" >> $GITHUB_STEP_SUMMARY
Expand All @@ -114,6 +122,32 @@ jobs:
sh .github/scripts/publish_levm_hive.sh
fi
hive-diff-report:
name: Post tests diff to levm slack
needs: hive-report
runs-on: ubuntu-latest
steps:
- name: Checkout sources
uses: actions/checkout@v4

- name: Download results (levm)
uses: actions/download-artifact@v4
with:
name: results_levm.md

- name: Download results (revm)
uses: actions/download-artifact@v4
with:
name: results_revm.md

- name: Post results diff in LEVM channel
env:
url: ${{ secrets.LEVM_SLACK_WEBHOOK }}
run: |
bash .github/scripts/levm_revm_diff.sh results_revm.md results_levm.md >> diff.md
cat diff.md >> $GITHUB_STEP_SUMMARY
bash .github/scripts/publish_revm_levm_diff.sh
levm-test:
name: Generate Report for LEVM EF Tests
runs-on: ubuntu-latest
Expand Down Expand Up @@ -144,10 +178,10 @@ jobs:
echo "# Daily LEVM EF Tests Run Report" >> $GITHUB_STEP_SUMMARY
cat cmd/ef_tests/levm/levm_ef_tests_summary_github.txt >> $GITHUB_STEP_SUMMARY
- name: Post results to ethrex L2 slack channel
env:
url: ${{ secrets.ETHREX_L2_SLACK_WEBHOOK }}
run: sh .github/scripts/publish_levm_ef_tests_summary.sh
# - name: Post results to ethrex L2 slack channel
# env:
# url: ${{ secrets.ETHREX_L2_SLACK_WEBHOOK }}
# run: sh .github/scripts/publish_levm_ef_tests_summary.sh

- name: Post results to levm slack channel
env:
Expand Down

0 comments on commit affb8e9

Please sign in to comment.