-
Notifications
You must be signed in to change notification settings - Fork 548
CXX-2297 add connect.sh and Atlas Serverless connectivity test #833
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,54 @@ | ||
| #!/bin/bash | ||
|
|
||
| set -o errexit | ||
| set -o pipefail | ||
|
|
||
| LIB_DIR=${LIB_DIR:-"lib"} | ||
| BUILD_TYPE=${BUILD_TYPE:-"Debug"} | ||
|
|
||
| print_usage_and_exit () { | ||
| echo "Error: $1" | ||
| cat << EOF | ||
| connect.sh runs the connect example with a MongoDB URI. | ||
|
|
||
| Example usage: | ||
| MONGOC_INSTALL_PREFIX=/Users/kevin.albertson/install/mongo-c-driver-1.18.0 \\ | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Up to you if you want to leave your name in here, or if it should be scrubbed. I am fine with it as-is.
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Leaving as-is. |
||
| MONGOCXX_INSTALL_PREFIX=/Users/kevin.albertson/install/mongo-cxx-driver-dev \\ | ||
| LIB_DIR="lib" \\ | ||
| BUILD_TYPE="Debug" \\ | ||
| BUILD_DIR=$(pwd)/cmake-build \\ | ||
| URI="mongodb://localhost:27017/?" \\ | ||
| ./.evergreen/connect.sh | ||
| EOF | ||
| exit 1; | ||
| } | ||
|
|
||
| if [ -z "$URI" ]; then | ||
| print_usage_and_exit "URI is a required environment variable." | ||
| fi | ||
| if [ -z "$MONGOC_INSTALL_PREFIX" ]; then | ||
| print_usage_and_exit "MONGOC_INSTALL_PREFIX is a required environment variable." | ||
| fi | ||
| if [ -z "$MONGOCXX_INSTALL_PREFIX" ]; then | ||
| print_usage_and_exit "MONGOCXX_INSTALL_PREFIX is a required environment variable." | ||
| fi | ||
| if [ -z "$BUILD_DIR" ]; then | ||
| print_usage_and_exit "BUILD_DIR is a required environment variable." | ||
| fi | ||
|
|
||
| # Use PATH / LD_LIBRARY_PATH / DYLD_LIBRARY_PATH to inform the tests where to find | ||
| # mongoc library dependencies on Windows / Linux / Mac OS, respectively. | ||
| export PATH=$PATH:$MONGOC_INSTALL_PREFIX/bin | ||
| export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$MONGOC_INSTALL_PREFIX/$LIB_DIR/ | ||
| export DYLD_LIBRARY_PATH=$DYLD_LIBRARY_PATH:$MONGOC_INSTALL_PREFIX/$LIB_DIR/ | ||
|
|
||
| # Windows also needs to be informed where to find mongocxx library dependencies. | ||
| export PATH=$PATH:$BUILD_DIR/src/bsoncxx/$BUILD_TYPE | ||
| export PATH=$PATH:$BUILD_DIR/src/mongocxx/$BUILD_TYPE | ||
| export PATH=$PATH:$MONGOCXX_INSTALL_PREFIX/bin | ||
|
|
||
| if [ "Windows_NT" == "$OS" ]; then | ||
| $BUILD_DIR/examples/mongocxx/$BUILD_TYPE/connect.exe "$URI" | ||
| else | ||
| $BUILD_DIR/examples/mongocxx/connect "$URI" | ||
| fi | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The motivation for moving this into a separate script file is to make it easier to run locally. I build in a directory named
cmake-buildand can run this locally as follows:There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there a place (even as an extended comment at the beginning of the script, but perhaps as a help screen?) where you can put a scrubbed version of this example? Sounds very useful!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good idea, done!