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:
102102 script : |
103103 ${PREPARE_SHELL}
104104 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
106111
107112pre :
108113 - func : " fetch source"
109114 - func : " install swift"
110115
116+ post :
117+ - func : " upload test results"
118+
111119tasks :
112120 - name : " test"
113121 commands :
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
@@ -7,6 +7,8 @@ PROJECT_DIRECTORY=${PROJECT_DIRECTORY:-$PWD}
77SWIFT_VERSION=${SWIFT_VERSION:- 5.2.4}
88INSTALL_DIR=" ${PROJECT_DIRECTORY} /opt"
99OS=$( uname -s | tr ' [:upper:]' ' [:lower:]' )
10+ RAW_TEST_RESULTS=" ${PROJECT_DIRECTORY} /rawTestResults"
11+ XML_TEST_RESULTS=" ${PROJECT_DIRECTORY} /testResults.xml"
1012
1113# enable swiftenv
1214export SWIFTENV_ROOT=" ${INSTALL_DIR} /swiftenv"
@@ -24,5 +26,19 @@ swiftenv local $SWIFT_VERSION
2426# build the driver
2527swift build
2628
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+
2734# 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