-
Notifications
You must be signed in to change notification settings - Fork 0
/
run
executable file
·59 lines (51 loc) · 1.59 KB
/
run
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
#!/bin/sh
configmgr="../bin/utils/configmgr"
tests="./tests.js"
for check_file in "${configmgr}" "${tests}"; do
if [ ! -f "${check_file}" ]; then
echo "File '${check_file}' not found."
echo "Verify the repo and location."
exit 255
fi
done
if [ $# -eq 1 ] && [ "$1" = "-h" ]; then
echo "To run all tests, use no parameter."
echo "To run or exclude specific test, use following parameters with prefix '-' (exclude) or optional '+' (include):"
cat "${tests}" | grep ':[ ]*\[' | awk -F: '{ print $1 }'
exit 255
fi
plus=0
minus=0
if [ $# -ne 0 ]; then
export QUICK_JS_TESTS_ARGS=$#
for var in "$@"; do
valid=$(echo $var | grep -E '^([-|+]{0,1})[a-zA-Z0-9_]+$')
if [ -z "${valid}" ]; then
echo "Parameter must start with '+' (optional) or '-', followed by combination of [a-zA-Z], [0-9] and '_'."
exit 255
fi
firstChar=$(echo "$var" | cut -c1)
cutIndex=2
if [ "${firstChar}" = "-" ]; then
minus=$((minus+1))
else
if [ "${firstChar}" != "+" ]; then
cutIndex=1
fi
plus=$((plus+1))
fi
varCutUpper=$(echo "${var}" | cut -c${cutIndex}- | tr '[:lower:]' '[:upper:]')
eval "export "QUICK_JS_TESTS_${varCutUpper}"=\"${var}\""
done
fi
if [ "$((plus*minus))" -ne 0 ]; then
echo "Only one type of switch (+/-) allowed."
exit 255
else
if [ "${plus}" -ne 0 ]; then
export QUICK_JS_TESTS_TYPE="P"
else
export QUICK_JS_TESTS_TYPE="N"
fi
fi
${configmgr} -script ${tests}