diff --git a/unit_tests/.gitignore b/unit_tests/.gitignore index aee357234fa..60bd15a2c8c 100644 --- a/unit_tests/.gitignore +++ b/unit_tests/.gitignore @@ -2,4 +2,3 @@ build*/ gcov_working_area triggers -unittest*.logicdata diff --git a/unit_tests/output_logicdata/.gitignore b/unit_tests/output_logicdata/.gitignore new file mode 100644 index 00000000000..0e32eaea652 --- /dev/null +++ b/unit_tests/output_logicdata/.gitignore @@ -0,0 +1 @@ +unittest*.logicdata diff --git a/unit_tests/test-framework/engine_test_helper.cpp b/unit_tests/test-framework/engine_test_helper.cpp index 0bcb24fea70..c300291e8f9 100644 --- a/unit_tests/test-framework/engine_test_helper.cpp +++ b/unit_tests/test-framework/engine_test_helper.cpp @@ -15,6 +15,8 @@ #include "tooth_logger.h" #include "logicdata.h" #include "hardware.h" +#include +namespace fs = std::filesystem; #if EFI_ENGINE_SNIFFER #include "engine_sniffer.h" @@ -133,12 +135,15 @@ EngineTestHelper::EngineTestHelper(engine_type_e engineType, configuration_callb rememberCurrentConfiguration(); } +#define LOGICDATA_OUTPUT "output_logicdata" + EngineTestHelper::~EngineTestHelper() { // Write history to file extern bool hasInitGtest; if (hasInitGtest) { + fs::create_directories(LOGICDATA_OUTPUT); std::stringstream filePath; - filePath << "unittest_" << ::testing::UnitTest::GetInstance()->current_test_info()->name() << ".logicdata"; + filePath << LOGICDATA_OUTPUT << "/unittest_" << ::testing::UnitTest::GetInstance()->current_test_info()->name() << ".logicdata"; writeEvents(filePath.str().c_str()); }