|
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 |
|
5 | | -# Supported/used environment variables: |
6 | | -# AUTH Set to enable authentication. Defaults to "noauth" |
7 | | -# SSL Set to enable SSL. Defaults to "nossl" |
8 | | -# MONGODB_URI Set the suggested connection MONGODB_URI (including credentials and topology info) |
9 | | -# MARCH Machine Architecture. Defaults to lowercase uname -m |
10 | | - |
11 | | -AUTH=${AUTH:-noauth} |
12 | | -SSL=${SSL:-nossl} |
13 | | -MONGODB_URI=${MONGODB_URI:-} |
14 | | - |
| 5 | +# variables |
| 6 | +PROJECT_DIRECTORY=${PROJECT_DIRECTORY:-$PWD} |
| 7 | +MONGODB_URI=${MONGODB_URI:-"NO_URI_PROVIDED"} |
| 8 | +SWIFT_VERSION=${SWIFT_VERSION:-4.2} |
| 9 | +INSTALL_DIR="${PROJECT_DIRECTORY}/opt" |
| 10 | +TOPOLOGY=${TOPOLOGY:-single} |
15 | 11 | OS=$(uname -s | tr '[:upper:]' '[:lower:]') |
16 | | -[ -z "$MARCH" ] && MARCH=$(uname -m | tr '[:upper:]' '[:lower:]') |
17 | 12 |
|
18 | | -if [ "$AUTH" != "noauth" ]; then |
19 | | - export MONGOC_TEST_USER="bob" |
20 | | - export MONGOC_TEST_PASSWORD="pwd123" |
21 | | -fi |
| 13 | +# enable swiftenv |
| 14 | +export SWIFTENV_ROOT="${INSTALL_DIR}/swiftenv" |
| 15 | +export PATH="${SWIFTENV_ROOT}/bin:$PATH" |
| 16 | +eval "$(swiftenv init -)" |
| 17 | + |
| 18 | +# switch swift version, and run tests |
| 19 | +export PKG_CONFIG_PATH="${INSTALL_DIR}/lib/pkgconfig" |
22 | 20 |
|
23 | | -if [ "$SSL" != "nossl" ]; then |
24 | | - export MONGOC_TEST_SSL_PEM_FILE="$DRIVERS_TOOLS/.evergreen/x509gen/client.pem" |
25 | | - export MONGOC_TEST_SSL_CA_FILE="$DRIVERS_TOOLS/.evergreen/x509gen/ca.pem" |
26 | | -fi |
| 21 | +# override where we look for libmongoc |
| 22 | +export LD_LIBRARY_PATH="${INSTALL_DIR}/lib" |
| 23 | +export DYLD_LIBRARY_PATH="${INSTALL_DIR}/lib" |
27 | 24 |
|
28 | | -echo "Running $AUTH tests over $SSL, connecting to $MONGODB_URI" |
29 | | -make test |
| 25 | +swiftenv local $SWIFT_VERSION |
| 26 | +MONGODB_TOPOLOGY=${TOPOLOGY} MONGODB_URI=$MONGODB_URI make test |
0 commit comments