test: harden rendering integration test shutdown
This commit is contained in:
25
tests/Rendering/integration/RenderingIntegrationMain.h
Normal file
25
tests/Rendering/integration/RenderingIntegrationMain.h
Normal file
@@ -0,0 +1,25 @@
|
||||
#pragma once
|
||||
|
||||
#include <gtest/gtest.h>
|
||||
|
||||
#include <XCEngine/Debug/ConsoleLogSink.h>
|
||||
#include <XCEngine/Debug/Logger.h>
|
||||
|
||||
#include <cstdio>
|
||||
#include <cstdlib>
|
||||
#include <memory>
|
||||
|
||||
inline int RunRenderingIntegrationTestMain(int argc, char** argv) {
|
||||
using namespace XCEngine::Debug;
|
||||
|
||||
Logger::Get().Initialize();
|
||||
Logger::Get().AddSink(std::make_unique<ConsoleLogSink>());
|
||||
Logger::Get().SetMinimumLevel(LogLevel::Debug);
|
||||
|
||||
testing::InitGoogleTest(&argc, argv);
|
||||
const int result = RUN_ALL_TESTS();
|
||||
|
||||
Logger::Get().Shutdown();
|
||||
std::fflush(nullptr);
|
||||
std::_Exit((result == 0 && !testing::UnitTest::GetInstance()->Failed()) ? 0 : 1);
|
||||
}
|
||||
@@ -3,6 +3,8 @@
|
||||
|
||||
#include <gtest/gtest.h>
|
||||
|
||||
#include "../RenderingIntegrationMain.h"
|
||||
|
||||
#include <XCEngine/Components/CameraComponent.h>
|
||||
#include <XCEngine/Components/GameObject.h>
|
||||
#include <XCEngine/Components/LightComponent.h>
|
||||
@@ -322,10 +324,5 @@ INSTANTIATE_TEST_SUITE_P(Vulkan, BackpackLitSceneTest, ::testing::Values(RHIType
|
||||
#endif
|
||||
|
||||
GTEST_API_ int main(int argc, char** argv) {
|
||||
Logger::Get().Initialize();
|
||||
Logger::Get().AddSink(std::make_unique<ConsoleLogSink>());
|
||||
Logger::Get().SetMinimumLevel(LogLevel::Debug);
|
||||
|
||||
testing::InitGoogleTest(&argc, argv);
|
||||
return RUN_ALL_TESTS();
|
||||
return RunRenderingIntegrationTestMain(argc, argv);
|
||||
}
|
||||
|
||||
@@ -3,6 +3,8 @@
|
||||
|
||||
#include <gtest/gtest.h>
|
||||
|
||||
#include "../RenderingIntegrationMain.h"
|
||||
|
||||
#include <XCEngine/Components/CameraComponent.h>
|
||||
#include <XCEngine/Components/GameObject.h>
|
||||
#include <XCEngine/Components/MeshFilterComponent.h>
|
||||
@@ -316,10 +318,5 @@ INSTANTIATE_TEST_SUITE_P(Vulkan, BackpackSceneTest, ::testing::Values(RHIType::V
|
||||
#endif
|
||||
|
||||
GTEST_API_ int main(int argc, char** argv) {
|
||||
Logger::Get().Initialize();
|
||||
Logger::Get().AddSink(std::make_unique<ConsoleLogSink>());
|
||||
Logger::Get().SetMinimumLevel(LogLevel::Debug);
|
||||
|
||||
testing::InitGoogleTest(&argc, argv);
|
||||
return RUN_ALL_TESTS();
|
||||
return RunRenderingIntegrationTestMain(argc, argv);
|
||||
}
|
||||
|
||||
@@ -3,6 +3,8 @@
|
||||
|
||||
#include <gtest/gtest.h>
|
||||
|
||||
#include "../RenderingIntegrationMain.h"
|
||||
|
||||
#include <XCEngine/Components/CameraComponent.h>
|
||||
#include <XCEngine/Components/GameObject.h>
|
||||
#include <XCEngine/Components/MeshFilterComponent.h>
|
||||
@@ -440,10 +442,5 @@ INSTANTIATE_TEST_SUITE_P(Vulkan, CameraStackSceneTest, ::testing::Values(RHIType
|
||||
#endif
|
||||
|
||||
GTEST_API_ int main(int argc, char** argv) {
|
||||
Logger::Get().Initialize();
|
||||
Logger::Get().AddSink(std::make_unique<ConsoleLogSink>());
|
||||
Logger::Get().SetMinimumLevel(LogLevel::Debug);
|
||||
|
||||
testing::InitGoogleTest(&argc, argv);
|
||||
return RUN_ALL_TESTS();
|
||||
return RunRenderingIntegrationTestMain(argc, argv);
|
||||
}
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
#include <gtest/gtest.h>
|
||||
|
||||
#include "../RenderingIntegrationMain.h"
|
||||
|
||||
#include <XCEngine/Components/CameraComponent.h>
|
||||
#include <XCEngine/Components/GameObject.h>
|
||||
#include <XCEngine/Components/MeshFilterComponent.h>
|
||||
@@ -446,10 +448,5 @@ INSTANTIATE_TEST_SUITE_P(Vulkan, CullMaterialSceneTest, ::testing::Values(RHITyp
|
||||
#endif
|
||||
|
||||
GTEST_API_ int main(int argc, char** argv) {
|
||||
Logger::Get().Initialize();
|
||||
Logger::Get().AddSink(std::make_unique<ConsoleLogSink>());
|
||||
Logger::Get().SetMinimumLevel(LogLevel::Debug);
|
||||
|
||||
testing::InitGoogleTest(&argc, argv);
|
||||
return RUN_ALL_TESTS();
|
||||
return RunRenderingIntegrationTestMain(argc, argv);
|
||||
}
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
#include <gtest/gtest.h>
|
||||
|
||||
#include "../RenderingIntegrationMain.h"
|
||||
|
||||
#include <XCEngine/Components/CameraComponent.h>
|
||||
#include <XCEngine/Components/GameObject.h>
|
||||
#include <XCEngine/Components/MeshFilterComponent.h>
|
||||
@@ -453,10 +455,5 @@ INSTANTIATE_TEST_SUITE_P(Vulkan, DepthSortSceneTest, ::testing::Values(RHIType::
|
||||
#endif
|
||||
|
||||
GTEST_API_ int main(int argc, char** argv) {
|
||||
Logger::Get().Initialize();
|
||||
Logger::Get().AddSink(std::make_unique<ConsoleLogSink>());
|
||||
Logger::Get().SetMinimumLevel(LogLevel::Debug);
|
||||
|
||||
testing::InitGoogleTest(&argc, argv);
|
||||
return RUN_ALL_TESTS();
|
||||
return RunRenderingIntegrationTestMain(argc, argv);
|
||||
}
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
#include <gtest/gtest.h>
|
||||
|
||||
#include "../RenderingIntegrationMain.h"
|
||||
|
||||
#include <XCEngine/Components/CameraComponent.h>
|
||||
#include <XCEngine/Components/GameObject.h>
|
||||
#include <XCEngine/Components/MeshFilterComponent.h>
|
||||
@@ -546,10 +548,5 @@ INSTANTIATE_TEST_SUITE_P(Vulkan, MaterialStateSceneTest, ::testing::Values(RHITy
|
||||
#endif
|
||||
|
||||
GTEST_API_ int main(int argc, char** argv) {
|
||||
Logger::Get().Initialize();
|
||||
Logger::Get().AddSink(std::make_unique<ConsoleLogSink>());
|
||||
Logger::Get().SetMinimumLevel(LogLevel::Debug);
|
||||
|
||||
testing::InitGoogleTest(&argc, argv);
|
||||
return RUN_ALL_TESTS();
|
||||
return RunRenderingIntegrationTestMain(argc, argv);
|
||||
}
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
#include <gtest/gtest.h>
|
||||
|
||||
#include "../RenderingIntegrationMain.h"
|
||||
|
||||
#include <XCEngine/Components/CameraComponent.h>
|
||||
#include <XCEngine/Components/GameObject.h>
|
||||
#include <XCEngine/Components/MeshFilterComponent.h>
|
||||
@@ -501,10 +503,5 @@ INSTANTIATE_TEST_SUITE_P(Vulkan, OffscreenSceneTest, ::testing::Values(RHIType::
|
||||
#endif
|
||||
|
||||
GTEST_API_ int main(int argc, char** argv) {
|
||||
Logger::Get().Initialize();
|
||||
Logger::Get().AddSink(std::make_unique<ConsoleLogSink>());
|
||||
Logger::Get().SetMinimumLevel(LogLevel::Debug);
|
||||
|
||||
testing::InitGoogleTest(&argc, argv);
|
||||
return RUN_ALL_TESTS();
|
||||
return RunRenderingIntegrationTestMain(argc, argv);
|
||||
}
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
#include <gtest/gtest.h>
|
||||
|
||||
#include "../RenderingIntegrationMain.h"
|
||||
|
||||
#include <XCEngine/Components/CameraComponent.h>
|
||||
#include <XCEngine/Components/GameObject.h>
|
||||
#include <XCEngine/Components/MeshFilterComponent.h>
|
||||
@@ -315,13 +317,5 @@ INSTANTIATE_TEST_SUITE_P(Vulkan, TexturedQuadSceneTest, ::testing::Values(RHITyp
|
||||
#endif
|
||||
|
||||
GTEST_API_ int main(int argc, char** argv) {
|
||||
Logger::Get().Initialize();
|
||||
Logger::Get().AddSink(std::make_unique<ConsoleLogSink>());
|
||||
Logger::Get().SetMinimumLevel(LogLevel::Debug);
|
||||
|
||||
testing::InitGoogleTest(&argc, argv);
|
||||
const int result = RUN_ALL_TESTS();
|
||||
Logger::Get().Shutdown();
|
||||
std::fflush(nullptr);
|
||||
std::_Exit((result == 0 && !testing::UnitTest::GetInstance()->Failed()) ? 0 : 1);
|
||||
return RunRenderingIntegrationTestMain(argc, argv);
|
||||
}
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
#include <gtest/gtest.h>
|
||||
|
||||
#include "../RenderingIntegrationMain.h"
|
||||
|
||||
#include <XCEngine/Components/CameraComponent.h>
|
||||
#include <XCEngine/Components/GameObject.h>
|
||||
#include <XCEngine/Components/MeshFilterComponent.h>
|
||||
@@ -398,10 +400,5 @@ INSTANTIATE_TEST_SUITE_P(Vulkan, TransparentMaterialSceneTest, ::testing::Values
|
||||
#endif
|
||||
|
||||
GTEST_API_ int main(int argc, char** argv) {
|
||||
Logger::Get().Initialize();
|
||||
Logger::Get().AddSink(std::make_unique<ConsoleLogSink>());
|
||||
Logger::Get().SetMinimumLevel(LogLevel::Debug);
|
||||
|
||||
testing::InitGoogleTest(&argc, argv);
|
||||
return RUN_ALL_TESTS();
|
||||
return RunRenderingIntegrationTestMain(argc, argv);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user