c++ - Can I make google test return 0 even when tests fail? -
i calling googletest in post-build step of c++ project in vs 2012.
naturally, when of tests fail, googletest command returns failure (-1), , entire project marked failure visual studio.
i not want that. want googletest run, , want see results in output, not want fail project if not tests pass.
is there flag can pass googletest returns success (zero)?
yes, can make test return 0
if write own main
function.
i imagine you're linking test executable special gtest_main
library basic helper allow avoid having write own main
function.
it's pretty doing:
int main(int argc, char **argv) { printf("running main() gtest_main.cc\n"); testing::initgoogletest(&argc, argv); return run_all_tests(); }
the run_all_tests
macro culprit returning -1
, need stop linking gtest_main
, write own main
more like:
int main(int argc, char **argv) { testing::initgoogletest(&argc, argv); run_all_tests(); return 0; }
for more info on topic, see the googletest docs.
Comments
Post a Comment