Add additional meta-data for static artifacts
This commit is contained in:
@@ -151,12 +151,6 @@ function(ly_add_test)
|
||||
set(LY_ADDED_TEST_NAME ${qualified_test_run_name_with_suite}::TEST_RUN)
|
||||
set(LY_ADDED_TEST_NAME ${LY_ADDED_TEST_NAME} PARENT_SCOPE)
|
||||
|
||||
# Store the test so we can walk through all of them in LYTestImpactFramework.cmake
|
||||
set_property(GLOBAL APPEND PROPERTY LY_ALL_TESTS ${LY_ADDED_TEST_NAME})
|
||||
set_property(GLOBAL APPEND PROPERTY LY_ALL_TESTS_${LY_ADDED_TEST_NAME}_TEST_NAME ${ly_add_test_NAME})
|
||||
set_property(GLOBAL APPEND PROPERTY LY_ALL_TESTS_${LY_ADDED_TEST_NAME}_TEST_SUITE ${ly_add_test_TEST_SUITE})
|
||||
set_property(GLOBAL APPEND PROPERTY LY_ALL_TESTS_${LY_ADDED_TEST_NAME}_TEST_LIBRARY ${ly_add_test_TEST_LIBRARY})
|
||||
|
||||
set(final_labels SUITE_${ly_add_test_TEST_SUITE})
|
||||
|
||||
if (ly_add_test_TEST_REQUIRES)
|
||||
@@ -247,6 +241,12 @@ function(ly_add_test)
|
||||
|
||||
endif()
|
||||
|
||||
# Store the test so we can walk through all of them in LYTestImpactFramework.cmake
|
||||
set_property(GLOBAL APPEND PROPERTY LY_ALL_TESTS ${ly_add_test_NAME})
|
||||
set_property(GLOBAL APPEND PROPERTY LY_ALL_TESTS_${ly_add_test_NAME}_TEST_SUITE ${ly_add_test_TEST_SUITE})
|
||||
set_property(GLOBAL APPEND PROPERTY LY_ALL_TESTS_${ly_add_test_NAME}_TEST_LIBRARY ${ly_add_test_TEST_LIBRARY})
|
||||
set_property(GLOBAL APPEND PROPERTY LY_ALL_TESTS_${ly_add_test_NAME}_TEST_TIMEOUT ${ly_add_test_TIMEOUT})
|
||||
|
||||
endfunction()
|
||||
|
||||
#! ly_add_pytest: registers target PyTest-based test with CTest
|
||||
@@ -298,8 +298,8 @@ function(ly_add_pytest)
|
||||
${ly_add_pytest_UNPARSED_ARGUMENTS}
|
||||
)
|
||||
|
||||
set_property(GLOBAL APPEND PROPERTY LY_ALL_TESTS_${ly_add_pytest_NAME}_SCRIPT_PATH ${ly_add_pytest_PATH})
|
||||
set_tests_properties(${LY_ADDED_TEST_NAME} PROPERTIES RUN_SERIAL "${ly_add_pytest_TEST_SERIAL}")
|
||||
set_property(GLOBAL APPEND PROPERTY LY_ALL_TESTS_${LY_ADDED_TEST_NAME}_SCRIPT_PATH ${ly_add_pytest_PATH})
|
||||
endfunction()
|
||||
|
||||
#! ly_add_editor_python_test: registers target Editor Python Bindings test with CTest
|
||||
@@ -363,8 +363,8 @@ function(ly_add_editor_python_test)
|
||||
COMPONENT ${ly_add_editor_python_test_COMPONENT}
|
||||
)
|
||||
|
||||
set_property(GLOBAL APPEND PROPERTY LY_ALL_TESTS_${ly_add_editor_python_test_NAME}_SCRIPT_PATH ${ly_add_editor_python_test_PATH})
|
||||
set_tests_properties(${LY_ADDED_TEST_NAME} PROPERTIES RUN_SERIAL "${ly_add_editor_python_test_TEST_SERIAL}")
|
||||
set_property(GLOBAL APPEND PROPERTY LY_ALL_TESTS_${LY_ADDED_TEST_NAME}_SCRIPT_PATH ${ly_add_editor_python_test_PATH})
|
||||
endfunction()
|
||||
|
||||
#! ly_add_googletest: Adds a new RUN_TEST using for the specified target using the supplied command or fallback to running
|
||||
@@ -424,8 +424,14 @@ function(ly_add_googletest)
|
||||
set(full_test_command $<TARGET_FILE:AZ::AzTestRunner> $<TARGET_FILE:${build_target}> AzRunUnitTests)
|
||||
# Add AzTestRunner as a build dependency
|
||||
ly_add_dependencies(${build_target} AZ::AzTestRunner)
|
||||
# Ideally, we would populate the full command procedurally but the generator expressions won't be expanded by the time we need this data
|
||||
set_property(GLOBAL APPEND PROPERTY LY_ALL_TESTS_${ly_add_googletest_NAME}_TEST_COMMAND "AzRunUnitTests")
|
||||
else()
|
||||
set(full_test_command ${ly_add_googletest_TEST_COMMAND})
|
||||
# Remove the generator expressions so we are left with the argument(s) required to run unit tests for executable targets
|
||||
string(REPLACE ";" "" stripped_test_command ${full_test_command})
|
||||
string(GENEX_STRIP ${stripped_test_command} stripped_test_command)
|
||||
set_property(GLOBAL APPEND PROPERTY LY_ALL_TESTS_${ly_add_googletest_NAME}_TEST_COMMAND ${stripped_test_command})
|
||||
endif()
|
||||
|
||||
string(REPLACE "::" "_" report_directory "${GTEST_XML_OUTPUT_DIR}/${ly_add_googletest_NAME}.xml")
|
||||
@@ -507,8 +513,14 @@ function(ly_add_googlebenchmark)
|
||||
|
||||
# If command is not supplied attempts, uses the AzTestRunner to run googlebenchmarks on the supplied TARGET
|
||||
set(full_test_command $<TARGET_FILE:AZ::AzTestRunner> $<TARGET_FILE:${build_target}> AzRunBenchmarks ${output_format_args})
|
||||
# Ideally, we would populate the full command procedurally but the generator expressions won't be expanded by the time we need this data
|
||||
set_property(GLOBAL APPEND PROPERTY LY_ALL_TESTS_${ly_add_googlebenchmark_NAME}_TEST_COMMAND "AzRunUnitTests")
|
||||
else()
|
||||
set(full_test_command ${ly_add_googlebenchmark_TEST_COMMAND})
|
||||
# Remove the generator expressions so we are left with the argument(s) required to run unit tests for executable targets
|
||||
string(REPLACE ";" "" stripped_test_command ${full_test_command})
|
||||
string(GENEX_STRIP ${stripped_test_command} stripped_test_command)
|
||||
set_property(GLOBAL APPEND PROPERTY LY_ALL_TESTS_${ly_add_googletest_NAME}_TEST_COMMAND ${stripped_test_command})
|
||||
endif()
|
||||
|
||||
ly_add_test(
|
||||
@@ -524,6 +536,5 @@ function(ly_add_googlebenchmark)
|
||||
AZ::AzTestRunner
|
||||
COMPONENT ${ly_add_googlebenchmark_COMPONENT}
|
||||
)
|
||||
|
||||
endfunction()
|
||||
|
||||
|
||||
@@ -1,111 +1,184 @@
|
||||
[path.configuration]
|
||||
repo_dir = "${repo_dir}"
|
||||
working_dir = "${working_dir}"
|
||||
bin_dir = "${runtime_bin_dir}"
|
||||
tests_dir = "${tests_dir}"
|
||||
temp_dir = "${temp_dir}"
|
||||
target_mappings_dir = "${source_target_mapping_dir}"
|
||||
test_type_dir = "${test_type_dir}"
|
||||
dependencies_dir = "${target_dependency_dir}"
|
||||
|
||||
[sourcetree.configuration.filters.autogen]
|
||||
# E.g. matches input /Foo/{Bar}.FooBar.xml with output /Baz/{Bar}.BazBar.cpp
|
||||
input_output_pairer = "(.*)\\..*"
|
||||
[sourcetree.configuration.filters.autogen.input]
|
||||
exclude_filter = [".jinja"]
|
||||
[sourcetree.configuration.filters.source]
|
||||
exclude_filter = [".cmake"]
|
||||
[sourcetree.configuration.testtype.enumerated]
|
||||
file = "All.tests"
|
||||
# The table to read from the test enumeration file that contains the test targets
|
||||
target_table = "google.test"
|
||||
[sourcetree.configuration.dependency]
|
||||
# E.g. matches WhiteBox.Editor.Static\n(Gem::WhiteBox.Editor.Static) or WhiteBox.Editor.Static
|
||||
target_dependency_file_matcher = "target\\.(.*)\\.(dependers)?"
|
||||
# E.g. matches target.WhiteBox.Editor.Static (for dependency) target.WhiteBox.Editor.Static.dependers (for dependers)
|
||||
target_vertex_matcher = "(?:(.*)\\n|(.*)"
|
||||
|
||||
[spartia.configuration]
|
||||
test_impact_Data_file = "TestImpactData.spartia"
|
||||
test_run_coverage_file = "{test_dir}\\{test_target}.coverage.xml"
|
||||
test_run_results_file = "{test_dir}\\{test_target}.results.xml"
|
||||
test_enumeration_file = "{temp_dir}\\{test_target}.enum"
|
||||
test_shard_selection_file = "{temp_dir}\\{test_target}.filter.{shard_id}"
|
||||
exclude_filter = [
|
||||
{ target = "AssetBundler.Tests", tests = ["*"] },
|
||||
{ target = "AssetProcessor.Tests", tests = ["*"] },
|
||||
{ target = "CryRenderD3D11.Tests", tests = ["*"] },
|
||||
{ target = "CryRenderD3D12.Tests", tests = ["*"] },
|
||||
{ target = "LyzardApplicationDescriptors.Tests", tests = ["*"] },
|
||||
{ target = "EMotionFX.Editor.Tests", tests = ["UIFixture.*", "SimulatedObjectModelTestsFixture.*", "TestParametersFixture.*", "CanSeeJointsFixture.*", "LODSkinnedMeshFixtureTests/LODSkinnedMeshFixture.CheckLODLevels/*"] },
|
||||
{ target = "EMotionFX.Tests", tests = ["UIFixture.*", "SimulatedObjectModelTestsFixture.*", "TestParametersFixture.*", "CanSeeJointsFixture.*"] },
|
||||
{ target = "AzCore.Tests", tests = ["AllocatorsTestFixtureLeakDetectionDeathTest_SKIPCODECOVERAGE.AllocatorLeak"] },
|
||||
]
|
||||
[spartia.configuration.shard]
|
||||
# Long tests that will be sharded
|
||||
include_filter = [
|
||||
{ target = "AzCore.Tests", policy = "fixture_contiguous" },
|
||||
{ target = "AzToolsFramework.Tests", policy = "fixture_contiguous" },
|
||||
{ target = "Framework.Tests", policy = "test_interleaved" },
|
||||
{ target = "LmbrCentral.Editor.Tests", policy = "test_interleaved" },
|
||||
{ target = "EditorLib.Tests", policy = "test_interleaved" },
|
||||
{ target = "PhysX.Tests", policy = "test_interleaved" },
|
||||
{ target = "ImageProcessing.Tests", policy = "test_interleaved" },
|
||||
{ target = "Atom_RPI.Tests", policy = "test_interleaved" },
|
||||
{ target = "Atom_RHI.Tests", policy = "test_interleaved" },
|
||||
{ target = "AzManipulatorFramework.Tests", policy = "test_interleaved" },
|
||||
{ target = "WhiteBox.Editor.Tests", policy = "test_interleaved" },
|
||||
{ target = "AzManipulatorTestFramework.Tests", policy = "test_interleaved" },
|
||||
{ target = "AtomCore.Tests", policy = "test_interleaved" },
|
||||
{ target = "ImageProcessingAtom.Editor.Tests", policy = "test_interleaved" },
|
||||
{ target = "EditorPythonBindings.Tests", policy = "test_interleaved" },
|
||||
{ target = "Atom_Utils.Tests", policy = "test_interleaved" },
|
||||
{ target = "AudioEngineWwise.Editor.Tests", policy = "test_interleaved" },
|
||||
{ target = "Multiplayer.Tests", policy = "test_interleaved" },
|
||||
{ target = "LmbrCentral.Tests", policy = "test_interleaved" },
|
||||
{ target = "LyMetricsShared.Tests", policy = "fixture_contiguous" },
|
||||
{ target = "PhysX.Editor.Tests", policy = "test_interleaved" },
|
||||
{ target = "ComponentEntityEditorPlugin.Tests", policy = "test_interleaved" },
|
||||
{ target = "DeltaCataloger.Tests", policy = "test_interleaved" },
|
||||
{ target = "GradientSignal.Tests", policy = "test_interleaved" },
|
||||
{ target = "LyShine.Tests", policy = "test_interleaved" },
|
||||
{ target = "EMotionFX.Editor.Tests", policy = "test_interleaved" },
|
||||
{ target = "EMotionFX.Tests", policy = "test_interleaved" },
|
||||
{ target = "CrySystem.Tests", policy = "test_interleaved" },
|
||||
]
|
||||
[spartia.configuration.instrumentation]
|
||||
abs_bin = "${instrumentation_bin}"
|
||||
[spartia.configuration.instrumentation.errors]
|
||||
# AzCppCoverage error codes
|
||||
incorrect_args = -1618178468
|
||||
[spartia.configuration.instrumentation.test_coverage]
|
||||
args = "--export_type cobertura:\"{test_run_coverage_file}\""
|
||||
[spartia.configuration.instrumentation.test_selection]
|
||||
args = "--gtest_filter={test_selection}"
|
||||
[spartia.configuration.instrumentation.test_enumeration]
|
||||
args = "--gtest_list_tests"
|
||||
[spartia.configuration.instrumentation.test_results]
|
||||
args = "--gtest_output=xml:\"{test_run_results_file}\""
|
||||
[spartia.configuration.instrumentation.test_results.errors]
|
||||
test_success = 0
|
||||
test_failures = 1
|
||||
[spartia.configuration.instrumentation.binary_type.dynlib]
|
||||
abs_bin = "{bin_dir}\\AzTestRunner.exe"
|
||||
args = "\"{bin_dir}\\{test_target}.dll\" AzRunUnitTests"
|
||||
[spartia.configuration.instrumentation.binary_type.dynlib.test_enumeration]
|
||||
args = "--stdout_to_file \"{test_enumeration_file}\" {test_enumeration}"
|
||||
[spartia.configuration.instrumentation.binary_type.dynlib.test_shard_selection]
|
||||
args = "--args_from_file \"{test_shard_selection_file}\""
|
||||
[spartia.configuration.instrumentation.binary_type.dynlib.errors]
|
||||
# AzTestRunner error codes
|
||||
failed_to_find_target_bin = 102
|
||||
incorrect_args = 101
|
||||
known_errors = [ 103, 104]
|
||||
[spartia.configuration.instrumentation.binary_type.executable]
|
||||
abs_bin = "{bin_dir}\\{test_target}.exe"
|
||||
[spartia.configuration.instrumentation.binary_type.executable.test_enumeration]
|
||||
args = "--stdout_to_file \"{test_enumeration_file}\" {test_enumeration}"
|
||||
[spartia.configuration.instrumentation.binary_type.executable.test_shard_selection]
|
||||
args = "--args_from_file \"{test_shard_selection_file}\""
|
||||
[spartia.configuration.test_run.seed]
|
||||
instrumentation_args = "--modules \"{bin_dir}\" --excluded_modules \"{binary_type.dynlib.abs_bin}\" --sources \"{repo_dir}\" --no_breakpoints {test_coverage} -- "
|
||||
{
|
||||
"meta": {
|
||||
"platform": "${platform}",
|
||||
"timestamp": "${timestamp}"
|
||||
},
|
||||
"repo": {
|
||||
"root": "${repo_dir}"
|
||||
},
|
||||
"workspace": {
|
||||
"temp": {
|
||||
"root": "${temp_dir}",
|
||||
"artifact_dir": "RuntimeArtifact"
|
||||
},
|
||||
"persistent": {
|
||||
"root": "${persistent_dir}",
|
||||
"test_impact_data_file": "TestImpactData.spartia",
|
||||
"enumeration_cache_dir": "EnumerationCache"
|
||||
}
|
||||
},
|
||||
"artifacts": {
|
||||
"static": {
|
||||
"build_target_descriptor": {
|
||||
"dir": "${source_target_mapping_dir}",
|
||||
"target_sources": {
|
||||
"static": {
|
||||
"include_filters": [
|
||||
".h", ".hpp", ".hxx", ".inl", ".c", ".cpp", ".cxx"
|
||||
]
|
||||
},
|
||||
"autogen": {
|
||||
"input_output_pairer": "(.*)\\..*",
|
||||
"input": {
|
||||
"include_filters": [
|
||||
".xml"
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"dependency_graph_data": {
|
||||
"dir": "${target_dependency_dir}",
|
||||
"matchers": {
|
||||
"target_dependency_file": "target\\.(.*)\\.(dependers)?",
|
||||
"target_vertex": "(?:(.*)\\n|(.*)"
|
||||
}
|
||||
},
|
||||
"test_target_meta": {
|
||||
"file": "${test_target_type_file}"
|
||||
}
|
||||
}
|
||||
},
|
||||
"test_engine": {
|
||||
"test_runner": {
|
||||
"bin": "${test_runner_bin}"
|
||||
},
|
||||
"instrumentation": {
|
||||
"bin": "${instrumentation_bin}"
|
||||
}
|
||||
},
|
||||
"target": {
|
||||
"dir": "${bin_dir}",
|
||||
"exclude": [
|
||||
|
||||
],
|
||||
"shard": [
|
||||
{
|
||||
"policy": "fixture_contiguous",
|
||||
"target": "AzCore.Tests"
|
||||
},
|
||||
{
|
||||
"policy": "fixture_contiguous",
|
||||
"target": "AzToolsFramework.Tests"
|
||||
},
|
||||
{
|
||||
"policy": "test_interleaved",
|
||||
"target": "Framework.Tests"
|
||||
},
|
||||
{
|
||||
"policy": "test_interleaved",
|
||||
"target": "LmbrCentral.Editor.Tests"
|
||||
},
|
||||
{
|
||||
"policy": "test_interleaved",
|
||||
"target": "EditorLib.Tests"
|
||||
},
|
||||
{
|
||||
"policy": "test_interleaved",
|
||||
"target": "PhysX.Tests"
|
||||
},
|
||||
{
|
||||
"policy": "test_interleaved",
|
||||
"target": "ImageProcessing.Tests"
|
||||
},
|
||||
{
|
||||
"policy": "test_interleaved",
|
||||
"target": "Atom_RPI.Tests"
|
||||
},
|
||||
{
|
||||
"policy": "test_interleaved",
|
||||
"target": "Atom_RHI.Tests"
|
||||
},
|
||||
{
|
||||
"policy": "test_interleaved",
|
||||
"target": "AzManipulatorFramework.Tests"
|
||||
},
|
||||
{
|
||||
"policy": "test_interleaved",
|
||||
"target": "WhiteBox.Editor.Tests"
|
||||
},
|
||||
{
|
||||
"policy": "test_interleaved",
|
||||
"target": "ImageProcessing.Tests"
|
||||
},
|
||||
{
|
||||
"policy": "test_interleaved",
|
||||
"target": "AzManipulatorTestFramework.Tests"
|
||||
},
|
||||
{
|
||||
"policy": "test_interleaved",
|
||||
"target": "AtomCore.Tests"
|
||||
},
|
||||
{
|
||||
"policy": "test_interleaved",
|
||||
"target": "ImageProcessingAtom.Editor.Tests"
|
||||
},
|
||||
{
|
||||
"policy": "test_interleaved",
|
||||
"target": "EditorPythonBindings.Tests"
|
||||
},
|
||||
{
|
||||
"policy": "test_interleaved",
|
||||
"target": "Atom_Utils.Tests"
|
||||
},
|
||||
{
|
||||
"policy": "test_interleaved",
|
||||
"target": "AudioEngineWwise.Editor.Tests"
|
||||
},
|
||||
{
|
||||
"policy": "test_interleaved",
|
||||
"target": "Multiplayer.Tests"
|
||||
},
|
||||
{
|
||||
"policy": "test_interleaved",
|
||||
"target": "LmbrCentral.Tests"
|
||||
},
|
||||
{
|
||||
"policy": "fixture_contiguous",
|
||||
"target": "LyMetricsShared.Tests"
|
||||
},
|
||||
{
|
||||
"policy": "test_interleaved",
|
||||
"target": "PhysX.Editor.Tests"
|
||||
},
|
||||
{
|
||||
"policy": "test_interleaved",
|
||||
"target": "ComponentEntityEditorPlugin.Tests"
|
||||
},
|
||||
{
|
||||
"policy": "test_interleaved",
|
||||
"target": "DeltaCataloger.Tests"
|
||||
},
|
||||
{
|
||||
"policy": "test_interleaved",
|
||||
"target": "GradientSignal.Tests"
|
||||
},
|
||||
{
|
||||
"policy": "test_interleaved",
|
||||
"target": "LyShine.Tests"
|
||||
},
|
||||
{
|
||||
"policy": "test_interleaved",
|
||||
"target": "EMotionFX.Editor.Tests"
|
||||
},
|
||||
{
|
||||
"policy": "test_interleaved",
|
||||
"target": "EMotionFX.Tests"
|
||||
},
|
||||
{
|
||||
"policy": "test_interleaved",
|
||||
"target": "CrySystem.Tests"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
@@ -15,6 +15,9 @@ option(LY_TEST_IMPACT_ACTIVE "Enable test impact framework" OFF)
|
||||
# Path to test instrumentation binary
|
||||
option(LY_TEST_IMPACT_INSTRUMENTATION_BIN "Path to test impact framework instrumentation binary" OFF)
|
||||
|
||||
# Name of test impact framework console static library target
|
||||
set(LY_TEST_IMPACT_CONSOLE_STATIC_TARGET "TestImpact.Frontend.Console.Static")
|
||||
|
||||
# Name of test impact framework console target
|
||||
set(LY_TEST_IMPACT_CONSOLE_TARGET "TestImpact.Frontend.Console")
|
||||
|
||||
@@ -33,11 +36,8 @@ set(LY_TEST_IMPACT_SOURCE_TARGET_MAPPING_DIR "${LY_TEST_IMPACT_ARTIFACT_DIR}/Map
|
||||
# Directory for build target dependency/depender graphs
|
||||
set(LY_TEST_IMPACT_TARGET_DEPENDENCY_DIR "${LY_TEST_IMPACT_ARTIFACT_DIR}/Dependency")
|
||||
|
||||
# Directory for test type enumeration files
|
||||
set(LY_TEST_IMPACT_TEST_TYPE_DIR "${LY_TEST_IMPACT_ARTIFACT_DIR}/TestType")
|
||||
|
||||
# Master test enumeration file for all test types
|
||||
set(LY_TEST_IMPACT_TEST_TYPE_FILE "${LY_TEST_IMPACT_TEST_TYPE_DIR}/All.tests")
|
||||
set(LY_TEST_IMPACT_TEST_TYPE_FILE "${LY_TEST_IMPACT_ARTIFACT_DIR}/TestType/All.tests")
|
||||
|
||||
#! ly_test_impact_rebase_file_to_repo_root: rebases the relative and/or absolute path to be relative to repo root directory and places the resulting path in quotes.
|
||||
#
|
||||
@@ -93,14 +93,13 @@ function(ly_test_impact_get_test_launch_method TARGET_NAME LAUNCH_METHOD)
|
||||
endif()
|
||||
endfunction()
|
||||
|
||||
#! ly_test_impact_extract_google_test: explodes a composite google test string into namespace, test and suite components.
|
||||
#! ly_test_impact_extract_google_test_name: extracts the google test name from the composite 'namespace::test_name' string
|
||||
#
|
||||
# \arg:COMPOSITE_TEST test in the form 'namespace::test'
|
||||
# \arg:TEST_NAMESPACE namespace for the test
|
||||
# \arg:TEST_NAME name of test
|
||||
function(ly_test_impact_extract_google_test COMPOSITE_TEST TEST_NAMESPACE TEST_NAME)
|
||||
get_property(test_components GLOBAL PROPERTY LY_ALL_TESTS_${COMPOSITE_TEST}_TEST_NAME)
|
||||
# Namespace and test are mandetiry
|
||||
# Namespace and test are mandetory
|
||||
string(REPLACE "::" ";" test_components ${test_components})
|
||||
list(LENGTH test_components num_test_components)
|
||||
if(num_test_components LESS 2)
|
||||
@@ -113,37 +112,74 @@ function(ly_test_impact_extract_google_test COMPOSITE_TEST TEST_NAMESPACE TEST_N
|
||||
set(${TEST_NAME} ${test_name} PARENT_SCOPE)
|
||||
endfunction()
|
||||
|
||||
#! ly_test_impact_extract_python_test: explodes a composite python test string into filename, namespace, test and suite components.
|
||||
#! ly_test_impact_extract_python_test_name: extracts the python test name from the composite 'namespace::test_name' string
|
||||
#
|
||||
# \arg:COMPOSITE_TEST test in form 'namespace::test' or 'test'
|
||||
# \arg:TEST_NAMESPACE namespace for the test (optional)
|
||||
# \arg:TEST_NAME name of test
|
||||
# \arg:TEST_FILE the Python script path for this test
|
||||
function(ly_test_impact_extract_python_test COMPOSITE_TEST TEST_NAMESPACE TEST_NAME TEST_FILE)
|
||||
function(ly_test_impact_extract_python_test COMPOSITE_TEST TEST_NAME)
|
||||
get_property(test_components GLOBAL PROPERTY LY_ALL_TESTS_${COMPOSITE_TEST}_TEST_NAME)
|
||||
get_property(test_file GLOBAL PROPERTY LY_ALL_TESTS_${COMPOSITE_TEST}_SCRIPT_PATH)
|
||||
|
||||
# namespace is optional, in which case this component will be simply the test name
|
||||
string(REPLACE "::" ";" test_components ${test_components})
|
||||
list(LENGTH test_components num_test_components)
|
||||
if(num_test_components GREATER 1)
|
||||
list(GET test_components 0 test_namespace)
|
||||
list(GET test_components 1 test_name)
|
||||
else()
|
||||
set(test_namespace "")
|
||||
set(test_name ${test_components})
|
||||
endif()
|
||||
|
||||
set(${TEST_NAME} ${test_name} PARENT_SCOPE)
|
||||
endfunction()
|
||||
|
||||
#! ly_test_impact_extract_google_test_params: extracts the google test name and command parameters.
|
||||
#
|
||||
# \arg:COMPOSITE_TEST test in the form 'namespace::test'
|
||||
# \arg:TEST_NAMESPACE namespace for the test
|
||||
# \arg:TEST_NAME name of test
|
||||
# \arg:TEST_NAME optional command arguments to run the test
|
||||
# \arg:TEST_NAME test timeout value
|
||||
function(ly_test_impact_extract_google_test_params COMPOSITE_TEST TEST_NAME TEST_COMMAND)
|
||||
get_property(test_command GLOBAL PROPERTY LY_ALL_TESTS_${COMPOSITE_TEST}_TEST_COMMAND)
|
||||
# Namespace and test are mandetory
|
||||
string(REPLACE "::" ";" test_components ${COMPOSITE_TEST})
|
||||
list(LENGTH test_components num_test_components)
|
||||
if(num_test_components LESS 2)
|
||||
message(FATAL_ERROR "The test ${test_components} appears to have been specified without a namespace, i.e.:\ly_add_googletest/benchmark(NAME ${test_components})\nInstead of (perhaps):\ly_add_googletest/benchmark(NAME Gem::${test_components})\nPlease add the missing namespace before proceeding.")
|
||||
endif()
|
||||
|
||||
list(GET test_components 0 test_namespace)
|
||||
list(GET test_components 1 test_name)
|
||||
set(${TEST_NAMESPACE} ${test_namespace} PARENT_SCOPE)
|
||||
set(${TEST_NAME} ${test_name} PARENT_SCOPE)
|
||||
set(${TEST_COMMAND} ${test_command} PARENT_SCOPE)
|
||||
endfunction()
|
||||
|
||||
#! ly_test_impact_extract_python_test_params: extracts the python test name and relative script path parameters.
|
||||
#
|
||||
# \arg:COMPOSITE_TEST test in form 'namespace::test' or 'test'
|
||||
# \arg:TEST_NAME name of test
|
||||
# \arg:SCRIPT_PATH name of test
|
||||
function(ly_test_impact_extract_python_test_params COMPOSITE_TEST TEST_NAME SCRIPT_PATH)
|
||||
get_property(script_path GLOBAL PROPERTY LY_ALL_TESTS_${COMPOSITE_TEST}_SCRIPT_PATH)
|
||||
|
||||
# namespace is optional, in which case this component will be simply the test name
|
||||
string(REPLACE "::" ";" test_components ${COMPOSITE_TEST})
|
||||
list(LENGTH test_components num_test_components)
|
||||
if(num_test_components GREATER 1)
|
||||
list(GET test_components 1 test_name)
|
||||
else()
|
||||
set(test_name ${test_components})
|
||||
endif()
|
||||
|
||||
# Get python script path relative to repo root
|
||||
ly_test_impact_rebase_file_to_repo_root(
|
||||
${test_file}
|
||||
test_file
|
||||
${script_path}
|
||||
script_path
|
||||
${LY_ROOT_FOLDER}
|
||||
)
|
||||
|
||||
set(${TEST_NAMESPACE} ${test_namespace} PARENT_SCOPE)
|
||||
set(${TEST_NAME} ${test_name} PARENT_SCOPE)
|
||||
set(${TEST_FILE} ${test_file} PARENT_SCOPE)
|
||||
set(${SCRIPT_PATH} ${script_path} PARENT_SCOPE)
|
||||
endfunction()
|
||||
|
||||
#! ly_test_impact_write_test_enumeration_file: exports the master test lists to file.
|
||||
@@ -164,25 +200,26 @@ function(ly_test_impact_write_test_enumeration_file TEST_ENUMERATION_TEMPLATE_FI
|
||||
message(TRACE "Parsing ${test}")
|
||||
get_property(test_type GLOBAL PROPERTY LY_ALL_TESTS_${test}_TEST_LIBRARY)
|
||||
get_property(test_suite GLOBAL PROPERTY LY_ALL_TESTS_${test}_TEST_SUITE)
|
||||
get_property(test_timeout GLOBAL PROPERTY LY_ALL_TESTS_${test}_TEST_TIMEOUT)
|
||||
if("${test_type}" STREQUAL "pytest")
|
||||
# Python tests
|
||||
ly_test_impact_extract_python_test(${test} test_namespace test_name test_file)
|
||||
list(APPEND python_tests " { \"name\": \"${test_name}\", \"namespace\": \"${test_namespace}\", \"suite\": \"${test_suite}\", \"path\": \"${test_file}\" }")
|
||||
ly_test_impact_extract_python_test_params(${test} test_name script_path)
|
||||
list(APPEND python_tests " { \"name\": \"${test_name}\", \"suite\": \"${test_suite}\", \"script\": \"${script_path}\", \"timeout\":${test_timeout} }")
|
||||
elseif("${test_type}" STREQUAL "pytest_editor")
|
||||
# Python editor tests
|
||||
ly_test_impact_extract_python_test(${test} test_namespace test_name test_file)
|
||||
list(APPEND python_editor_tests " { \"name\": \"${test_name}\", \"namespace\": \"${test_namespace}\", \"suite\": \"${test_suite}\", \"path\": \"${test_file}\" }")
|
||||
ly_test_impact_extract_python_test_params(${test} test_name script_path)
|
||||
list(APPEND python_editor_tests " { \"name\": \"${test_name}\", \"suite\": \"${test_suite}\", \"script\": \"${script_path}\", \"timeout\":${test_timeout} }")
|
||||
elseif("${test_type}" STREQUAL "googletest")
|
||||
# Google tests
|
||||
ly_test_impact_extract_google_test(${test} test_namespace test_name)
|
||||
ly_test_impact_extract_google_test_params(${test} test_name test_command)
|
||||
ly_test_impact_get_test_launch_method(${test_name} launch_method)
|
||||
list(APPEND google_tests " { \"name\": \"${test_name}\", \"namespace\": \"${test_namespace}\", \"suite\": \"${test_suite}\", \"launch_method\": \"${launch_method}\" }")
|
||||
list(APPEND google_tests " { \"name\": \"${test_name}\", \"suite\": \"${test_suite}\", \"command\": \"${test_command}\", \"timeout\":${test_timeout}, \"launch_method\": \"${launch_method}\" }")
|
||||
elseif("${test_type}" STREQUAL "googlebenchmark")
|
||||
# Google benchmarks
|
||||
ly_test_impact_extract_google_test(${test} test_namespace test_name)
|
||||
list(APPEND google_benchmarks " { \"name\": \"${test_name}\", \"namespace\": \"${test_namespace}\", \"suite\": \"${test_suite}\" }")
|
||||
ly_test_impact_extract_google_test_params(${test} test_name test_command)
|
||||
list(APPEND google_benchmarks " { \"name\": \"${test_name}\", \"suite\": \"${test_suite}\", \"command\": \"${test_command}\", \"timeout\":${test_timeout} }")
|
||||
else()
|
||||
message("${test} is of unknown type (TEST_LIBRARY property is empty)")
|
||||
message("${test_name} is of unknown type (TEST_LIBRARY property is empty)")
|
||||
list(APPEND unknown_tests " { \"name\": \"${test}\" }")
|
||||
endif()
|
||||
endforeach()
|
||||
@@ -242,12 +279,7 @@ function(ly_test_impact_export_source_target_mappings MAPPING_TEMPLATE_FILE)
|
||||
endif()
|
||||
|
||||
# Static source file mappings
|
||||
get_target_property(target_type ${target} TYPE)
|
||||
if("${target_type}" STREQUAL "INTERFACE_LIBRARY")
|
||||
get_target_property(static_sources ${target}_HEADERS SOURCES)
|
||||
else()
|
||||
get_target_property(static_sources ${target} SOURCES)
|
||||
endif()
|
||||
get_target_property(static_sources ${target} SOURCES)
|
||||
|
||||
# Rebase static source files to repo root
|
||||
ly_test_impact_rebase_files_to_repo_root(
|
||||
@@ -271,75 +303,52 @@ endfunction()
|
||||
#
|
||||
# \arg:CONFIG_TEMPLATE_FILE path to the runtime configuration template file
|
||||
# \arg:PERSISTENT_DATA_DIR path to the test impact framework persistent data directory
|
||||
# \arg:RUNTIME_BIN_DIR path to repo binary ourput directory
|
||||
function(ly_test_impact_write_config_file CONFIG_TEMPLATE_FILE PERSISTENT_DATA_DIR RUNTIME_BIN_DIR)
|
||||
set(repo_dir ${LY_ROOT_FOLDER})
|
||||
# \arg:BIN_DIR path to repo binary output directory
|
||||
function(ly_test_impact_write_config_file CONFIG_TEMPLATE_FILE PERSISTENT_DATA_DIR BIN_DIR)
|
||||
# Platform this config file is being generated for
|
||||
set(platform ${PAL_PLATFORM_NAME})
|
||||
|
||||
# SparTIA instrumentation binary
|
||||
# Timestamp this config file was generated at
|
||||
string(TIMESTAMP timestamp "%Y-%m-%d %H:%M:%S")
|
||||
|
||||
# Instrumentation binary
|
||||
if(NOT LY_TEST_IMPACT_INSTRUMENTATION_BIN)
|
||||
message(FATAL_ERROR "No test impact framework instrumentation binary was specified, please provide the path with option LY_TEST_IMPACT_INSTRUMENTATION_BIN")
|
||||
endif()
|
||||
file(TO_CMAKE_PATH ${LY_TEST_IMPACT_INSTRUMENTATION_BIN} instrumentation_bin)
|
||||
|
||||
# test impact framework working dir
|
||||
ly_test_impact_rebase_file_to_repo_root(
|
||||
${LY_TEST_IMPACT_WORKING_DIR}
|
||||
working_dir
|
||||
${LY_ROOT_FOLDER}
|
||||
)
|
||||
|
||||
# test impact framework console binary dir
|
||||
ly_test_impact_rebase_file_to_repo_root(
|
||||
${RUNTIME_BIN_DIR}
|
||||
runtime_bin_dir
|
||||
${LY_ROOT_FOLDER}
|
||||
)
|
||||
|
||||
# Test dir
|
||||
ly_test_impact_rebase_file_to_repo_root(
|
||||
"${PERSISTENT_DATA_DIR}/Tests"
|
||||
tests_dir
|
||||
${LY_ROOT_FOLDER}
|
||||
)
|
||||
# Testrunner binary
|
||||
set(test_runner_bin $<TARGET_FILE:AzTestRunner>)
|
||||
|
||||
# Repository root
|
||||
set(repo_dir ${LY_ROOT_FOLDER})
|
||||
|
||||
# Test impact framework output binary dir
|
||||
set(bin_dir ${BIN_DIR})
|
||||
|
||||
# Temp dir
|
||||
ly_test_impact_rebase_file_to_repo_root(
|
||||
"${LY_TEST_IMPACT_TEMP_DIR}"
|
||||
temp_dir
|
||||
${LY_ROOT_FOLDER}
|
||||
)
|
||||
|
||||
set(temp_dir "${LY_TEST_IMPACT_TEMP_DIR}")
|
||||
|
||||
# Persistent dir
|
||||
set(persistent_dir "${PERSISTENT_DATA_DIR}")
|
||||
|
||||
# Source to target mappings dir
|
||||
ly_test_impact_rebase_file_to_repo_root(
|
||||
"${LY_TEST_IMPACT_SOURCE_TARGET_MAPPING_DIR}"
|
||||
source_target_mapping_dir
|
||||
${LY_ROOT_FOLDER}
|
||||
)
|
||||
set(source_target_mapping_dir "${LY_TEST_IMPACT_SOURCE_TARGET_MAPPING_DIR}")
|
||||
|
||||
# Test type artifact dir
|
||||
ly_test_impact_rebase_file_to_repo_root(
|
||||
"${LY_TEST_IMPACT_TEST_TYPE_DIR}"
|
||||
test_type_dir
|
||||
${LY_ROOT_FOLDER}
|
||||
)
|
||||
# Test type artifact file
|
||||
set(test_target_type_file "${LY_TEST_IMPACT_TEST_TYPE_FILE}")
|
||||
|
||||
# Build dependency artifact dir
|
||||
ly_test_impact_rebase_file_to_repo_root(
|
||||
"${LY_TEST_IMPACT_TARGET_DEPENDENCY_DIR}"
|
||||
target_dependency_dir
|
||||
${LY_ROOT_FOLDER}
|
||||
)
|
||||
set(target_dependency_dir "${LY_TEST_IMPACT_TARGET_DEPENDENCY_DIR}")
|
||||
|
||||
# Substitute config file template with above vars
|
||||
file(READ "${CONFIG_TEMPLATE_FILE}" config_file)
|
||||
string(CONFIGURE ${config_file} config_file)
|
||||
|
||||
# Write out entire config contents to a file in the build directory of the test impact framework console target
|
||||
string(TIMESTAMP timestamp "%Y-%m-%d %H:%M:%S")
|
||||
set(header "# Test Impact Framework configuration file for Lumberyard\n# Platform: ${CMAKE_SYSTEM_NAME}\n# Build: $<CONFIG>\n# ${timestamp}")
|
||||
file(GENERATE
|
||||
OUTPUT "${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/$<CONFIG>/$<TARGET_FILE_BASE_NAME:${LY_TEST_IMPACT_CONSOLE_TARGET}>.$<CONFIG>.cfg"
|
||||
CONTENT "${header}\n\n${config_file}"
|
||||
OUTPUT "${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/$<CONFIG>/$<TARGET_FILE_BASE_NAME:${LY_TEST_IMPACT_CONSOLE_TARGET}>.$<CONFIG>.json"
|
||||
CONTENT ${config_file}
|
||||
)
|
||||
endfunction()
|
||||
|
||||
@@ -353,7 +362,7 @@ function(ly_test_impact_post_step)
|
||||
set(persistent_data_dir "${LY_ROOT_FOLDER}/Tests/test_impact_framework/${CMAKE_SYSTEM_NAME}/$<CONFIG>")
|
||||
|
||||
# Directory for binaries built for this profile
|
||||
set(runtime_bin_dir "${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/$<CONFIG>")
|
||||
set(bin_dir "${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/$<CONFIG>")
|
||||
|
||||
# Erase any existing non-persistent data to avoid getting test impact framework out of sync with current repo state
|
||||
file(REMOVE_RECURSE "${LY_TEST_IMPACT_WORKING_DIR}")
|
||||
@@ -372,7 +381,7 @@ function(ly_test_impact_post_step)
|
||||
ly_test_impact_write_config_file(
|
||||
"cmake/TestImpactFramework/ConsoleFrontendConfig.in"
|
||||
${persistent_data_dir}
|
||||
${runtime_bin_dir}
|
||||
${bin_dir}
|
||||
)
|
||||
|
||||
# Copy over the graphviz options file for the build dependency graphs
|
||||
@@ -380,6 +389,6 @@ function(ly_test_impact_post_step)
|
||||
file(COPY "cmake/TestImpactFramework/CMakeGraphVizOptions.cmake" DESTINATION ${CMAKE_BINARY_DIR})
|
||||
|
||||
# Set the above config file as the default config file to use for the test impact framework console target
|
||||
target_compile_definitions(${LY_TEST_IMPACT_CONSOLE_TARGET} PRIVATE "LY_TEST_IMPACT_DEFAULT_CONFIG_FILE=\"$<TARGET_FILE_BASE_NAME:${LY_TEST_IMPACT_CONSOLE_TARGET}>.$<CONFIG>.cfg\"")
|
||||
target_compile_definitions(${LY_TEST_IMPACT_CONSOLE_STATIC_TARGET} PUBLIC "LY_TEST_IMPACT_DEFAULT_CONFIG_FILE=\"${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/$<CONFIG>/$<TARGET_FILE_BASE_NAME:${LY_TEST_IMPACT_CONSOLE_TARGET}>.$<CONFIG>.json\"")
|
||||
message(DEBUG "Test impact framework post steps complete")
|
||||
endfunction()
|
||||
Reference in New Issue
Block a user