File tree Expand file tree Collapse file tree 4 files changed +372
-5
lines changed Expand file tree Collapse file tree 4 files changed +372
-5
lines changed Original file line number Diff line number Diff line change @@ -122,6 +122,7 @@ functions:
122122 script : |
123123 ${PREPARE_SHELL}
124124 sh ${DRIVERS_TOOLS}/.evergreen/stop-orchestration.sh
125+
125126 " upload-mo-artifacts " :
126127 - command : shell.exec
127128 params :
@@ -152,7 +153,12 @@ functions:
152153 SSL=${SSL} \
153154 AUTH=${AUTH} \
154155 SWIFT_VERSION=${SWIFT_VERSION} \
155- sh ${PROJECT_DIRECTORY}/.evergreen/run-tests.sh
156+ ${PROJECT_DIRECTORY}/.evergreen/run-tests.sh
157+
158+ " upload test results " :
159+ - command : attach.xunit_results
160+ params :
161+ file : ./src/testResults.xml
156162
157163 " run atlas tests " :
158164 - command : shell.exec
199205post :
200206 - func : " stop mongo-orchestration"
201207 - func : " upload-mo-artifacts"
208+ - func : " upload test results"
202209 - func : " cleanup"
203210
204211tasks :
Original file line number Diff line number Diff line change 1- #! /bin/sh
1+ #! /bin/bash
22set -o xtrace # Write all commands first to stderr
33set -o errexit # Exit the script with error if any of the commands fail
44
55# variables
66PROJECT_DIRECTORY=${PROJECT_DIRECTORY:- $PWD }
77MONGODB_URI=${MONGODB_URI:- " NO_URI_PROVIDED" }
8- SWIFT_VERSION=${SWIFT_VERSION:- 5.0.3 }
8+ SWIFT_VERSION=${SWIFT_VERSION:- 5.1 }
99INSTALL_DIR=" ${PROJECT_DIRECTORY} /opt"
1010TOPOLOGY=${TOPOLOGY:- single}
1111OS=$( uname -s | tr ' [:upper:]' ' [:lower:]' )
1212EXTRA_FLAGS=" -Xlinker -rpath -Xlinker ${INSTALL_DIR} /lib"
13+ RAW_TEST_RESULTS=" ${PROJECT_DIRECTORY} /rawTestResults"
14+ XML_TEST_RESULTS=" ${PROJECT_DIRECTORY} /testResults.xml"
1315
1416# ssl setup
1517SSL=${SSL:- nossl}
@@ -35,4 +37,16 @@ swiftenv local $SWIFT_VERSION
3537swift build $EXTRA_FLAGS
3638
3739# test the driver
38- MONGODB_TOPOLOGY=${TOPOLOGY} MONGODB_URI=$MONGODB_URI swift test $EXTRA_FLAGS
40+ set +o errexit # even if tests fail we want to parse the results, so disable errexit
41+ set -o pipefail # propagate error codes in the following pipes
42+
43+ MONGODB_TOPOLOGY=${TOPOLOGY} MONGODB_URI=$MONGODB_URI swift test $EXTRA_FLAGS 2>&1 | tee ${RAW_TEST_RESULTS}
44+
45+ # save tests exit code
46+ EXIT_CODE=$?
47+
48+ # convert tests to XML
49+ cat ${RAW_TEST_RESULTS} | swift " ${PROJECT_DIRECTORY} /etc/convert-test-results.swift" > ${XML_TEST_RESULTS}
50+
51+ # exit with exit code for running the tests
52+ exit $EXIT_CODE
Original file line number Diff line number Diff line change @@ -54,7 +54,6 @@ excluded:
5454 - Tests/LinuxMain.swift
5555 - Sources/MongoSwiftSync/Exports.swift
5656 - Sources/MongoSwift/MongoSwiftVersion.swift
57- - etc
5857
5958trailing_whitespace :
6059 ignores_comments : false
You can’t perform that action at this time.
0 commit comments