scons smoke smokeCppUnittests smokeDisk smokeTool smokeAuth startMongod smokeClient smokeJs
scons startMongodSmallOplog smokeJs
scons startMongod smokeJsSlowNightly
scons smokeTool
scons smokeReplSets
scons smokeDur
scons mongosTest smokeSharding
scons smokeRepl smokeClone
scons startMongod smokeParallel
smoke.py lets you run a subsets of the tests in jstests/. When it is running tests, it starts up an instance of mongod, runs the tests, and then shuts it down again. You can run it while running other instances of MongoDB on the same machine: it uses ports in the 30000 range and its own data directories.
For the moment, smoke.py must be run from the top-level directory of a MongoDB source repository. This directory must contain at least the mongo and mongod binaries. To run certain tests, you’ll also need to build the tools and mongos. It’s a good idea to run scons . before running the tests.
To run smoke.py you’ll need a recent version of PyMongo.
To see the possible options, run:
$ python buildscripts/smoke.py --help
Usage: smoke.py [OPTIONS] ARGS*
Options:
-h, --help show this help message and exit
--mode=MODE If "files", ARGS are filenames; if "suite", ARGS are
sets of tests (suite)
--test-path=TEST_PATH
Path to the test executables to run, currently only
used for 'client' (none)
--mongod=MONGOD_EXECUTABLE
Path to mongod to run (/Users/mike/10gen/mongo/mongod)
--port=MONGOD_PORT Port the mongod will bind to (32000)
--mongo=SHELL_EXECUTABLE
Path to mongo, for .js test files
(/Users/mike/10gen/mongo/mongo)
--continue-on-failure
If supplied, continue testing even after a test fails
--from-file=FILE Run tests/suites named in FILE, one test per line, '-'
means stdin
--smoke-db-prefix=SMOKE_DB_PREFIX
Prefix to use for the mongods' dbpaths ('')
--small-oplog Run tests with master/slave replication & use a small
oplog
Note
By default, smoke.py will run tests that create data in /data/db, which may interfere with other MongoDB instances you are running. To change the directory in which the smoke tests create databases, use --smoke-db-prefix=/some/other/path
To run specific tests, use the --mode=files option:
python buildscripts/smoke.py --mode=files jstests/find1.js
You can specify as many files as you want.
You can also run a suite of tests. Suites are predefined and include:
To run a suite, specify the suite’s name:
python buildscripts/smoke.py js
You can run a jstest directly from the shell, for example:
mongo --nodb jstests/replsets/replsetarb3.js
The tests under jstests/ folder are written in mongo shell javascript. However there are a set of C++ unit tests also. To run them:
scons test
./test
Build the unit tests (in src/mongo/unittest/ by running:
$ scons build/unittests.txt
/* build output */
Generating build/unittests.txt
build/linux2/dd/durableDefaultOff/mongo/platform/atomic_word_test
...
build/linux2/dd/durableDefaultOff/mongo/bson_template_evaluator_test
build/linux2/dd/durableDefaultOff/mongo/balancer_policy_test
scons: done building targets.
Then use the line above to run the binary generated:
$ ./build/linux2/dd/durableDefaultOff/mongo/platform/atomic_word_test
See also