refactor: move run_tests.py to tests/ and fix integration test GT.ppm paths
This commit is contained in:
@@ -29,12 +29,6 @@ target_link_libraries(D3D12_Minimal PRIVATE
|
|||||||
XCEngine
|
XCEngine
|
||||||
)
|
)
|
||||||
|
|
||||||
add_custom_command(TARGET D3D12_Minimal POST_BUILD
|
|
||||||
COMMAND ${CMAKE_COMMAND} -E copy_directory
|
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/Res
|
|
||||||
$<TARGET_FILE_DIR:D3D12_Minimal>/Res
|
|
||||||
)
|
|
||||||
|
|
||||||
add_custom_command(TARGET D3D12_Minimal POST_BUILD
|
add_custom_command(TARGET D3D12_Minimal POST_BUILD
|
||||||
COMMAND ${CMAKE_COMMAND} -E copy_if_different
|
COMMAND ${CMAKE_COMMAND} -E copy_if_different
|
||||||
${CMAKE_SOURCE_DIR}/tests/RHI/D3D12/integration/compare_ppm.py
|
${CMAKE_SOURCE_DIR}/tests/RHI/D3D12/integration/compare_ppm.py
|
||||||
|
|||||||
@@ -38,15 +38,7 @@ target_include_directories(d3d12_engine_tests PRIVATE
|
|||||||
${PROJECT_ROOT_DIR}/engine/src
|
${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
|
|
||||||
$<TARGET_FILE_DIR:d3d12_engine_tests>/Res
|
|
||||||
)
|
|
||||||
|
|
||||||
enable_testing()
|
enable_testing()
|
||||||
add_test(NAME D3D12EngineTests COMMAND d3d12_engine_tests)
|
add_test(NAME D3D12EngineTests COMMAND d3d12_engine_tests)
|
||||||
|
|||||||
@@ -261,8 +261,9 @@ class TestRunner:
|
|||||||
}
|
}
|
||||||
|
|
||||||
def run_integration_tests(self) -> bool:
|
def run_integration_tests(self) -> bool:
|
||||||
integration_dir = (
|
integration_dir = self.build_dir / "tests" / "RHI" / "D3D12" / "integration"
|
||||||
self.build_dir / "tests" / "RHI" / "D3D12" / "integration" / "Debug"
|
integration_src_dir = (
|
||||||
|
self.source_dir / "tests" / "RHI" / "D3D12" / "integration"
|
||||||
)
|
)
|
||||||
|
|
||||||
if not integration_dir.exists():
|
if not integration_dir.exists():
|
||||||
@@ -273,28 +274,42 @@ class TestRunner:
|
|||||||
|
|
||||||
self._log_header("Running Integration Tests")
|
self._log_header("Running Integration Tests")
|
||||||
|
|
||||||
minimal_exe = integration_dir / "D3D12_Minimal.exe"
|
integration_tests = [
|
||||||
gt_minimal = (
|
("D3D12_Minimal_Integration", "minimal", "minimal.ppm"),
|
||||||
self.source_dir / "tests" / "RHI" / "D3D12" / "integration" / "GT.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():
|
all_passed = True
|
||||||
result = self._run_integration_test(
|
for test_name, test_folder, output_ppm in integration_tests:
|
||||||
"D3D12_Minimal_Integration", minimal_exe, "minimal.ppm", gt_minimal, 5
|
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:
|
if exe_path.exists() and gt_ppm.exists():
|
||||||
self._log_error(f"Failed: {result['name']}")
|
result = self._run_integration_test(
|
||||||
if self.verbose:
|
test_name, exe_path, output_ppm, gt_ppm, 0
|
||||||
self._log_info(result.get("output", ""))
|
)
|
||||||
return False
|
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:
|
else:
|
||||||
self._log_success(f"Passed: {result['name']} ({result['time']:.2f}s)")
|
self._log_warning(f"{test_name} not found, skipping")
|
||||||
return True
|
|
||||||
else:
|
return all_passed
|
||||||
self._log_warning("D3D12_Minimal.exe not found, skipping integration test")
|
|
||||||
return True
|
|
||||||
|
|
||||||
def _summarize_results(self):
|
def _summarize_results(self):
|
||||||
self._log_header("Test Summary")
|
self._log_header("Test Summary")
|
||||||
Reference in New Issue
Block a user