Skip to content
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

test: add small batch of MPT tests to CI #3

Merged
merged 1 commit into from
May 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
4 changes: 3 additions & 1 deletion .github/workflows/main.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -36,4 +36,6 @@ jobs:
- name: Run Cairo tests
env:
RPC_URL_MAINNET: ${{ secrets.RPC_URL_MAINNET }}
run: source ./tools/make/cairo_tests.sh
run: source ./tools/make/cairo_tests.sh
- name: Run MPT tests
run: source ./tools/make/fuzzer.sh tests/fuzzing/mpt.cairo --ci
859 changes: 0 additions & 859 deletions tests/fuzzing/fixtures/mpt_proofs_172.json

This file was deleted.

873 changes: 0 additions & 873 deletions tests/fuzzing/fixtures/mpt_proofs_207.json

This file was deleted.

777 changes: 0 additions & 777 deletions tests/fuzzing/fixtures/mpt_proofs_227.json

This file was deleted.

864 changes: 0 additions & 864 deletions tests/fuzzing/fixtures/mpt_proofs_39.json

This file was deleted.

887 changes: 0 additions & 887 deletions tests/fuzzing/fixtures/mpt_proofs_516.json

This file was deleted.

854 changes: 0 additions & 854 deletions tests/fuzzing/fixtures/mpt_proofs_52.json

This file was deleted.

854 changes: 0 additions & 854 deletions tests/fuzzing/fixtures/mpt_proofs_55.json

This file was deleted.

2 changes: 1 addition & 1 deletion tools/make/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ process_cairo_file() {
export -f process_cairo_file

# Use --halt now,fail=1 to return non-zero if any task fails
find ./lib ./tests.fuzzing ./tests/cairo_programs -name "*.cairo" | parallel --halt now,fail=1 process_cairo_file
find ./lib ./tests/fuzzing ./tests/cairo_programs -name "*.cairo" | parallel --halt now,fail=1 process_cairo_file

# Capture the exit status of parallel
exit_status=$?
Expand Down
3 changes: 3 additions & 0 deletions tools/make/ci_local.sh
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@ echo "Run Python Format Check..."
echo "Run Cairo Tests..."
(source ./tools/make/cairo_tests.sh)

echo "Run MPT Tests..."
(source ./tools/make/fuzzer.sh tests/fuzzing/mpt.cairo --ci)

# End time
end_time=$SECONDS

Expand Down
25 changes: 25 additions & 0 deletions tools/make/fuzzer.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,17 @@
# Activate virtual environment
source venv/bin/activate

# Define a boolean argument
IS_CI_RUN=false

for arg in "$@"
do
if [ "$arg" == "--ci" ]
then
IS_CI_RUN=true
fi
done

# Get the Cairo file from the command line argument
cairo_file="$1"
filename=$(basename "$cairo_file" .cairo)
Expand Down Expand Up @@ -54,6 +65,20 @@ cairo-compile --cairo_path="packages/eth_essentials" "$cairo_file" --output "bui
# Use --halt now,fail=1 to return non-zero if any task fails
find ./tests/fuzzing/fixtures -name "*.json" | parallel --halt now,fail=1 process_input $filename

# Clone the repository if the directory doesn't exist
if [ ! -d "mpt-fixtures" ]; then
git clone https://github.com/HerodotusDev/mpt-fixtures
fi

echo "Starting tests..."
if $IS_CI_RUN; then
# Run the tests in parallel
find ./mpt-fixtures/fixtures/resolved -name "*.json" | parallel --halt soon,fail=1 process_input $filename
else
# Run the tests in parallel
find ./mpt-fixtures/fixtures/autogen -name "*.json" | parallel process_input $filename
fi

# Capture the exit status of parallel
exit_status=$?

Expand Down
Loading