-
Notifications
You must be signed in to change notification settings - Fork 10
/
test
executable file
·62 lines (53 loc) · 1.5 KB
/
test
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
60
61
62
#!/bin/bash
set -e # exit on failure
function xcode_tests {
(
set +e;
set -x; # print commands executed; use subshell to avoid having to print 'set +x' to disable it
which -s xcpretty
XCPRETTY_INSTALLED=$?
set -e;
xcrun swift package generate-xcodeproj --enable-code-coverage
XCB1='xcodebuild test -project ReverseJson.xcodeproj -scheme ReverseJson -destination "platform=OS X"'
if [[ $TRAVIS || $XCPRETTY_INSTALLED == 0 ]]; then
eval "set -o pipefail && ${XCB1} | xcpretty" && eval "set -o pipefail && ${XCB1} | xcpretty" && eval "set -o pipefail && ${XCB1} | xcpretty"
else
eval "${XCB1}" && eval "${XCB2}" && eval "${XCB3}"
fi
)
echo
echo "Xcode tests passed"
}
function spm_tests {
(
set -e;
set -x; # print commands executed; use subshell to avoid having to print 'set +x' to disable it
swift package clean &&
swift build &&
swift test
)
echo
echo "SPM tests passed"
}
function help {
echo "Usage: $0 COMMANDS..."
echo
echo "Runs specific test suites."
echo
echo "COMMANDS:"
echo " spm: runs tests via Swift Package Manager (Linux)"
echo " xcode: runs tests via Xcode (OS X, iOS, tvOS)"
echo " help: Displays this help"
echo
}
for arg in "$@"
do
case $arg in
"spm") spm_tests;;
"xcode") xcode_tests;;
"help") help;;
esac
done
if [ $# == 0 ]; then
help
fi