diff options
author | Sara Golemon <sara.golemon@mongodb.com> | 2019-02-21 16:53:20 +0000 |
---|---|---|
committer | Sara Golemon <sara.golemon@mongodb.com> | 2019-02-22 14:43:24 +0000 |
commit | 57a2f5ccbf50477fd96f76d34ab7a9a43d640121 (patch) | |
tree | d5dd8041be18f6464ff46d400a068bdf05bd0554 /src/mongo/dbtests | |
parent | 760b9bfda8ccb0023743bb6ac7272d90c0041070 (diff) | |
download | mongo-57a2f5ccbf50477fd96f76d34ab7a9a43d640121.tar.gz |
SERVER-39718 Migrate dbtests framework options to IDL
Diffstat (limited to 'src/mongo/dbtests')
-rw-r--r-- | src/mongo/dbtests/SConscript | 1 | ||||
-rw-r--r-- | src/mongo/dbtests/framework_options.cpp | 82 | ||||
-rw-r--r-- | src/mongo/dbtests/framework_options.idl | 102 |
3 files changed, 103 insertions, 82 deletions
diff --git a/src/mongo/dbtests/SConscript b/src/mongo/dbtests/SConscript index e0bfe3859ce..d0dc431b9b4 100644 --- a/src/mongo/dbtests/SConscript +++ b/src/mongo/dbtests/SConscript @@ -12,6 +12,7 @@ env.Library( target="framework_options", source=[ "framework_options.cpp", + env.Idlc("framework_options.idl")[0], ], LIBDEPS=[ '$BUILD_DIR/mongo/db/server_options_core', diff --git a/src/mongo/dbtests/framework_options.cpp b/src/mongo/dbtests/framework_options.cpp index 3928619c54b..c8940e3df68 100644 --- a/src/mongo/dbtests/framework_options.cpp +++ b/src/mongo/dbtests/framework_options.cpp @@ -49,13 +49,6 @@ namespace mongo { -namespace { - -// This specifies default dbpath for our testing framework -const std::string default_test_dbpath = "/tmp/unittest"; - -} // namespace - using std::cout; using std::endl; using std::string; @@ -63,59 +56,6 @@ using std::vector; FrameworkGlobalParams frameworkGlobalParams; -Status addTestFrameworkOptions(moe::OptionSection* options) { - options->addOptionChaining("help", "help,h", moe::Switch, "show this usage information"); - - options - ->addOptionChaining( - "dbpath", - "dbpath", - moe::String, - "db data path for this test run. NOTE: the contents of this directory will " - "be overwritten if it already exists") - .setDefault(moe::Value(default_test_dbpath)); - - options->addOptionChaining("debug", "debug", moe::Switch, "run tests with verbose output"); - - options->addOptionChaining("list", "list,l", moe::Switch, "list available test suites"); - - options->addOptionChaining( - "filter", "filter,f", moe::String, "string substring filter on test name"); - - options->addOptionChaining("verbose", "verbose,v", moe::Switch, "verbose"); - - options->addOptionChaining( - "dur", "dur", moe::Switch, "enable journaling (currently the default)"); - - options->addOptionChaining("nodur", "nodur", moe::Switch, "disable journaling"); - - options->addOptionChaining("seed", "seed", moe::UnsignedLongLong, "random number seed"); - - options->addOptionChaining("runs", "runs", moe::Int, "number of times to run each test"); - - options->addOptionChaining( - "perfHist", "perfHist", moe::Unsigned, "number of back runs of perf stats to display"); - - // If set to true, storage engine maintains the data history. Else, it won't maintain the data - // history. This setting applies only to 'wiredTiger' storage engine. - options - ->addOptionChaining("replication.enableMajorityReadConcern", - "enableMajorityReadConcern", - moe::Bool, - "enables majority readConcern") - .setDefault(moe::Value(true)); - options - ->addOptionChaining( - "storage.engine", "storageEngine", moe::String, "what storage engine to use") - .setDefault(moe::Value(std::string("wiredTiger"))); - - options->addOptionChaining("suites", "suites", moe::StringVector, "test suites to run") - .hidden() - .positional(1, -1); - - return Status::OK(); -} - std::string getTestFrameworkHelp(StringData name, const moe::OptionSection& options) { StringBuilder sb; sb << "usage: " << name << " [options] [suite]...\n" @@ -148,19 +88,6 @@ Status storeTestFrameworkOptions(const moe::Environment& params, frameworkGlobalParams.dbpathSpec = params["dbpath"].as<string>(); } - if (params.count("seed")) { - frameworkGlobalParams.seed = params["seed"].as<unsigned long long>(); - } - - if (params.count("runs")) { - frameworkGlobalParams.runsPerTest = params["runs"].as<int>(); - } - - if (params.count("perfHist")) { - frameworkGlobalParams.perfHist = params["perfHist"].as<unsigned>(); - } - - if (params.count("debug") || params.count("verbose")) { logger::globalLogDomain()->setMinimumLoggedSeverity(logger::LogSeverity::Debug(1)); } @@ -203,15 +130,6 @@ Status storeTestFrameworkOptions(const moe::Environment& params, params["replication.enableMajorityReadConcern"].as<bool>(); } - if (params.count("suites")) { - frameworkGlobalParams.suites = params["suites"].as<vector<string>>(); - } - - frameworkGlobalParams.filter = ""; - if (params.count("filter")) { - frameworkGlobalParams.filter = params["filter"].as<string>(); - } - return Status::OK(); } } diff --git a/src/mongo/dbtests/framework_options.idl b/src/mongo/dbtests/framework_options.idl new file mode 100644 index 00000000000..29311cae79a --- /dev/null +++ b/src/mongo/dbtests/framework_options.idl @@ -0,0 +1,102 @@ +# Copyright (C) 2019-present MongoDB, Inc. +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the Server Side Public License, version 1, +# as published by MongoDB, Inc. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# Server Side Public License for more details. +# +# You should have received a copy of the Server Side Public License +# along with this program. If not, see +# <http://www.mongodb.com/licensing/server-side-public-license>. +# +# As a special exception, the copyright holders give permission to link the +# code of portions of this program with the OpenSSL library under certain +# conditions as described in each individual source file and distribute +# linked combinations including the program with the OpenSSL library. You +# must comply with the Server Side Public License in all respects for +# all of the code used other than as permitted herein. If you modify file(s) +# with this exception, you may extend this exception to your version of the +# file(s), but you are not obligated to do so. If you do not wish to do so, +# delete this exception statement from your version. If you delete this +# exception statement from all source files in the program, then also delete +# it in the license file. +# + +global: + cpp_namespace: "mongo" + cpp_includes: + - "mongo/dbtests/framework_options.h" + configs: + source: cli + initializer: + register: addTestFrameworkOptions + +configs: + help: + description: 'Show this usage information' + arg_vartype: Switch + single_name: h + dbpath: + description: >- + db data path for this test run. NOTE: the contents of this + directory will be overwritten if it already exists + arg_vartype: String + default: '/tmp/unittest' + debug: + description: 'Run tests with verbose output' + arg_vartype: Switch + list: + description: 'List available test suites' + arg_vartype: Switch + single_name: l + filter: + description: 'String substring filter on test name' + arg_vartype: String + single_name: f + cpp_varname: 'frameworkGlobalParams.filter' + verbose: + description: Verbose + arg_vartype: Switch + single_name: v + dur: + description: 'Enable journaling (currently the default)' + arg_vartype: Switch + nodur: + description: 'Disable journaling' + arg_vartype: Switch + seed: + description: 'Random number seed' + arg_vartype: UnsignedLongLong + cpp_varname: 'frameworkGlobalParams.seed' + runs: + description: 'Number of times to run each test' + arg_vartype: Int + cpp_varname: 'frameworkGlobalParams.runsPerTest' + perfHist: + description: 'Number of back runs of perf stats to display' + arg_vartype: Unsigned + cpp_varname: 'frameworkGlobalParams.perfHist' + "replication.enableMajorityReadConcern": + # If set to true, storage engine maintains the data history. + # Else, it won't maintain the data history. + # This setting applies only to 'wiredTiger' storage engine. + description: 'Enables majority readConcern' + arg_vartype: Bool + short_name: enableMajorityReadConcern + default: true + "storage.engine": + description: 'What storage engine to use' + arg_vartype: String + short_name: storageEngine + default: wiredTiger + suites: + description: 'Test suites to run' + arg_vartype: StringVector + cpp_varname: 'frameworkGlobalParams.suites' + hidden: true + positional: '1-' + |