blob: 452e34d8b3bcbcdee5c34f98c9ffaf98561615a0 (
plain)
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
|
#!/bin/bash
SCRIPT_DIR=$(cd $(dirname ${0}); pwd)
TESTS_DIR="${SCRIPT_DIR}/.."
INC_DIR="${TESTS_DIR}/common"
BASE_DIR="${SCRIPT_DIR}/../.."
GK_DEPLOY="${DEPLOY_DIR}/"
source "${INC_DIR}/subunit.sh"
test_syntax() {
local file="${1}"
bash -n ${file}
}
test_shellcheck() {
local file="${1}"
if ! which shellcheck ; then
echo "ShellCheck not found: skipping..."
return 0
fi
shellcheck -s bash -e SC2181 ${file}
}
failed=0
testit "test script syntax ${BASE_DIR}/CentOS/gluster-setup.sh" \
test_syntax ${BASE_DIR}/CentOS/gluster-setup.sh \
|| ((failed++))
testit "test shellcheck ${BASE_DIR}/CentOS/gluster-setup.sh" \
test_shellcheck ${BASE_DIR}/CentOS/gluster-setup.sh \
|| ((failed++))
testit "test script syntax ${BASE_DIR}/gluster-s3object/CentOS/docker-gluster-s3/update_gluster_vol.sh" \
test_syntax ${BASE_DIR}/gluster-s3object/CentOS/docker-gluster-s3/update_gluster_vol.sh \
|| ((failed++))
testit "test shellcheck ${BASE_DIR}/gluster-s3object/CentOS/docker-gluster-s3/update_gluster_vol.sh" \
test_shellcheck ${BASE_DIR}/gluster-s3object/CentOS/docker-gluster-s3/update_gluster_vol.sh \
|| ((failed++))
testok $0 ${failed}
|