-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathrun-cli-tests.sh
More file actions
executable file
·54 lines (42 loc) · 1.15 KB
/
run-cli-tests.sh
File metadata and controls
executable file
·54 lines (42 loc) · 1.15 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
#!/bin/bash
prompt=false
[ "$1" == "--prompt" ] || [ "$1" == "-p" ] && prompt=true
mapfile -t lines < cli_tests.txt
test_count=0
for i in $(seq ${#lines[@]}) ; do
CMD=${lines[$i]}
[ ! "$CMD" ] || [[ "$CMD" =~ \# ]] && continue
let test_count+=1
done
echo "[INFO] Running $test_count tests..."
test_number=1
for i in $(seq ${#lines[@]}) ; do
CMD=${lines[$i]}
echo
[ ! "$CMD" ] || [[ "$CMD" =~ \# ]] && continue
echo "[INFO] Running (${test_number} / ${test_count}): "
let test_number+=1
count=0
for i in $(echo $CMD); do
[ $count -eq 0 ] && echo "$ checksit check"
[ $count -ge 2 ] && echo " $i"
let count+=1
done
if [ $prompt == "true" ]; then
echo
echo "Press ENTER to continue..."
read waiter
if [ "$waiter" == "q" ]; then
echo "[INFO] Exiting!"
exit
fi
fi
${CMD}
if [ $? -ne 0 ]; then
echo
echo "[ERROR] The following command failed...so aborting: $CMD"
break
fi
echo
echo "=========================================================================="
done