I noticed that there are some unit tests in foundationdb’s source code(link), but I do not know how to run them, could someone please give me some advice on how to build and run them? Thanks in advance
Unit tests can be run in simulation via
fdbserver -r simulation -f <specfile> [-s <randomseed>] [-b <on|off>]
where a spec file invokes the
UnitTests workload with a prefix pattern to match against unit test names to determine the set of tests to run. The spec file can also pass test parameters, one per line, with the same
name=value syntax as the
testsMatching line which populates the
params object that is available within the scope of a unit test.
This file serves as a template for running a specific unit test:
In FDB 7.0 there is also a faster path to running unit tests in normal, non-simulation mode, which is
fdbserver -r unittests -f <prefixPattern> [--test_param name=value]...
fdbserver -r unittests -f /status/json/builder
@SteavedHams man, I build my fdb based on commit_id
d183b0c7c, and when I run the command
./bin/fdbserver -r unittests -f /status/json/builder, it just returned
ERROR: Unknown role 'unittests'
My apologies, the
-r unittests method is new for FDB 7.0, prior to that you must use the other method.
I would be grateful if u can tell me where is the documentation about “the other method”, because I really cant find it
My post above had 2 usage forms, you tried the second one at the end of the post. You’ll have to use the first one, from the beginning of the post.
thx a lot, so before version 7.0 there is no way to test without simulation, right?
There actually is, but there are some quirks to it. You can use
-r test instead of
-r simulation along with
-f <specfile>, but this mode requires a cluster file because it assumes the test is executing a workload against a live cluster. Even if the test spec says
useDB = no a cluster file will still be required. Since most unit tests do not use a cluster, you can just pass a dummy cluster file with contents such as