-
Notifications
You must be signed in to change notification settings - Fork 0
/
generate-proofs.sh
executable file
·36 lines (31 loc) · 1.13 KB
/
generate-proofs.sh
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
#!/bin/bash
# Check if an argument is provided
if [ -z "$1" ]; then
echo "Usage: $0 <n_proofs> <path*>\n"
echo " - n_proofs: the number of proofs to generate"
echo " - path (optional): the path to store the proofs, by default ./test/testdata"
exit 1
fi
# Set the upper limit based on the argument
n_proofs=$1
# Check if a second argument (path) is provided, and convert to absolute if necessary
if [ -n "$2" ]; then
if [[ "$2" = /* ]]; then
abs_path="$2"
else
abs_path="$(
cd "$(dirname "$2")"
pwd
)/$(basename "$2")"
fi
fi
for idx in $(seq 1 "$n_proofs"); do
echo "Generating $((idx)) of $((n_proofs))..."
# Construct the command with or without the -path flag
if [ -n "$abs_path" ]; then
go test -timeout 30s -run ^TestBallotProofPoseidon$ github.com/vocdoni/z-ircuits/test -v -count=1 -args -testID=$idx -persist -path="$abs_path" >/dev/null 2>&1
else
go test -timeout 30s -run ^TestBallotProofPoseidon$ github.com/vocdoni/z-ircuits/test -v -count=1 -args -testID=$idx -persist >/dev/null 2>&1
fi
done
echo "All tests completed."