From ccba2fbce68f0237791a68ec6f4448129429546d Mon Sep 17 00:00:00 2001 From: Xadhoom <> Date: Sun, 14 Mar 2021 13:37:35 +0000 Subject: [PATCH] Allow running the game and tests simultaneously --- CMakeLists.txt | 2 +- SourceX/main.cpp | 6 ++++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index b22fe2c0c..f82909f9f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -411,7 +411,7 @@ if(RUN_TESTS) include_directories(${GTEST_INCLUDE_DIRS}) add_definitions(-fprofile-arcs -ftest-coverage -DRUN_TESTS) target_link_libraries(${BIN_TARGET} PRIVATE -fprofile-arcs ${GTEST_LIBRARIES}) - gtest_add_tests(${BIN_TARGET} "" AUTO) + gtest_add_tests(${BIN_TARGET} "--tests-only" AUTO) endif() target_include_directories(devilution PUBLIC Source SourceS ${CMAKE_CURRENT_BINARY_DIR}) diff --git a/SourceX/main.cpp b/SourceX/main.cpp index 0b1e867dd..dcae8fe10 100644 --- a/SourceX/main.cpp +++ b/SourceX/main.cpp @@ -22,7 +22,10 @@ int main(int argc, char **argv) { #ifdef RUN_TESTS testing::InitGoogleTest(&argc, argv); - return RUN_ALL_TESTS(); + auto test_result = RUN_ALL_TESTS(); + for(auto i = 0; i < argc; ++i) + if(strcasecmp(argv[i], "--tests-only") == 0) + return test_result; #endif #ifdef __SWITCH__ switch_enable_network(); @@ -30,6 +33,5 @@ int main(int argc, char **argv) #ifdef __3DS__ ctr_sys_init(); #endif - return dvl::DiabloMain(argc, argv); }