Use gtest recommandation and provide global environment through main
Some checks failed
Bigfoot / Build & Test Debug with ./ConanProfiles/clang (Unity Build: OFF) (push) Successful in 6m14s
Bigfoot / Build & Test Debug with ./ConanProfiles/clang_asan (Unity Build: OFF) (push) Has been cancelled
Bigfoot / Build & Test Debug with ./ConanProfiles/clang_asan (Unity Build: ON) (push) Has been cancelled
Bigfoot / Build & Test RelWithDebInfo with ./ConanProfiles/clang (Unity Build: OFF) (push) Has been cancelled
Bigfoot / Build & Test RelWithDebInfo with ./ConanProfiles/clang (Unity Build: ON) (push) Has been cancelled
Bigfoot / Build & Test RelWithDebInfo with ./ConanProfiles/clang_asan (Unity Build: OFF) (push) Has been cancelled
Bigfoot / Build & Test RelWithDebInfo with ./ConanProfiles/clang_asan (Unity Build: ON) (push) Has been cancelled
Bigfoot / Build & Test Release with ./ConanProfiles/clang (Unity Build: OFF) (push) Has been cancelled
Bigfoot / Build & Test Release with ./ConanProfiles/clang (Unity Build: ON) (push) Has been cancelled
Bigfoot / Build & Test Release with ./ConanProfiles/clang_asan (Unity Build: OFF) (push) Has been cancelled
Bigfoot / Build & Test Release with ./ConanProfiles/clang_asan (Unity Build: ON) (push) Has been cancelled
Bigfoot / Clang Format Checks (push) Has been cancelled
Bigfoot / Build & Test Debug with ./ConanProfiles/clang (Unity Build: ON) (push) Has been cancelled

This commit is contained in:
2026-05-17 12:47:34 +02:00
parent 8996adec61
commit 3fe5c31fc0
6 changed files with 57 additions and 96 deletions

View File

@@ -1,32 +0,0 @@
/*********************************************************************
* \file Environment.cpp
*
* \author Romain BOULLARD
* \date May 2026
*********************************************************************/
#include <Utils/Log/LogMacros.hpp>
#include <Utils/TargetMacros.h>
#include <gtest/gtest.h>
namespace Bigfoot
{
class TestingEnvironment: public ::testing::Environment
{
public:
void SetUp() override
{
BIGFOOT_NOT_OPTIMIZED_ONLY(m_lifetime.emplace());
}
void TearDown() override
{
BIGFOOT_NOT_OPTIMIZED_ONLY(m_lifetime.reset());
}
BIGFOOT_NOT_OPTIMIZED_ONLY(eastl::optional<Singleton<Log>::Lifetime> m_lifetime);
};
} // namespace Bigfoot
// This runs before main() and registers the environment
const ::testing::Environment* const kEnv = ::testing::AddGlobalTestEnvironment(new Bigfoot::TestingEnvironment());

View File

@@ -0,0 +1,19 @@
/*********************************************************************
* \file main.cpp
*
* \author Romain BOULLARD
* \date May 2026
*********************************************************************/
#include <Utils/Log/LogMacros.hpp>
#include <Utils/TargetMacros.h>
#include <gtest/gtest.h>
int main(int argc, char** argv)
{
testing::InitGoogleTest(&argc, argv);
BIGFOOT_NOT_OPTIMIZED_ONLY(::Bigfoot::Singleton<::Bigfoot::Log>::Lifetime m_lifetime);
return RUN_ALL_TESTS();
}

View File

@@ -1,32 +0,0 @@
/*********************************************************************
* \file Environment.cpp
*
* \author Romain BOULLARD
* \date May 2026
*********************************************************************/
#include <Utils/Log/LogMacros.hpp>
#include <Utils/TargetMacros.h>
#include <gtest/gtest.h>
namespace Bigfoot
{
class TestingEnvironment: public ::testing::Environment
{
public:
void SetUp() override
{
BIGFOOT_NOT_OPTIMIZED_ONLY(m_lifetime.emplace());
}
void TearDown() override
{
BIGFOOT_NOT_OPTIMIZED_ONLY(m_lifetime.reset());
}
BIGFOOT_NOT_OPTIMIZED_ONLY(eastl::optional<Singleton<Log>::Lifetime> m_lifetime);
};
} // namespace Bigfoot
// This runs before main() and registers the environment
const ::testing::Environment* const kEnv = ::testing::AddGlobalTestEnvironment(new Bigfoot::TestingEnvironment());

View File

@@ -0,0 +1,19 @@
/*********************************************************************
* \file main.cpp
*
* \author Romain BOULLARD
* \date May 2026
*********************************************************************/
#include <Utils/Log/LogMacros.hpp>
#include <Utils/TargetMacros.h>
#include <gtest/gtest.h>
int main(int argc, char** argv)
{
testing::InitGoogleTest(&argc, argv);
BIGFOOT_NOT_OPTIMIZED_ONLY(::Bigfoot::Singleton<::Bigfoot::Log>::Lifetime m_lifetime);
return RUN_ALL_TESTS();
}

View File

@@ -1,32 +0,0 @@
/*********************************************************************
* \file Environment.cpp
*
* \author Romain BOULLARD
* \date May 2026
*********************************************************************/
#include <Utils/Log/LogMacros.hpp>
#include <Utils/TargetMacros.h>
#include <gtest/gtest.h>
namespace Bigfoot
{
class TestingEnvironment: public ::testing::Environment
{
public:
void SetUp() override
{
BIGFOOT_NOT_OPTIMIZED_ONLY(m_lifetime.emplace());
}
void TearDown() override
{
BIGFOOT_NOT_OPTIMIZED_ONLY(m_lifetime.reset());
}
BIGFOOT_NOT_OPTIMIZED_ONLY(eastl::optional<Singleton<Log>::Lifetime> m_lifetime);
};
} // namespace Bigfoot
// This runs before main() and registers the environment
const ::testing::Environment* const kEnv = ::testing::AddGlobalTestEnvironment(new Bigfoot::TestingEnvironment());

View File

@@ -0,0 +1,19 @@
/*********************************************************************
* \file main.cpp
*
* \author Romain BOULLARD
* \date May 2026
*********************************************************************/
#include <Utils/Log/LogMacros.hpp>
#include <Utils/TargetMacros.h>
#include <gtest/gtest.h>
int main(int argc, char** argv)
{
testing::InitGoogleTest(&argc, argv);
BIGFOOT_NOT_OPTIMIZED_ONLY(::Bigfoot::Singleton<::Bigfoot::Log>::Lifetime m_lifetime);
return RUN_ALL_TESTS();
}