-
-
Notifications
You must be signed in to change notification settings - Fork 707
/
Copy pathrun-tests.sh
executable file
·59 lines (51 loc) · 2.13 KB
/
run-tests.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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
#!/bin/bash
#
# Sandstorm - Personal Cloud Sandbox
# Copyright (c) 2014 Sandstorm Development Group, Inc. and contributors
# All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
set -euo pipefail
THIS_DIR=$(dirname "$(readlink -f "${BASH_SOURCE[0]}")")
cd "$THIS_DIR"
export SANDSTORM_DIR="${SANDSTORM_DIR:-/opt/sandstorm}"
test -e assets/ssjekyll5.spk || curl https://sandstorm.io/apps/ssjekyll5.spk > assets/ssjekyll5.spk
test -e assets/ssjekyll6.spk || curl https://sandstorm.io/apps/ssjekyll6.spk > assets/ssjekyll6.spk
test -e assets/ssjekyll7.spk || curl https://sandstorm.io/apps/ssjekyll7.spk > assets/ssjekyll7.spk
NIGHTWATCH_PARAMS=()
if [ ! -z "${TESTCASE:-}" ]; then
# This is awkward because the test case name usually has spaces, but we need
# to pass it as a single argument on the command-line. So, we concoct a bash
# array with TESTNAME containing the name, spacing and all.
read TESTFILE TESTNAME <<< "$TESTCASE"
if [ -z "$TESTNAME" ]; then
NIGHTWATCH_PARAMS=(-t $TESTFILE)
else
NIGHTWATCH_PARAMS=(-t $TESTFILE --testcase "$TESTNAME")
fi
SKIP_UNITTESTS=true
fi
if [[ -z "${LAUNCH_URL:-}" ]]; then
if [[ -z "${SKIP_UNITTESTS:-}" ]]; then
../shell/test-packages.sh -f
nightwatch -e unittests "${NIGHTWATCH_PARAMS[@]}"
fi
nightwatch -e default "${NIGHTWATCH_PARAMS[@]}"
else
sed "s|.*launch_url.*|\"launch_url\" : \"$LAUNCH_URL\",|g" nightwatch.json > nightwatch.tmp.json
if [[ -z "${SKIP_UNITTESTS:-}" ]]; then
../shell/test-packages.sh -f
nightwatch -e unittests -c ./nightwatch.tmp.json "${NIGHTWATCH_PARAMS[@]}"
fi
nightwatch -e default -c ./nightwatch.tmp.json "${NIGHTWATCH_PARAMS[@]}"
fi