diff options
author | Billy Donahue <billy.donahue@mongodb.com> | 2022-03-16 19:51:37 +0000 |
---|---|---|
committer | Evergreen Agent <no-reply@evergreen.mongodb.com> | 2022-03-16 21:20:54 +0000 |
commit | b372b25622b9ec4dd7ae5b8e3424218b8eaa774a (patch) | |
tree | afb7b185b2fdf16d3e3d025ec93afd77c7edaa0e /src/mongo/unittest/death_test.h | |
parent | eef965232b1932c519e4df3e436c8cc603753b72 (diff) | |
download | mongo-b372b25622b9ec4dd7ae5b8e3424218b8eaa774a.tar.gz |
SERVER-61860 exec in most DEATH_TESTs
Diffstat (limited to 'src/mongo/unittest/death_test.h')
-rw-r--r-- | src/mongo/unittest/death_test.h | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/src/mongo/unittest/death_test.h b/src/mongo/unittest/death_test.h index 1472b2f712d..4e1643625e5 100644 --- a/src/mongo/unittest/death_test.h +++ b/src/mongo/unittest/death_test.h @@ -116,10 +116,22 @@ namespace mongo::unittest { class DeathTestBase : public Test { +public: + /** + * A test can use this to opt-out of exec behavior. + * Would have to be called by the constructor. By the time the test body is + * running, it's too late. + */ + void setExec(bool enable) { + _exec = enable; + } + protected: DeathTestBase() = default; private: + struct Subprocess; + // Forks, executes _doMakeTest() in the child process to create a Test, then runs that Test. void _doTest() final; @@ -129,6 +141,12 @@ private: virtual bool _isRegex() = 0; virtual int _getLine() = 0; virtual std::string _getFile() = 0; + + /** + * All death tests will fork a subprocess. + * Some will be configured to then go ahead and exec. + */ + bool _exec = true; }; template <typename T> |