Skip to content

Commit

Permalink
Merge pull request #3 from HerodotusDev/add-ci
Browse files Browse the repository at this point in the history
test: add small batch of MPT tests to CI
  • Loading branch information
petscheit committed May 8, 2024
2 parents f37ebf8 + b674ebc commit 7f338f8
Show file tree
Hide file tree
Showing 11 changed files with 32 additions and 5,970 deletions.
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

0 comments on commit 7f338f8

Please sign in to comment.