-
Notifications
You must be signed in to change notification settings - Fork 0
/
decodetest.sh
executable file
·42 lines (36 loc) · 813 Bytes
/
decodetest.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
37
38
39
40
41
42
#!/bin/bash
set -eu
SCRIPT="./xnbread.py"
if [ $# -gt 0 ]; then
if [[ ! "$1" =~ .xnb$ && -f "$1" && -x "$1" ]]; then
# the first arg is an executable file; use it.
SCRIPT="$1"
shift
fi
fi
RESET="$(tput sgr0)"
GREEN="$(tput setaf 2)"
RED="$(tput setaf 1)"
function testone() {
xnb="$1"
until (echo -n "$xnb... "; "$SCRIPT" "$xnb" &>/dev/null); do
echo "${RED}Failure.${RESET}"
"$SCRIPT" "$xnb" || true # run again to get the callstack/message
echo
read -p 'Press ENTER to retry, or Ctrl-C to give up'
done
echo "${GREEN}OK!${RESET}"
}
if [ $# -gt 0 ]; then
while [ $# -gt 0 ]; do
testone "$1"
shift
done
else
readarray -t xnbfiles < <(find tests -name '*.xnb')
for xnb in "${xnbfiles[@]}"; do
testone "$xnb"
done
fi
echo
echo "${GREEN}All files parsed without crashes${RESET}"