Skip to content

Commit

Permalink
Merge branch 'dev' into debloip/HYDRA-712/hierarchical-properties-for…
Browse files Browse the repository at this point in the history
…-plugins
  • Loading branch information
debloip-adsk committed Jul 4, 2024
2 parents c137ac2 + 33857b5 commit d543b30
Show file tree
Hide file tree
Showing 65 changed files with 2,868 additions and 323 deletions.
68 changes: 66 additions & 2 deletions build.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,15 @@
import tarfile
import time
import zipfile
import json

###########################################################
# mapping for platform string from python builtin str
platform_mapping = {
"darwin": "osx",
"windows": "win",
"linux": "lin"
}

############################################################
# Helpers for printing output
Expand Down Expand Up @@ -635,6 +644,40 @@ def Package(context):
############################################################
# InstallContext
class InstallContext:

kFilesToExclude = []
kPluginsToExclude = []
kPluginsToInclude = []
kPlatformToInclude = []
kPlatformToExclude = []
allLabelsToInclude = []

ctestArgs = list()

# get list of labels to pass to ctest-args
def get_ctest_labels(self):
try:
with open("tests-to-run.json", 'r') as file:
ctest_labels_config = json.load(file)
except json.JSONDecodeError as e:
print(f"Failed to decode JSON: {e}")
except FileNotFoundError as e:
print(f"File not found: {e}")
except Exception as e:
print(f"An error occurred: {e}")

for key, values in ctest_labels_config.items():
if key == "plugins_to_include":
self.kPluginsToInclude = values
if key == "plugins_to_exclude":
self.kPluginsToExclude = values
if key == "platforms_to_include":
self.kPlatformToInclude = values
if key == "platforms_to_exclude":
self.kPlatformToExclude = values
if key == "files_to_exclude":
self.kFilesToExclude = values

def __init__(self, args):
# Assume the project's top level cmake is in the current source directory
self.mayaHydraSrcDir = os.path.normpath(
Expand Down Expand Up @@ -716,12 +759,33 @@ def __init__(self, args):
self.stagesArgs.append(arg)

# CTest arguments
self.ctestArgs = list()
for argList in args.ctest_args:
for arg in argList.split(","):
self.ctestArgs.append(arg)

# Redirect output stream to file
# get labels to be passed for ctest
self.get_ctest_labels()

# add -E args for test file to be excluded by name
if self.kFilesToExclude:
self.ctestArgs.append(f'{"-E"} {"|".join(self.kFilesToExclude)}')

# add -L args, test with following labels to run
if self.kPluginsToInclude:
self.ctestArgs.append(f'{"-L"} {"|".join(self.kPluginsToInclude)}')

# Determine the current platform
current_platform = platform.system().lower()
exclPlatform = []
for a in self.kPlatformToExclude:
if platform_mapping.get(current_platform) in a:
exclPlatform.append(a)

allExcludeLabels = self.kPluginsToExclude + exclPlatform
# add -LE args, test with following labels to be skipped
if allExcludeLabels:
self.ctestArgs.append(f'{"-LE"} {"|".join(allExcludeLabels)}')

self.redirectOutstreamFile = args.redirect_outstream_file

try:
Expand Down
50 changes: 49 additions & 1 deletion cmake/test.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,54 @@ if(MayaUsd_FOUND)
endif()
endif()

function(find_labels label_set label_list)
string(REPLACE ":" ";" split_labels ${label_set})
list(LENGTH split_labels len)
if(len GREATER 0)
list(GET split_labels 1 labels_value)
# we expect comma separated labels
string(REPLACE "," ";" all_labels ${labels_value})
set(local_label_list "")
foreach(label ${all_labels})
list(APPEND local_label_list ${label})
endforeach()
set(${label_list} ${local_label_list} PARENT_SCOPE)
endif()
endfunction()

function(get_testfile_and_labels all_labels test_filename test_script)
# fetch labels for each test file
string(REPLACE "|" ";" tests_with_tags ${test_script})
list(GET tests_with_tags 0 filename)
# set the test file to input as no labels were passed
set(${test_filename} ${filename} PARENT_SCOPE)
list(LENGTH tests_with_tags length)
math(EXPR one_less_length "${length} - 1")
if(length GREATER 1)
set(collect_labels "")
foreach(i RANGE 1 ${one_less_length})
list(GET tests_with_tags ${i} item)
find_labels(${item} label_list)
list(APPEND collect_labels ${label_list})
endforeach()
set(${all_labels} ${collect_labels} PARENT_SCOPE)
else()
set(${all_labels} "" PARENT_SCOPE)
endif()
endfunction()

function(apply_labels_to_test test_labels test_file)
set_property(TEST ${test_file} APPEND PROPERTY LABELS "default")
list(LENGTH test_labels list_length)
if(${list_length} GREATER 0)
# if(NOT ${test_labels} STREQUAL "")
foreach(label ${test_labels})
set_property(TEST ${test_file} APPEND PROPERTY LABELS ${label})
message(STATUS "Added test label \"${label}\" for ${test_file}")
endforeach()
endif()
endfunction()

function(mayaUsd_get_unittest_target unittest_target unittest_basename)
get_filename_component(unittest_name ${unittest_basename} NAME_WE)
set(${unittest_target} "${unittest_name}" PARENT_SCOPE)
Expand Down Expand Up @@ -94,7 +142,7 @@ endif()
# separate_argument_list before passing to this func
# if you start with a cmake-style list.
#
function(mayaUsd_add_test test_name)
function(mayaUsd_add_test test_name)
# -----------------
# 1) Arg processing
# -----------------
Expand Down
Binary file added doc/images/instanceSelectionHighlight.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added doc/images/instanceTranslations.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added doc/images/instancedBy.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added doc/images/instancerTopology.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added doc/images/pointInstancerSelectionHighlight.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added doc/images/prototypeSelectionHighlight.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit d543b30

Please sign in to comment.