Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Autodesk: Remove explicit diff usages in testHdSt #3409

Open
wants to merge 2 commits into
base: feature-hgi-vulkan
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 13 additions & 5 deletions cmake/macros/testWrapper.py
Original file line number Diff line number Diff line change
Expand Up @@ -157,11 +157,19 @@ def _diff(fileName, baselineDir, verbose, failuresDir=None):
# Use the diff program or equivalent, rather than filecmp or similar
# because it's possible we might want to specify other diff programs
# in the future.

import platform
if platform.system() == 'Windows':
diff = 'fc.exe'
else:
diff = '/usr/bin/diff'
isWindows = platform.system() == 'Windows'

diffTool = shutil.which('diff')
if not diffTool and isWindows:
diffTool = shutil.which('fc.exe')

if not diffTool:
sys.stderr.write(
"Error: could not find \"diff\" or \"fc.exe\" tool. "
"Make sure it's in your PATH.\n")
return False

filesToDiff = glob.glob(fileName)
if not filesToDiff:
Expand All @@ -171,7 +179,7 @@ def _diff(fileName, baselineDir, verbose, failuresDir=None):

for fileToDiff in filesToDiff:
baselineFile = _resolvePath(baselineDir, fileToDiff)
cmd = [diff, baselineFile, fileToDiff]
cmd = [diffTool, baselineFile, fileToDiff]
if verbose:
print("diffing with {0}".format(cmd))

