Skip to content

Commit

Permalink
feat: update rebuild script (#7225)
Browse files Browse the repository at this point in the history
Updates the ACIR artifacts rebuild.sh script to output which test programs failed to rebuild. Also updates the reset_acir_tests.sh script to use relative paths.
  • Loading branch information
lucasxia01 authored Jun 28, 2024
1 parent 3cd4d60 commit af59247
Show file tree
Hide file tree
Showing 2 changed files with 47 additions and 5 deletions.
5 changes: 3 additions & 2 deletions barretenberg/acir_tests/reset_acir_tests.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
cd ~/aztec-packages/noir/noir-repo
# Run from barretenberg/acir_tests
cd ../../noir/noir-repo
cargo clean
noirup -p .
cd test_programs && ./rebuild.sh

cd ~/aztec-packages/barretenberg/acir_tests
cd ../../../barretenberg/acir_tests
rm -rf acir_tests
47 changes: 44 additions & 3 deletions noir/noir-repo/test_programs/rebuild.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
#!/usr/bin/env bash
set -e

NO_PARALLEL=${1:-}

process_dir() {
local dir=$1
local current_dir=$2
Expand Down Expand Up @@ -60,7 +62,46 @@ for dir in $current_dir/benchmarks/*; do
dirs_to_process+=("$dir")
done

pids=() # Array to hold PIDs of background processes
dirs_map=() # Array to map PIDs to directories

if [ -z $NO_PARALLEL ]; then
# Process directories in parallel
for dir in "${dirs_to_process[@]}"; do
process_dir "$dir" "$current_dir" & # Run process_dir in the background
pid=$! # Get PID of the last background command
pids+=($pid) # Add PID to the pids array
dirs_map[$pid]=$dir # Map PID to the directory being processed
done
else
# Process directories sequentially
for dir in "${dirs_to_process[@]}"; do
process_dir "$dir" "$current_dir" # Run process_dir in the foreground
pid=$! # Get PID of the last command
pids+=($pid) # Add PID to the pids array
dirs_map[$pid]=$dir # Map PID to the directory being processed
done
fi

# Store the failed processes
failed_pids=()
# Check the exit status of each background job.
for pid in "${pids[@]}"; do
if ! wait $pid; then # Wait for the process to complete, check if it failed
exit_status=$? # Capture the failed exit status
failed_pids+=($pid)
fi
done

parallel -j0 process_dir {} "$current_dir" ::: ${dirs_to_process[@]}

echo "Rebuild Succeeded!"
echo ""

# Exit with a failure status if any job failed.
if [ ! -z "$exit_status" ]; then
echo "Rebuild failed for directories:"
# Print the failed directories after waiting for each process to complete
for pid in "${failed_pids[@]}"; do
echo "${dirs_map[$pid]}"
done
exit $exit_status
fi
echo "Rebuild Succeeded!"

0 comments on commit af59247

Please sign in to comment.