From d2eb6e4f3fe864b4af9524f31a2160545068f59e Mon Sep 17 00:00:00 2001 From: lucasxia01 Date: Thu, 27 Jun 2024 16:58:37 +0000 Subject: [PATCH 1/3] update rebuild script --- noir/noir-repo/test_programs/rebuild.sh | 39 +++++++++++++++++++++++-- 1 file changed, 36 insertions(+), 3 deletions(-) diff --git a/noir/noir-repo/test_programs/rebuild.sh b/noir/noir-repo/test_programs/rebuild.sh index 094c3902583e..172c931df124 100755 --- a/noir/noir-repo/test_programs/rebuild.sh +++ b/noir/noir-repo/test_programs/rebuild.sh @@ -1,6 +1,8 @@ #!/usr/bin/env bash set -e +NO_PARALLEL=${1:-} + process_dir() { local dir=$1 local current_dir=$2 @@ -60,7 +62,38 @@ 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 + +# 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 + echo "Rebuild failed for directory: ${dirs_map[$pid]}" # Print failed directory + exit_status=$? # Capture the failed exit status + fi +done -parallel -j0 process_dir {} "$current_dir" ::: ${dirs_to_process[@]} - -echo "Rebuild Succeeded!" +# Exit with a failure status if any job failed. +if [ ! -z "$exit_status" ]; then + echo "Rebuild failed!" + exit $exit_status +fi +echo "Rebuild Succeeded!" \ No newline at end of file From 3e678c5d0775a2334ca9a297e7a03359fb5763ac Mon Sep 17 00:00:00 2001 From: lucasxia01 Date: Thu, 27 Jun 2024 16:59:47 +0000 Subject: [PATCH 2/3] update reset acir tests script --- barretenberg/acir_tests/reset_acir_tests.sh | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/barretenberg/acir_tests/reset_acir_tests.sh b/barretenberg/acir_tests/reset_acir_tests.sh index e83bea9189e9..dffb4d438375 100755 --- a/barretenberg/acir_tests/reset_acir_tests.sh +++ b/barretenberg/acir_tests/reset_acir_tests.sh @@ -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 From 1ac31afb8126d61b15173727c08f345c41f217ed Mon Sep 17 00:00:00 2001 From: lucasxia01 Date: Thu, 27 Jun 2024 21:19:04 +0000 Subject: [PATCH 3/3] modified rebuild to print failed dirs after all processes finish --- noir/noir-repo/test_programs/rebuild.sh | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/noir/noir-repo/test_programs/rebuild.sh b/noir/noir-repo/test_programs/rebuild.sh index 172c931df124..a8175d050661 100755 --- a/noir/noir-repo/test_programs/rebuild.sh +++ b/noir/noir-repo/test_programs/rebuild.sh @@ -83,17 +83,25 @@ else 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 - echo "Rebuild failed for directory: ${dirs_map[$pid]}" # Print failed directory exit_status=$? # Capture the failed exit status + failed_pids+=($pid) fi done +echo "" + # Exit with a failure status if any job failed. if [ ! -z "$exit_status" ]; then - echo "Rebuild failed!" + 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!" \ No newline at end of file