Skip to content

Stav/remove test compare to python vm #2086

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

Open
wants to merge 1 commit into
base: starkware-development
Choose a base branch
from
Open
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
1 change: 1 addition & 0 deletions cairo1-run/cairo
Submodule cairo added at 879302
9 changes: 0 additions & 9 deletions vm/src/tests/compare_factorial_outputs_all_layouts.sh
Original file line number Diff line number Diff line change
Expand Up @@ -21,15 +21,6 @@ for layout in "plain" "small" "dex" "recursive" "starknet" "starknet_with_keccak
else
passed_tests=$((passed_tests + 1))
fi
# Compare memory
echo "Running memory comparison for layout $layout"
if ! ./vm/src/tests/memory_comparator.py factorial_rs.memory factorial_py.memory; then
echo "Memory differs for layout $layout"
exit_code=1
failed_tests=$((failed_tests + 1))
else
passed_tests=$((passed_tests + 1))
fi
# Compare air public input
echo "Running air public input comparison for layout $layout"
if ! ./vm/src/tests/air_public_input_comparator.py factorial_rs.air_public_input factorial_py.air_public_input; then
Expand Down
9 changes: 0 additions & 9 deletions vm/src/tests/compare_outputs_dynamic_layouts.sh
Original file line number Diff line number Diff line change
Expand Up @@ -207,15 +207,6 @@ for case in "${CASES[@]}"; do
passed_tests=$((passed_tests + 1))
fi

# Compare memory
echo "Running memory comparison for case: $case"
if ! ./vm/src/tests/memory_comparator.py program_rs.memory program_py.memory; then
echo "Memory differs for case: $case"
exit_code=1
failed_tests=$((failed_tests + 1))
else
passed_tests=$((passed_tests + 1))
fi

# Compare air public input
echo "Running air public input comparison for case: $case"
Expand Down
2 changes: 1 addition & 1 deletion vm/src/tests/compare_vm_state.sh
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ for file in $(ls $tests_path | grep .cairo$ | sed -E 's/\.cairo$//'); do
fi
fi

if $memory; then
if $memory && -z $proof_tests_path; then
if ! ./memory_comparator.py $path_file.memory $path_file.rs.memory; then
echo "Memory differs for $file"
exit_code=1
Expand Down
43 changes: 21 additions & 22 deletions vm/src/tests/memory_comparator.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,28 +13,27 @@ def compare_memory_file_contents(cairo_raw_mem, cairo_rs_raw_mem):
cairo_mem = read_memory_file_contents(cairo_raw_mem)
cairo_rs_mem = read_memory_file_contents(cairo_rs_raw_mem)

# TODO(Stav): Uncomment the following lines when moving the logic for filling builtin segment holes into `get_prover_input_info`.
# assert len(cairo_mem) == len(cairo_rs_mem), f'len(cairo_mem)={len(cairo_mem)} len(cairo_mem)={len(cairo_rs_mem)}'
# if cairo_mem != cairo_rs_mem:
# print(f'Mismatch between cairo_lang and cairo-vm')
# print('keys in cairo_lang but not cairo-vm:')
# for k in cairo_mem:
# if k in cairo_rs_mem:
# continue
# print(f'{k}:{cairo_mem[k]}')
# print('keys in cairo-vm but not cairo_lang:')
# for k in cairo_rs_mem:
# if k in cairo_mem:
# continue
# print(f'{k}:{cairo_rs_mem[k]}')
# print('mismatched values (cairo_lang <-> cairo-vm)):')
# for k in cairo_rs_mem:
# if k not in cairo_mem:
# continue
# if cairo_rs_mem[k] == cairo_mem[k]:
# continue
# print(f'{k}:({cairo_mem[k]} <-> {cairo_rs_mem[k]})')
# exit(1)
assert len(cairo_mem) == len(cairo_rs_mem), f'len(cairo_mem)={len(cairo_mem)} len(cairo_mem)={len(cairo_rs_mem)}'
if cairo_mem != cairo_rs_mem:
print(f'Mismatch between cairo_lang and cairo-vm')
print('keys in cairo_lang but not cairo-vm:')
for k in cairo_mem:
if k in cairo_rs_mem:
continue
print(f'{k}:{cairo_mem[k]}')
print('keys in cairo-vm but not cairo_lang:')
for k in cairo_rs_mem:
if k in cairo_mem:
continue
print(f'{k}:{cairo_rs_mem[k]}')
print('mismatched values (cairo_lang <-> cairo-vm)):')
for k in cairo_rs_mem:
if k not in cairo_mem:
continue
if cairo_rs_mem[k] == cairo_mem[k]:
continue
print(f'{k}:({cairo_mem[k]} <-> {cairo_rs_mem[k]})')
exit(1)

def read_memory_file_contents(raw_mem_content) -> {}:
mem = {}
Expand Down
Loading