diff --git a/tests/RHI/D3D12/integration/minimal/CMakeLists.txt b/tests/RHI/D3D12/integration/minimal/CMakeLists.txt index 42ac5738..8dc90278 100644 --- a/tests/RHI/D3D12/integration/minimal/CMakeLists.txt +++ b/tests/RHI/D3D12/integration/minimal/CMakeLists.txt @@ -29,12 +29,6 @@ target_link_libraries(D3D12_Minimal PRIVATE XCEngine ) -add_custom_command(TARGET D3D12_Minimal POST_BUILD - COMMAND ${CMAKE_COMMAND} -E copy_directory - ${CMAKE_CURRENT_SOURCE_DIR}/Res - $/Res -) - add_custom_command(TARGET D3D12_Minimal POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy_if_different ${CMAKE_SOURCE_DIR}/tests/RHI/D3D12/integration/compare_ppm.py diff --git a/tests/RHI/D3D12/unit/CMakeLists.txt b/tests/RHI/D3D12/unit/CMakeLists.txt index 782ac2e4..8ce26e1b 100644 --- a/tests/RHI/D3D12/unit/CMakeLists.txt +++ b/tests/RHI/D3D12/unit/CMakeLists.txt @@ -38,15 +38,7 @@ target_include_directories(d3d12_engine_tests PRIVATE ${PROJECT_ROOT_DIR}/engine/src ) -target_compile_definitions(d3d12_engine_tests PRIVATE - TEST_RESOURCES_DIR="${PROJECT_ROOT_DIR}/tests/RHI/D3D12/integration/minimal/Res" -) -add_custom_command(TARGET d3d12_engine_tests POST_BUILD - COMMAND ${CMAKE_COMMAND} -E copy_directory - ${PROJECT_ROOT_DIR}/tests/RHI/D3D12/integration/minimal/Res - $/Res -) enable_testing() add_test(NAME D3D12EngineTests COMMAND d3d12_engine_tests) diff --git a/scripts/run_tests.py b/tests/run_tests.py similarity index 90% rename from scripts/run_tests.py rename to tests/run_tests.py index cd30cac6..837719a1 100644 --- a/scripts/run_tests.py +++ b/tests/run_tests.py @@ -261,8 +261,9 @@ class TestRunner: } def run_integration_tests(self) -> bool: - integration_dir = ( - self.build_dir / "tests" / "RHI" / "D3D12" / "integration" / "Debug" + integration_dir = self.build_dir / "tests" / "RHI" / "D3D12" / "integration" + integration_src_dir = ( + self.source_dir / "tests" / "RHI" / "D3D12" / "integration" ) if not integration_dir.exists(): @@ -273,28 +274,42 @@ class TestRunner: self._log_header("Running Integration Tests") - minimal_exe = integration_dir / "D3D12_Minimal.exe" - gt_minimal = ( - self.source_dir / "tests" / "RHI" / "D3D12" / "integration" / "GT.ppm" - ) + integration_tests = [ + ("D3D12_Minimal_Integration", "minimal", "minimal.ppm"), + ("D3D12_Sphere_Integration", "sphere", "sphere.ppm"), + ("D3D12_Triangle_Integration", "triangle", "triangle.ppm"), + ("D3D12_Quad_Integration", "quad", "quad.ppm"), + ] - if minimal_exe.exists() and gt_minimal.exists(): - result = self._run_integration_test( - "D3D12_Minimal_Integration", minimal_exe, "minimal.ppm", gt_minimal, 5 + all_passed = True + for test_name, test_folder, output_ppm in integration_tests: + exe_path = ( + integration_dir + / test_folder + / "Debug" + / f"D3D12_{test_folder.title()}.exe" ) - self.results.append(result) + gt_ppm = integration_src_dir / test_folder / "GT.ppm" - if result["failed"] > 0: - self._log_error(f"Failed: {result['name']}") - if self.verbose: - self._log_info(result.get("output", "")) - return False + if exe_path.exists() and gt_ppm.exists(): + result = self._run_integration_test( + test_name, exe_path, output_ppm, gt_ppm, 0 + ) + self.results.append(result) + + if result["failed"] > 0: + self._log_error(f"Failed: {result['name']}") + if self.verbose: + self._log_info(result.get("output", "")) + all_passed = False + else: + self._log_success( + f"Passed: {result['name']} ({result['time']:.2f}s)" + ) else: - self._log_success(f"Passed: {result['name']} ({result['time']:.2f}s)") - return True - else: - self._log_warning("D3D12_Minimal.exe not found, skipping integration test") - return True + self._log_warning(f"{test_name} not found, skipping") + + return all_passed def _summarize_results(self): self._log_header("Test Summary")