Skip to content

Commit

Permalink
add test mips script
Browse files Browse the repository at this point in the history
  • Loading branch information
martyall committed Jan 16, 2025
1 parent 535c485 commit b56c160
Showing 1 changed file with 47 additions and 0 deletions.
47 changes: 47 additions & 0 deletions o1vm/test-mips-program-prover.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
#!/bin/bash

# Check if correct number of arguments is provided
if [ "$#" -ne 2 ]; then
echo "Usage: $0 <program-filepath> <srs-filepath>"
echo "Example: $0 path/to/my_program.bin /path/to/srs"
exit 1
fi

# Store arguments in descriptive variables
PROGRAM_FILEPATH="$1"
SRS_FILEPATH="$2"

# Extract just the program name from the filepath
PROGRAM_NAME=$(basename "$PROGRAM_FILEPATH")
STATE_JSON="${PROGRAM_NAME}-state.json"

# Set up cleanup trap
cleanup() {
rm -f "$STATE_JSON"
}
trap cleanup EXIT

# Generate state JSON
echo "Generating state JSON for $PROGRAM_NAME..."
cargo run --bin pickles_o1vm -- cannon gen-state-json \
-i "$PROGRAM_FILEPATH" \
-o "$STATE_JSON"

if [ $? -ne 0 ]; then
echo "Error: Failed to generate state JSON"
exit 1
fi

# Run the program with the generated state
echo "Running program with generated state..."
cargo run --release --bin pickles_o1vm -- cannon run \
--input "$STATE_JSON" \
--srs-filepath "$SRS_FILEPATH" \
--halt-address 0

if [ $? -ne 0 ]; then
echo "Error: Failed to run program"
exit 1
fi

echo "Execution completed successfully"

0 comments on commit b56c160

Please sign in to comment.