File tree Expand file tree Collapse file tree 3 files changed +374
-3
lines changed Expand file tree Collapse file tree 3 files changed +374
-3
lines changed Original file line number Diff line number Diff line change @@ -102,12 +102,20 @@ functions:
102
102
script : |
103
103
${PREPARE_SHELL}
104
104
SWIFT_VERSION=${SWIFT_VERSION} \
105
- sh ${PROJECT_DIRECTORY}/.evergreen/run-tests.sh
105
+ ${PROJECT_DIRECTORY}/.evergreen/run-tests.sh
106
+
107
+ " upload test results " :
108
+ - command : attach.xunit_results
109
+ params :
110
+ file : ./src/testResults.xml
106
111
107
112
pre :
108
113
- func : " fetch source"
109
114
- func : " install swift"
110
115
116
+ post :
117
+ - func : " upload test results"
118
+
111
119
tasks :
112
120
- name : " test"
113
121
commands :
Original file line number Diff line number Diff line change 1
- #! /bin/sh
1
+ #! /bin/bash
2
2
set -o xtrace # Write all commands first to stderr
3
3
set -o errexit # Exit the script with error if any of the commands fail
4
4
@@ -7,6 +7,8 @@ PROJECT_DIRECTORY=${PROJECT_DIRECTORY:-$PWD}
7
7
SWIFT_VERSION=${SWIFT_VERSION:- 5.2.4}
8
8
INSTALL_DIR=" ${PROJECT_DIRECTORY} /opt"
9
9
OS=$( uname -s | tr ' [:upper:]' ' [:lower:]' )
10
+ RAW_TEST_RESULTS=" ${PROJECT_DIRECTORY} /rawTestResults"
11
+ XML_TEST_RESULTS=" ${PROJECT_DIRECTORY} /testResults.xml"
10
12
11
13
# enable swiftenv
12
14
export SWIFTENV_ROOT=" ${INSTALL_DIR} /swiftenv"
@@ -24,5 +26,19 @@ swiftenv local $SWIFT_VERSION
24
26
# build the driver
25
27
swift build
26
28
29
+ # even if tests fail we want to parse the results, so disable errexit
30
+ set +o errexit
31
+ # propagate error codes in the following pipes
32
+ set -o pipefail
33
+
27
34
# test the driver
28
- swift test --enable-test-discovery
35
+ swift test --enable-test-discovery 2>&1 | tee ${RAW_TEST_RESULTS}
36
+
37
+ # save tests exit code
38
+ EXIT_CODE=$?
39
+
40
+ # convert tests to XML
41
+ cat ${RAW_TEST_RESULTS} | swift " ${PROJECT_DIRECTORY} /etc/convert-test-results.swift" > ${XML_TEST_RESULTS}
42
+
43
+ # exit with exit code for running the tests
44
+ exit $EXIT_CODE
You can’t perform that action at this time.
0 commit comments