Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion .evergreen/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,7 @@ functions:
script: |
${PREPARE_SHELL}
sh ${DRIVERS_TOOLS}/.evergreen/stop-orchestration.sh

"upload-mo-artifacts":
- command: shell.exec
params:
Expand Down Expand Up @@ -152,7 +153,12 @@ functions:
SSL=${SSL} \
AUTH=${AUTH} \
SWIFT_VERSION=${SWIFT_VERSION} \
sh ${PROJECT_DIRECTORY}/.evergreen/run-tests.sh
${PROJECT_DIRECTORY}/.evergreen/run-tests.sh
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

pipefail isn't supported by dash, which was being used instead of bash here on Ubuntu


"upload test results":
- command: attach.xunit_results
params:
file: ./src/testResults.xml

"run atlas tests":
- command: shell.exec
Expand Down Expand Up @@ -199,6 +205,7 @@ pre:
post:
- func: "stop mongo-orchestration"
- func: "upload-mo-artifacts"
- func: "upload test results"
- func: "cleanup"

tasks:
Expand Down
20 changes: 17 additions & 3 deletions .evergreen/run-tests.sh
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,15 +1,17 @@
#!/bin/sh
#!/bin/bash
set -o xtrace # Write all commands first to stderr
set -o errexit # Exit the script with error if any of the commands fail

# variables
PROJECT_DIRECTORY=${PROJECT_DIRECTORY:-$PWD}
MONGODB_URI=${MONGODB_URI:-"NO_URI_PROVIDED"}
SWIFT_VERSION=${SWIFT_VERSION:-5.0.3}
SWIFT_VERSION=${SWIFT_VERSION:-5.1}
INSTALL_DIR="${PROJECT_DIRECTORY}/opt"
TOPOLOGY=${TOPOLOGY:-single}
OS=$(uname -s | tr '[:upper:]' '[:lower:]')
EXTRA_FLAGS="-Xlinker -rpath -Xlinker ${INSTALL_DIR}/lib"
RAW_TEST_RESULTS="${PROJECT_DIRECTORY}/rawTestResults"
XML_TEST_RESULTS="${PROJECT_DIRECTORY}/testResults.xml"

# ssl setup
SSL=${SSL:-nossl}
Expand All @@ -35,4 +37,16 @@ swiftenv local $SWIFT_VERSION
swift build $EXTRA_FLAGS

# test the driver
MONGODB_TOPOLOGY=${TOPOLOGY} MONGODB_URI=$MONGODB_URI swift test $EXTRA_FLAGS
set +o errexit # even if tests fail we want to parse the results, so disable errexit
set -o pipefail # propagate error codes in the following pipes

MONGODB_TOPOLOGY=${TOPOLOGY} MONGODB_URI=$MONGODB_URI swift test $EXTRA_FLAGS 2>&1 | tee ${RAW_TEST_RESULTS}

# save tests exit code
EXIT_CODE=$?

# convert tests to XML
cat ${RAW_TEST_RESULTS} | swift "${PROJECT_DIRECTORY}/etc/convert-test-results.swift" > ${XML_TEST_RESULTS}

# exit with exit code for running the tests
exit $EXIT_CODE
1 change: 0 additions & 1 deletion .swiftlint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,6 @@ excluded:
- Tests/LinuxMain.swift
- Sources/MongoSwiftSync/Exports.swift
- Sources/MongoSwift/MongoSwiftVersion.swift
- etc

trailing_whitespace:
ignores_comments: false
Loading