Expand Down
84 changes: 42 additions & 42 deletions pxr/imaging/hdSt/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2325,7 +2325,7 @@ pxr_register_test(testHdStBufferArray
COMMAND "${CMAKE_INSTALL_PREFIX}/tests/testHdStBufferArray"
EXPECTED_RETURN_CODE 0
STDOUT_REDIRECT testHdStBufferArray-Run1-stdout.txt
POST_COMMAND "diff -I drawingShader -I computeShader -I gpuMemoryUsed -I meshTopology -I basisCurvesTopology -I uboSize -I ssboSize testHdStBufferArray-Run1-stdout.txt ${CMAKE_INSTALL_PREFIX}/tests/ctest/testHdStBufferArray/baseline/testHdStBufferArray-Run1-stdout.txt" TESTENV testHdStBufferArray
DIFF_COMPARE testHdStBufferArray-Run1-stdout.txt
TESTENV testHdStBufferArray
ENV
TF_DEBUG=HD_SAFE_MODE
Expand All @@ -2336,7 +2336,7 @@ pxr_register_test(testHdStBufferArrayInstancingDisabled
COMMAND "${CMAKE_INSTALL_PREFIX}/tests/testHdStBufferArray"
EXPECTED_RETURN_CODE 0
STDOUT_REDIRECT testHdStBufferArrayInstancingDisabled-Run1-stdout.txt
POST_COMMAND "diff -I drawingShader -I computeShader -I gpuMemoryUsed -I meshTopology -I basisCurvesTopology -I uboSize -I ssboSize testHdStBufferArrayInstancingDisabled-Run1-stdout.txt ${CMAKE_INSTALL_PREFIX}/tests/ctest/testHdStBufferArrayInstancingDisabled/baseline/testHdStBufferArrayInstancingDisabled-Run1-stdout.txt"
DIFF_COMPARE testHdStBufferArrayInstancingDisabled-Run1-stdout.txt
TESTENV testHdStBufferArrayInstancingDisabled
ENV
HDST_ENABLE_RESOURCE_INSTANCING=0
Expand Down Expand Up @@ -2378,90 +2378,90 @@ pxr_register_test(testHdStClipPlanes2

function(register_codegen_tests suffix hgi_env)
pxr_register_test(testHdStCodeGen${suffix}_Mesh_Indirect
COMMAND "${CMAKE_INSTALL_PREFIX}/tests/testHdStCodeGen --mesh | grep -v '// line'"
COMMAND "${CMAKE_INSTALL_PREFIX}/tests/testHdStCodeGen --mesh"
EXPECTED_RETURN_CODE 0
STDOUT_REDIRECT codegen_mesh_indirect.out
POST_COMMAND "diff -I '\".*\.glslfx\"' codegen_mesh_indirect.out ${CMAKE_INSTALL_PREFIX}/tests/ctest/testHdStCodeGen${suffix}/baseline/codegen_mesh_indirect.out"
DIFF_COMPARE codegen_mesh_indirect.out
TESTENV testHdStCodeGen${suffix}
ENV
TF_DEBUG=HD_SAFE_MODE
${hgi_env}
)
pxr_register_test(testHdStCodeGen${suffix}_Mesh_Indirect_SmoothNormals
COMMAND "${CMAKE_INSTALL_PREFIX}/tests/testHdStCodeGen --mesh --smoothNormals | grep -v '// line'"
COMMAND "${CMAKE_INSTALL_PREFIX}/tests/testHdStCodeGen --mesh --smoothNormals"
EXPECTED_RETURN_CODE 0
STDOUT_REDIRECT codegen_mesh_indirect_smoothNormals.out
POST_COMMAND "diff -I '\".*\.glslfx\"' codegen_mesh_indirect_smoothNormals.out ${CMAKE_INSTALL_PREFIX}/tests/ctest/testHdStCodeGen${suffix}/baseline/codegen_mesh_indirect_smoothNormals.out"
DIFF_COMPARE codegen_mesh_indirect_smoothNormals.out
TESTENV testHdStCodeGen${suffix}
ENV
TF_DEBUG=HD_SAFE_MODE
${hgi_env}
)
pxr_register_test(testHdStCodeGen${suffix}_Mesh_Indirect_DoubleSided
COMMAND "${CMAKE_INSTALL_PREFIX}/tests/testHdStCodeGen --mesh --doubleSided | grep -v '// line'"
COMMAND "${CMAKE_INSTALL_PREFIX}/tests/testHdStCodeGen --mesh --doubleSided"
EXPECTED_RETURN_CODE 0
STDOUT_REDIRECT codegen_mesh_indirect_doubleSided.out
POST_COMMAND "diff -I '\".*\.glslfx\"' codegen_mesh_indirect_doubleSided.out ${CMAKE_INSTALL_PREFIX}/tests/ctest/testHdStCodeGen${suffix}/baseline/codegen_mesh_indirect_doubleSided.out"
DIFF_COMPARE codegen_mesh_indirect_doubleSided.out
TESTENV testHdStCodeGen${suffix}
ENV
TF_DEBUG=HD_SAFE_MODE
${hgi_env}
)
pxr_register_test(testHdStCodeGen${suffix}_Mesh_Indirect_FaceVarying
COMMAND "${CMAKE_INSTALL_PREFIX}/tests/testHdStCodeGen --mesh --faceVarying | grep -v '// line'"
COMMAND "${CMAKE_INSTALL_PREFIX}/tests/testHdStCodeGen --mesh --faceVarying"
EXPECTED_RETURN_CODE 0
STDOUT_REDIRECT codegen_mesh_indirect_faceVarying.out
POST_COMMAND "diff -I '\".*\.glslfx\"' codegen_mesh_indirect_faceVarying.out ${CMAKE_INSTALL_PREFIX}/tests/ctest/testHdStCodeGen${suffix}/baseline/codegen_mesh_indirect_faceVarying.out"
DIFF_COMPARE codegen_mesh_indirect_faceVarying.out
TESTENV testHdStCodeGen${suffix}
ENV
TF_DEBUG=HD_SAFE_MODE
${hgi_env}
)
pxr_register_test(testHdStCodeGen${suffix}_Mesh_Indirect_Instance
COMMAND "${CMAKE_INSTALL_PREFIX}/tests/testHdStCodeGen --mesh --instance | grep -v '// line'"
COMMAND "${CMAKE_INSTALL_PREFIX}/tests/testHdStCodeGen --mesh --instance"
EXPECTED_RETURN_CODE 0
STDOUT_REDIRECT codegen_mesh_indirect_instance.out
POST_COMMAND "diff -I '\".*\.glslfx\"' codegen_mesh_indirect_instance.out ${CMAKE_INSTALL_PREFIX}/tests/ctest/testHdStCodeGen${suffix}/baseline/codegen_mesh_indirect_instance.out"
DIFF_COMPARE codegen_mesh_indirect_instance.out
TESTENV testHdStCodeGen${suffix}
ENV
TF_DEBUG=HD_SAFE_MODE
${hgi_env}
)
pxr_register_test(testHdStCodeGen${suffix}_Mesh_EdgeOnly
COMMAND "${CMAKE_INSTALL_PREFIX}/tests/testHdStCodeGen --mesh --edgeOnly | grep -v '// line'"
COMMAND "${CMAKE_INSTALL_PREFIX}/tests/testHdStCodeGen --mesh --edgeOnly"
EXPECTED_RETURN_CODE 0
STDOUT_REDIRECT codegen_mesh_edgeonly.out
POST_COMMAND "diff -I '\".*\.glslfx\"' codegen_mesh_edgeonly.out ${CMAKE_INSTALL_PREFIX}/tests/ctest/testHdStCodeGen${suffix}/baseline/codegen_mesh_edgeonly.out"
DIFF_COMPARE codegen_mesh_edgeonly.out
TESTENV testHdStCodeGen${suffix}
ENV
TF_DEBUG=HD_SAFE_MODE
${hgi_env}
)
pxr_register_test(testHdStCodeGen${suffix}_Mesh_EdgeOnly_BlendWireframe
COMMAND "${CMAKE_INSTALL_PREFIX}/tests/testHdStCodeGen --mesh --edgeOnly --blendWireframe | grep -v '// line'"
COMMAND "${CMAKE_INSTALL_PREFIX}/tests/testHdStCodeGen --mesh --edgeOnly --blendWireframe"
EXPECTED_RETURN_CODE 0
STDOUT_REDIRECT codegen_mesh_edgeonly_blendwireframe.out
POST_COMMAND "diff -I '\".*\.glslfx\"' codegen_mesh_edgeonly_blendwireframe.out ${CMAKE_INSTALL_PREFIX}/tests/ctest/testHdStCodeGen${suffix}/baseline/codegen_mesh_edgeonly_blendwireframe.out"
DIFF_COMPARE codegen_mesh_edgeonly_blendwireframe.out
TESTENV testHdStCodeGen${suffix}
ENV
TF_DEBUG=HD_SAFE_MODE
${hgi_env}
)
pxr_register_test(testHdStCodeGen${suffix}_Curves_Indirect
COMMAND "${CMAKE_INSTALL_PREFIX}/tests/testHdStCodeGen --curves | grep -v '// line'"
COMMAND "${CMAKE_INSTALL_PREFIX}/tests/testHdStCodeGen --curves"
EXPECTED_RETURN_CODE 0
STDOUT_REDIRECT codegen_curves_indirect.out
POST_COMMAND "diff -I '\".*\.glslfx\"' codegen_curves_indirect.out ${CMAKE_INSTALL_PREFIX}/tests/ctest/testHdStCodeGen${suffix}/baseline/codegen_curves_indirect.out"
DIFF_COMPARE codegen_curves_indirect.out
TESTENV testHdStCodeGen${suffix}
ENV
TF_DEBUG=HD_SAFE_MODE
${hgi_env}
)
pxr_register_test(testHdStCodeGen${suffix}_Points_Indirect
COMMAND "${CMAKE_INSTALL_PREFIX}/tests/testHdStCodeGen --points | grep -v '// line'"
COMMAND "${CMAKE_INSTALL_PREFIX}/tests/testHdStCodeGen --points"
EXPECTED_RETURN_CODE 0
STDOUT_REDIRECT codegen_points_indirect.out
POST_COMMAND "diff -I '\".*\.glslfx\"' codegen_points_indirect.out ${CMAKE_INSTALL_PREFIX}/tests/ctest/testHdStCodeGen${suffix}/baseline/codegen_points_indirect.out"
DIFF_COMPARE codegen_points_indirect.out
TESTENV testHdStCodeGen${suffix}
ENV
TF_DEBUG=HD_SAFE_MODE
Expand Down Expand Up @@ -2571,7 +2571,7 @@ pxr_register_test(testHdStDrawBatching
COMMAND "${CMAKE_INSTALL_PREFIX}/tests/testHdStDrawBatching"
EXPECTED_RETURN_CODE 0
STDOUT_REDIRECT testHdStDrawBatching-Run1-stdout.txt
POST_COMMAND "diff -I computeShader -I drawingShader -I gpuMemoryUsed testHdStDrawBatching-Run1-stdout.txt ${CMAKE_INSTALL_PREFIX}/tests/ctest/testHdStDrawBatching/baseline/testHdStDrawBatching-Run1-stdout.txt"
DIFF_COMPARE testHdStDrawBatching-Run1-stdout.txt
TESTENV testHdStDrawBatching
ENV
TF_DEBUG=HD_SAFE_MODE
Expand Down Expand Up @@ -2736,7 +2736,7 @@ pxr_register_test(testHdStHWFaceCulling
COMMAND "${CMAKE_INSTALL_PREFIX}/tests/testHdStHWFaceCulling"
EXPECTED_RETURN_CODE 0
STDOUT_REDIRECT testHdStHWFaceCulling-Run1-stdout.txt
POST_COMMAND "diff -I computeShader -I drawingShader -I gpuMemoryUsed -I uboSize -I ssboSize testHdStHWFaceCulling-Run1-stdout.txt ${CMAKE_INSTALL_PREFIX}/tests/ctest/testHdStHWFaceCulling/baseline/testHdStHWFaceCulling-Run1-stdout.txt"
DIFF_COMPARE testHdStHWFaceCulling-Run1-stdout.txt
TESTENV testHdStHWFaceCulling
)
pxr_register_test(testHdStIndirectDrawBatchCodeGen
Expand Down Expand Up @@ -2880,65 +2880,65 @@ pxr_register_test(testHdStInstancingUnbalancedNoBindless
if (${PXR_ENABLE_MATERIALX_SUPPORT})
pxr_register_test(testHdStMaterialXShaderGen_SSdefault
COMMAND "${CMAKE_INSTALL_PREFIX}/tests/testHdStMaterialXShaderGen --filename standard_surface_default.mtlx"
STDOUT_REDIRECT shadergen_SSdefault.out
EXPECTED_RETURN_CODE 0
POST_COMMAND "diff -B -b shadergen_SSdefault.out ${CMAKE_INSTALL_PREFIX}/tests/ctest/testHdStMaterialXShaderGen/baseline/shadergen_SSdefault.out"
STDOUT_REDIRECT shadergen_SSdefault.out
DIFF_COMPARE shadergen_SSdefault.out
TESTENV testHdStMaterialXShaderGen
)
pxr_register_test(testHdStMaterialXShaderGen_UsdPSdefault
COMMAND "${CMAKE_INSTALL_PREFIX}/tests/testHdStMaterialXShaderGen --filename usd_preview_surface_default.mtlx"
STDOUT_REDIRECT shadergen_UsdPSdefault.out
EXPECTED_RETURN_CODE 0
POST_COMMAND "diff -B -b shadergen_UsdPSdefault.out ${CMAKE_INSTALL_PREFIX}/tests/ctest/testHdStMaterialXShaderGen/baseline/shadergen_UsdPSdefault.out"
STDOUT_REDIRECT shadergen_UsdPSdefault.out
DIFF_COMPARE shadergen_UsdPSdefault.out
TESTENV testHdStMaterialXShaderGen
)
pxr_register_test(testHdStMaterialXShaderGen_SSmarble
COMMAND "${CMAKE_INSTALL_PREFIX}/tests/testHdStMaterialXShaderGen --filename standard_surface_marble_solid.mtlx"
STDOUT_REDIRECT shadergen_SSmarble.out
EXPECTED_RETURN_CODE 0
POST_COMMAND "diff -B -b shadergen_SSmarble.out ${CMAKE_INSTALL_PREFIX}/tests/ctest/testHdStMaterialXShaderGen/baseline/shadergen_SSmarble.out"
STDOUT_REDIRECT shadergen_SSmarble.out
DIFF_COMPARE shadergen_SSmarble.out
TESTENV testHdStMaterialXShaderGen
)
pxr_register_test(testHdStMaterialXShaderGen_SScopper
COMMAND "${CMAKE_INSTALL_PREFIX}/tests/testHdStMaterialXShaderGen --filename standard_surface_copper.mtlx"
STDOUT_REDIRECT shadergen_SScopper.out
EXPECTED_RETURN_CODE 0
POST_COMMAND "diff -B -b shadergen_SScopper.out ${CMAKE_INSTALL_PREFIX}/tests/ctest/testHdStMaterialXShaderGen/baseline/shadergen_SScopper.out"
STDOUT_REDIRECT shadergen_SScopper.out
DIFF_COMPARE shadergen_SScopper.out
TESTENV testHdStMaterialXShaderGen
)
pxr_register_test(testHdStMaterialXShaderGen_UsdPStextured
COMMAND "${CMAKE_INSTALL_PREFIX}/tests/testHdStMaterialXShaderGen --filename usd_preview_surface_brass_tiled.mtlx --textureMap image_color_file:diffuseColor --textureMap image_roughness_file:roughness"
STDOUT_REDIRECT shadergen_UsdPStextured.out
EXPECTED_RETURN_CODE 0
POST_COMMAND "diff -B -b shadergen_UsdPStextured.out ${CMAKE_INSTALL_PREFIX}/tests/ctest/testHdStMaterialXShaderGen/baseline/shadergen_UsdPStextured.out"
STDOUT_REDIRECT shadergen_UsdPStextured.out
DIFF_COMPARE shadergen_UsdPStextured.out
TESTENV testHdStMaterialXShaderGen
)
pxr_register_test(testHdStMaterialXShaderGen_SStextured
COMMAND "${CMAKE_INSTALL_PREFIX}/tests/testHdStMaterialXShaderGen --filename standard_surface_brass_tiled.mtlx --textureMap image_color_file:diffuseColor --textureMap image_roughness_file:roughness --primvarMap uv:vector2"
STDOUT_REDIRECT shadergen_SStextured.out
EXPECTED_RETURN_CODE 0
POST_COMMAND "diff -B -b shadergen_SStextured.out ${CMAKE_INSTALL_PREFIX}/tests/ctest/testHdStMaterialXShaderGen/baseline/shadergen_SStextured.out"
STDOUT_REDIRECT shadergen_SStextured.out
DIFF_COMPARE shadergen_SStextured.out
TESTENV testHdStMaterialXShaderGen
)
pxr_register_test(testHdStMaterialXShaderGen_UsdPSglass
COMMAND "${CMAKE_INSTALL_PREFIX}/tests/testHdStMaterialXShaderGen --filename usd_preview_surface_glass.mtlx"
STDOUT_REDIRECT shadergen_UsdPSglass.out
EXPECTED_RETURN_CODE 0
POST_COMMAND "diff -B -b shadergen_UsdPSglass.out ${CMAKE_INSTALL_PREFIX}/tests/ctest/testHdStMaterialXShaderGen/baseline/shadergen_UsdPSglass.out"
STDOUT_REDIRECT shadergen_UsdPSglass.out
DIFF_COMPARE shadergen_UsdPSglass.out
TESTENV testHdStMaterialXShaderGen
)
pxr_register_test(testHdStMaterialXShaderGen8_SStextured_bindless
COMMAND "${CMAKE_INSTALL_PREFIX}/tests/testHdStMaterialXShaderGen --filename standard_surface_brass_tiled.mtlx --textureMap image_color_file:diffuseColor --textureMap image_roughness_file:roughness --primvarMap uv:vector2 --bindless"
STDOUT_REDIRECT shadergen_SStextured_bindless.out
EXPECTED_RETURN_CODE 0
POST_COMMAND "diff -B -b shadergen_SStextured_bindless.out ${CMAKE_INSTALL_PREFIX}/tests/ctest/testHdStMaterialXShaderGen/baseline/shadergen_SStextured_bindless.out"
STDOUT_REDIRECT shadergen_SStextured_bindless.out
DIFF_COMPARE shadergen_SStextured_bindless.out
TESTENV testHdStMaterialXShaderGen
)
pxr_register_test(testHdStMaterialXShaderGen_texcoord
COMMAND "${CMAKE_INSTALL_PREFIX}/tests/testHdStMaterialXShaderGen --filename texcoord.mtlx --primvarMap st:vector2"
STDOUT_REDIRECT shadergen_texcoord.out
EXPECTED_RETURN_CODE 0
POST_COMMAND "diff -B -b shadergen_texcoord.out ${CMAKE_INSTALL_PREFIX}/tests/ctest/testHdStMaterialXShaderGen/baseline/shadergen_texcoord.out"
STDOUT_REDIRECT shadergen_texcoord.out
DIFF_COMPARE shadergen_texcoord.out
TESTENV testHdStMaterialXShaderGen
)
endif()
Expand Down Expand Up @@ -2996,7 +2996,7 @@ pxr_register_test(testHdStPrimvars
COMMAND "${CMAKE_INSTALL_PREFIX}/tests/testHdStPrimvars"
EXPECTED_RETURN_CODE 0
STDOUT_REDIRECT testHdStPrimvars-Run1-stdout.txt
POST_COMMAND "diff -I computeShader -I drawingShader -I gpuMemoryUsed -I uboSize -I ssboSize testHdStPrimvars-Run1-stdout.txt ${CMAKE_INSTALL_PREFIX}/tests/ctest/testHdStPrimvars/baseline/testHdStPrimvars-Run1-stdout.txt"
DIFF_COMPARE testHdStPrimvars-Run1-stdout.txt
TESTENV testHdStPrimvars
ENV
HDST_ENABLE_MATERIAL_PRIMVAR_FILTERING=0
Expand Down Expand Up @@ -3362,4 +3362,4 @@ pxr_register_test(testHdStShaders
ENV
TF_DEBUG=HD_SAFE_MODE
)
endif() # TARGET shared_libs
endif() # TARGET shared_libs
22 changes: 15 additions & 7 deletions pxr/imaging/hdSt/testenv/testHdStBufferArray.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,15 +40,26 @@ PrintPerfCounter(HdPerfLog &perfLog, TfToken const &token)
static void
Dump(std::string const &message, VtDictionary dict, HdPerfLog &perfLog)
{
// Get the keys in sorted order. This ensures consistent reporting
// These vary between platforms and runs, we don't want them in the diff.
static const std::unordered_set<std::string> skippedKeys = {
HdTokens->drawingShader,
HdTokens->computeShader,
HdPerfTokens->gpuMemoryUsed,
HdPerfTokens->uboSize,
HdPerfTokens->ssboSize,
};

// Get the keys in sorted order. This ensures consistent reporting
// regardless of the sort order of dict.
std::set<std::string> keys;
for (auto v: dict) {
keys.insert(v.first);
for (const auto& [key, _] : dict) {
if (!skippedKeys.count(key)) {
keys.insert(key);
}
}

std::cout << message;
for (auto key: keys) {
for (const auto& key: keys) {
std::cout << key << ", ";
const VtValue& value = dict[key];
if (value.IsHolding<size_t>()) {
Expand All @@ -57,8 +68,6 @@ Dump(std::string const &message, VtDictionary dict, HdPerfLog &perfLog)
std::cout << "\n";
}
PrintPerfCounter(perfLog, HdPerfTokens->garbageCollected);
PrintPerfCounter(perfLog, HdPerfTokens->meshTopology);
PrintPerfCounter(perfLog, HdPerfTokens->basisCurvesTopology);
PrintPerfCounter(perfLog, HdPerfTokens->instMeshTopology);
PrintPerfCounter(perfLog, HdPerfTokens->instBasisCurvesTopology);
PrintPerfCounter(perfLog, HdPerfTokens->instVertexAdjacency);
Expand Down Expand Up @@ -345,4 +354,3 @@ int main()
return EXIT_FAILURE;
}
}

Loading