forked from noir-lang/noir
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrebuild.sh
More file actions
executable file
·108 lines (90 loc) · 2.89 KB
/
Copy pathrebuild.sh
File metadata and controls
executable file
·108 lines (90 loc) · 2.89 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
#!/usr/bin/env bash
set -e
process_dir() {
set -e
local dir=$1
local current_dir=$2
local dir_name=$(basename "$dir")
{
echo "Processing $dir"
if [[ ! -f "$dir/Nargo.toml" ]]; then
echo "No Nargo.toml found in $dir. Removing directory."
rm -rf "$dir"
echo "$dir: skipped (no Nargo.toml)"
return 0
fi
if [[ ! -d "$current_dir/acir_artifacts/$dir_name" ]]; then
mkdir -p "$current_dir/acir_artifacts/$dir_name"
fi
cd "$dir"
if [ -d ./target/ ]; then
rm -r ./target/
fi
if ! nargo execute witness; then
echo "$dir failed"
else
if [ -d "$current_dir/acir_artifacts/$dir_name/target" ]; then
rm -r "$current_dir/acir_artifacts/$dir_name/target"
fi
mkdir "$current_dir/acir_artifacts/$dir_name/target"
mkdir "$current_dir/acir_artifacts/$dir_name/proofs"
mv ./target/$dir_name.json "$current_dir/acir_artifacts/$dir_name/target/program.json"
mv ./target/*.gz "$current_dir/acir_artifacts/$dir_name/target/"
echo "$dir succeeded"
fi
cd "$current_dir"
} >> "$current_dir/rebuild.log" 2>&1
}
export -f process_dir
# Reactive `regression_7323` once enums are ready
excluded_dirs=(
"workspace"
"workspace_default_member"
"regression_7323"
)
current_dir=$(pwd)
base_path="$current_dir/execution_success"
dirs_to_process=()
# Remove existing artifacts and create a new directory
rm -rf "$current_dir/acir_artifacts"
mkdir -p "$current_dir/acir_artifacts"
# Gather directories to process, either from arguments or by default.
if [ $# -gt 0 ]; then
for dir in "$@"; do
dirs_to_process+=("$base_path/$dir")
done
else
for dir in $base_path/*; do
if [[ ! -d $dir ]] || [[ " ${excluded_dirs[@]} " =~ " $(basename "$dir") " ]]; then
continue
fi
dirs_to_process+=("$dir")
done
for dir in $current_dir/benchmarks/*; do
if [[ ! -d $dir ]] || [[ " ${excluded_dirs[@]} " =~ " $(basename "$dir") " ]]; then
continue
fi
dirs_to_process+=("$dir")
done
fi
# Clear any existing rebuild.log
rm -f "$current_dir/rebuild.log"
# Process directories in parallel
parallel -j7 process_dir {} "$current_dir" ::: ${dirs_to_process[@]}
# Check rebuild.log for failures
if [ -f "$current_dir/rebuild.log" ]; then
failed_dirs=($(grep -a 'failed' "$current_dir/rebuild.log" | awk '{print $1}'))
else
echo "rebuild.log not found or empty. Check for errors." >&2
exit 1
fi
# Print final status message after processing all directories
if [ ${#failed_dirs[@]} -ne 0 ]; then
echo "Rebuild failed for the following directories:"
for dir in "${failed_dirs[@]}"; do
echo "- $dir"
done
exit 1
else
echo "Rebuild Succeeded!"
fi