summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Morrow <acm@mongodb.com>2018-05-23 19:38:59 -0400
committerAndrew Morrow <acm@mongodb.com>2018-05-25 14:46:07 -0400
commitb63adc38fc934def5fd7463e390f21ad3bdedffb (patch)
tree88fa2c970dd014ee2031da501a62a650cb845639
parentd830da4c2702c31d252babe3412594e3036fe0f9 (diff)
downloadmongo-b63adc38fc934def5fd7463e390f21ad3bdedffb.tar.gz
SERVER-33889 Remove auditing command from embedded
(cherry picked from commit b322ee9200172276b8d4935c623728129d62c3ef)
-rwxr-xr-xbuildscripts/runandroidsim.sh40
-rwxr-xr-xbuildscripts/runiossim.sh15
-rw-r--r--src/mongo/client/embedded/embedded_transport_layer_test.cpp1
-rw-r--r--src/mongo/client/embedded/libmongodbcapi_test.cpp121
4 files changed, 100 insertions, 77 deletions
diff --git a/buildscripts/runandroidsim.sh b/buildscripts/runandroidsim.sh
index 49038786b76..458cd93c2f8 100755
--- a/buildscripts/runandroidsim.sh
+++ b/buildscripts/runandroidsim.sh
@@ -20,28 +20,46 @@ shift
EMULATOR_PID=''
cleanup() {
- kill $EMULATOR_PID
- wait $EMULATOR_PID
- $ANDROID_SDK/tools/bin/avdmanager delete avd -n android_avd
-}
+ echo "Cleanup handler invoked"
+
+ if [ -z "$EMULATOR_PID" ]; then
+ echo "No EMULATOR_PID found; not killing"
+ else
+ echo "Killing emulator"
+ kill $EMULATOR_PID || true
-trap cleanup EXIT
+ echo "Waiting for emulator to shut down"
+ wait $EMULATOR_PID || true
+ fi
-# create a virtual device
+ echo "Deleting the virtual device"
+ $ANDROID_SDK/tools/bin/avdmanager delete avd -n android_avd || true
+
+ echo "Exiting with status $1"
+ exit $1
+}
+
+echo "Creating Android virtual device"
echo no | $ANDROID_SDK/tools/bin/avdmanager create avd --force -k "system-images;android-24;google_apis;$ANDROID_SYSTEM_IMAGE_ARCH" --name android_avd --abi google_apis/$ANDROID_SYSTEM_IMAGE_ARCH -p android_avd
-# start the device on the emulator
+trap 'cleanup $?' INT TERM EXIT
+
+echo "Starting the virtual device on the emulator"
$ANDROID_SDK/emulator/emulator @android_avd -no-window -no-audio &
EMULATOR_PID=$!
-#wait for the adb service to be ready for commands
+echo "Waiting for the adb service to be ready for commands"
$ANDROID_SDK/platform-tools/adb wait-for-device
-#have the adb service become root
+echo "Making the adb service become root"
$ANDROID_SDK/platform-tools/adb root
-#move the test to the device
+echo "Copying the test to the virtual device"
$ANDROID_SDK/platform-tools/adb push $DIRECTORY /data
-#run the device
+echo "Running the test on the virtual device"
$ANDROID_SDK/platform-tools/adb shell /data/$(basename $DIRECTORY)/$TEST_PATH_IN_DIRECTORY "$@"
+
+# Do not add additional statements after the above adb invocation without
+# forwarding its exit status or you will cause failing tests to appear
+# to succeed.
diff --git a/buildscripts/runiossim.sh b/buildscripts/runiossim.sh
index 73cfe8ffe28..77e0be6b75d 100755
--- a/buildscripts/runiossim.sh
+++ b/buildscripts/runiossim.sh
@@ -25,23 +25,30 @@ shift
cleanup() {
echo "Shutting down simulator"
- xcrun simctl shutdown $_SimId
+ xcrun simctl shutdown $_SimId || true
echo "Erasing simulator"
- xcrun simctl erase $_SimId
+ xcrun simctl erase $_SimId || true
echo "Deleting simulator"
- xcrun simctl delete $_SimId
+ xcrun simctl delete $_SimId || true
+
+ echo "Exiting with status $1"
+ exit $1
}
echo "Creating simulator"
_SimId=$(xcrun simctl create mongodb-simulator-$DEVICE.$RUNTIME "com.apple.CoreSimulator.SimDeviceType.$DEVICE" "com.apple.CoreSimulator.SimRuntime.$RUNTIME")
echo "Simulator created with ID $_SimId"
-trap cleanup EXIT
+trap 'cleanup $?' INT TERM EXIT
echo "Booting simulator"
xcrun simctl boot $_SimId
echo "Spawning test program in simulator"
xcrun simctl spawn $_SimId "$TEST" "$@"
+
+# Do not add additional statements after the above spawn without
+# forwarding its exit status or you will cause failing tests to appear
+# to succeed.
diff --git a/src/mongo/client/embedded/embedded_transport_layer_test.cpp b/src/mongo/client/embedded/embedded_transport_layer_test.cpp
index f0ec982eee8..a256cb75f32 100644
--- a/src/mongo/client/embedded/embedded_transport_layer_test.cpp
+++ b/src/mongo/client/embedded/embedded_transport_layer_test.cpp
@@ -221,7 +221,6 @@ int main(int argc, char** argv, char** envp) {
}
mongoc_cleanup();
-
globalTempDir.reset();
mongo::quickExit(result);
}
diff --git a/src/mongo/client/embedded/libmongodbcapi_test.cpp b/src/mongo/client/embedded/libmongodbcapi_test.cpp
index 574bec94be2..df780bbe265 100644
--- a/src/mongo/client/embedded/libmongodbcapi_test.cpp
+++ b/src/mongo/client/embedded/libmongodbcapi_test.cpp
@@ -521,66 +521,64 @@ TEST_F(MongodbCAPITest, InsertAndUpdate) {
TEST_F(MongodbCAPITest, RunListCommands) {
auto client = createClient();
- std::vector<std::string> whitelist = {
- "_hashBSONElement",
- "aggregate",
- "buildInfo",
- "cloneCollectionAsCapped",
- "collMod",
- "collStats",
- "configureFailPoint",
- "convertToCapped",
- "count",
- "create",
- "createIndexes",
- "currentOp",
- "dataSize",
- "dbStats",
- "delete",
- "distinct",
- "drop",
- "dropDatabase",
- "dropIndexes",
- "echo",
- "explain",
- "find",
- "findAndModify",
- "geoNear",
- "getLastError",
- "getMore",
- "getParameter",
- "getPrevError",
- "getShardMap",
- "insert",
- "isMaster",
- "killCursors",
- "killOp",
- "listCollections",
- "listCommands",
- "listDatabases",
- "listIndexes",
- "lockInfo",
- "logApplicationMessage", // TODO: See whether we need this command
- "ping",
- "planCacheClear",
- "planCacheClearFilters",
- "planCacheListFilters",
- "planCacheListPlans",
- "planCacheListQueryShapes",
- "planCacheSetFilter",
- "reIndex",
- "renameCollection",
- "repairCursor",
- "repairDatabase",
- "replSetGetStatus",
- "resetError",
- "serverStatus",
- "setBatteryLevel",
- "setParameter",
- "sleep",
- "trimMemory",
- "update",
- "validate"};
+ std::vector<std::string> whitelist = {"_hashBSONElement",
+ "aggregate",
+ "buildInfo",
+ "cloneCollectionAsCapped",
+ "collMod",
+ "collStats",
+ "configureFailPoint",
+ "convertToCapped",
+ "count",
+ "create",
+ "createIndexes",
+ "currentOp",
+ "dataSize",
+ "dbStats",
+ "delete",
+ "distinct",
+ "drop",
+ "dropDatabase",
+ "dropIndexes",
+ "echo",
+ "explain",
+ "find",
+ "findAndModify",
+ "geoNear",
+ "getLastError",
+ "getMore",
+ "getParameter",
+ "getPrevError",
+ "getShardMap",
+ "insert",
+ "isMaster",
+ "killCursors",
+ "killOp",
+ "listCollections",
+ "listCommands",
+ "listDatabases",
+ "listIndexes",
+ "lockInfo",
+ "ping",
+ "planCacheClear",
+ "planCacheClearFilters",
+ "planCacheListFilters",
+ "planCacheListPlans",
+ "planCacheListQueryShapes",
+ "planCacheSetFilter",
+ "reIndex",
+ "renameCollection",
+ "repairCursor",
+ "repairDatabase",
+ "replSetGetStatus",
+ "resetError",
+ "serverStatus",
+ "setBatteryLevel",
+ "setParameter",
+ "sleep",
+ "trimMemory",
+ "update",
+ "validate"};
std::sort(whitelist.begin(), whitelist.end());
mongo::BSONObj listCommandsObj = mongo::fromjson("{ listCommands: 1 }");
@@ -716,7 +714,8 @@ int main(const int argc, const char* const* const argv) {
std::cerr << "Did not get a log callback." << std::endl;
}
- ::mongo::unittest::Suite::run(std::vector<std::string>(), "", 1);
+ const auto result = ::mongo::unittest::Suite::run(std::vector<std::string>(), "", 1);
globalTempDir.reset();
+ mongo::quickExit(result);
}