I have a suite of unit tests that is managed by googletest. These tests are run in multiple threads by default, even when I use --gtest_filter=foo.test
so that it only runs a single test. This is causing ambiguity about the cause of a bug I'm trying to hammer out.
How can multithreaded testing be turned off in googletest?
A single-threaded process is the execution of programmed instructions in a single sequence. Having said that, if an application has the following set of instructions: Instruction A. Instruction B.
gMock is a library (sometimes we also call it a “framework” to make it sound cool) for creating mock classes and using them. It does to C++ what jMock/EasyMock does to Java (well, more or less).
There's no commandline switch for single/multi-threading. libgtest
is built either
single-threading or multi-threading.
To make it single-threading, build gtest with ./configure --with-pthreads=no
, then link your unit test app without -pthread
If you only want single threading sometimes, then make a no-pthreads build of libgtest
,
call it something else, and link it when you want.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With