1 | #!/usr/bin/env bash
|
2 |
|
3 |
|
4 |
|
5 |
|
6 |
|
7 |
|
8 |
|
9 |
|
10 |
|
11 |
|
12 |
|
13 |
|
14 |
|
15 |
|
16 |
|
17 |
|
18 |
|
19 |
|
20 |
|
21 |
|
22 |
|
23 |
|
24 |
|
25 | set -e
|
26 | set -o pipefail
|
27 |
|
28 | SCRIPTDIR=$(cd $(dirname "$0") && pwd)
|
29 |
|
30 | if [ -n "$LAYER" ]; then
|
31 |
|
32 |
|
33 | if [ -n "$NEEDS_OPENWHISK" ]; then
|
34 |
|
35 |
|
36 |
|
37 |
|
38 |
|
39 |
|
40 |
|
41 |
|
42 | export WSK_CONFIG_FILE=~/.wskprops_${KEY}_${PORT_OFFSET}
|
43 | export WSK_CONFIG_FILEb=~/.wskpropsb_${KEY}_${PORT_OFFSET}
|
44 | export TEST_SPACE="${TEST_SPACE_PREFIX-ns}${KEY}_${PORT_OFFSET}"
|
45 | export TEST_SPACE2="${TEST_SPACE_PREFIX-ns}${KEY}_${PORT_OFFSET}b"
|
46 |
|
47 | echo "Using wskconfig $WSK_CONFIG_FILE"
|
48 | echo "Using TEST_SPACE ${TEST_SPACE}"
|
49 |
|
50 |
|
51 | . ${WSK_CONFIG_FILEb}
|
52 | export AUTH2=$AUTH
|
53 |
|
54 | . ${WSK_CONFIG_FILE}
|
55 | export API_HOST=$APIHOST
|
56 | export AUTH=$AUTH
|
57 | export __OW_APIGW_TOKEN=$APIGW_ACCESS_TOKEN
|
58 | fi
|
59 |
|
60 | if [ -z $EXCLUDE_OW_TEST ]; then
|
61 | if [[ $LAYER == *"core"* ]]; then
|
62 | TEST_SUITES=$(find -H "$TEST_SUITE_ROOT"/{plugin-*,core,client} -path "*/dist/test/$LAYER" -o -path '*/core/test' -maxdepth 4)
|
63 | else
|
64 | TEST_SUITES=$(find -H "$TEST_SUITE_ROOT"/{plugin-*,core,client} -path "*/dist/test/$LAYER" -maxdepth 4)
|
65 | fi
|
66 | else
|
67 | if [[ $LAYER == *"core"* ]]; then
|
68 | TEST_SUITES=$(find -H "$TEST_SUITE_ROOT"/{plugin-*,core,client} -path "*/dist/test/$LAYER" -o -path '*/core/test' ! -path "*/dist/test/openwhisk*" ! -path "*/dist/test/composer*" ! -path "*/dist/test/grid" -maxdepth 4)
|
69 | else
|
70 | TEST_SUITES=$(find -H "$TEST_SUITE_ROOT"/{plugin-*,core,client} -path "*/dist/test/$LAYER" ! -path "*/dist/test/openwhisk*" ! -path "*/dist/test/composer*" ! -path "*/dist/test/grid" -maxdepth 4)
|
71 | fi
|
72 | fi
|
73 | else
|
74 | if [ -z $EXCLUDE_OW_TEST ]; then
|
75 | TEST_SUITES=$(find -H "$TEST_SUITE_ROOT"/{plugin-*,core,client} -path "*/dist/test" -o -path '*/core/test' -maxdepth 4)
|
76 | else
|
77 | TEST_SUITES=$(find -H "$TEST_SUITE_ROOT"/{plugin-*,core,client} -path "*/dist/test" ! -path "*/dist/test/openwhisk*" ! -path "*/dist/test/composer*" ! -path "*/dist/test/grid" -maxdepth 4)
|
78 | fi
|
79 | fi
|
80 |
|
81 | echo "Running these test suites: $TEST_SUITES"
|
82 |
|
83 |
|
84 |
|
85 | if [ -n "$TRAVIS_JOB_ID" ]; then
|
86 |
|
87 | echo "DISPLAY=$DISPLAY"
|
88 | else
|
89 |
|
90 | export DISPLAY=:0
|
91 | fi
|
92 | export DISPLAY
|
93 |
|
94 |
|
95 |
|
96 | export RUNNING_SHELL_TEST=true
|
97 |
|
98 |
|
99 |
|
100 |
|
101 |
|
102 |
|
103 |
|
104 |
|
105 |
|
106 |
|
107 |
|
108 |
|
109 |
|
110 |
|
111 |
|
112 | function go {
|
113 | NO_USAGE_TRACKING=true mocha \
|
114 | -c \
|
115 | --exit \
|
116 | --reporter ${MOCHA_REPORTER-spec} \
|
117 | --bail \
|
118 | --recursive \
|
119 | --timeout ${TIMEOUT-60000} \
|
120 | --grep "${TEST_FILTER:-.*}" \
|
121 | --exclude "**/*flycheck*" \
|
122 | $TEST_SUITES
|
123 | }
|
124 |
|
125 | if [ -n "$TRAVIS_JOB_ID" ]; then
|
126 |
|
127 | go || go || go || go
|
128 | else
|
129 |
|
130 | go
|
131 | fi
|