-
Notifications
You must be signed in to change notification settings - Fork 0
/
verify_all
executable file
·55 lines (47 loc) · 1.01 KB
/
verify_all
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
#!/bin/bash
set -e
cd "$(dirname "$0")"
find tasks -mindepth 1 -maxdepth 1 -type d | xargs -L1 -P"$(nproc)" ./verify "$@"
ret=0
# Print result.
has_tty=
if [ -t 1 ]; then
has_tty=1
fi
reset_color=$'\e[0m'
for i in tasks/*; do
id="$(basename "$i")"
read rv status lines bytes < "$i/status"
if [ -z "$has_tty" -o "${rv}" -ne 0 ]; then
if [ "${rv}" -eq 0 ]; then
color=$'\e[32m'
elif [ "${rv}" -eq 1 ]; then
color=$'\e[36m'
else
color=$'\e[31m'
fi
echo "${color}[${status}]${reset_color} $(cat "$i/description")"
if [ "${rv}" -eq 2 ]; then
cat "${i}/log"
ret=1
fi
fi
done
# Update README.md
{
cat <<EOF
## [TopProver](http://top-prover.top/) Challenge Log
### Status
EOF
for i in tasks/*; do
read rv status lines bytes < "$i/status"
desc="$(cat "$i/description")"
if [ "${rv}" -eq 0 ]; then
badge=$'\U2714'
else
badge=$'\U274c'
fi
echo "- ${badge} [${status}] [${desc}](${i}/Solution.v)"
done
} > README.md
exit "${ret}"