Merge branch 'main' into LoadPipelineFromGitHub

This commit is contained in:
Brian Herrera
2021-03-26 17:05:57 -07:00
765 changed files with 11513 additions and 20246 deletions
+2 -14
View File
@@ -19,7 +19,8 @@ ly_add_pytest(
COMPONENT TestTools
)
if(PAL_TRAIT_BUILD_HOST_TOOLS AND PAL_TRAIT_BUILD_TESTS_SUPPORTED AND AutomatedTesting IN_LIST LY_PROJECTS_NAME)
get_property(LY_PROJECTS_TARGET_NAME GLOBAL PROPERTY LY_PROJECTS_TARGET_NAME)
if(PAL_TRAIT_BUILD_HOST_TOOLS AND PAL_TRAIT_BUILD_TESTS_SUPPORTED AND AutomatedTesting IN_LIST LY_PROJECTS_TARGET_NAME)
# Integration tests.
ly_add_pytest(
NAME LyTestTools_IntegTests_Sanity_smoke_no_gpu
@@ -43,19 +44,6 @@ if(PAL_TRAIT_BUILD_HOST_TOOLS AND PAL_TRAIT_BUILD_TESTS_SUPPORTED AND AutomatedT
COMPONENT TestTools
)
ly_add_pytest(
NAME LyTestTools_IntegTests_Settings_smoke_no_gpu
PATH ${CMAKE_CURRENT_LIST_DIR}/integ/test_settings.py
TEST_SERIAL
TEST_SUITE smoke
RUNTIME_DEPENDENCIES
AssetProcessor
AutomatedTesting.GameLauncher
AutomatedTesting.Assets
Legacy::CryRenderNULL
COMPONENT TestTools
)
# Regression tests.
ly_add_pytest(
NAME LyTestTools_IntegTests_RegressionTests_periodic_no_gpu
@@ -1,52 +0,0 @@
"""
All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
its licensors.
For complete copyright and license terms please see the LICENSE at the root of this
distribution (the "License"). All use of this software is governed by the License,
or, if provided, by the license below or the license accompanying this file. Do not
remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
"""
import filecmp
import os
import pytest
pytestmark = pytest.mark.SUITE_smoke
class TestLySettings(object):
@pytest.mark.parametrize("project", ["AutomatedTesting"])
@pytest.mark.parametrize("wait_for_connect", [1234, 4567])
def test_BootstrapSettings_BackupModifyRestore_SettingsMatch(self, workspace, wait_for_connect):
backup_path = workspace.tmp_path
# create backup
workspace.settings.backup_bootstrap_settings(backup_path)
# verify files match
bootstrap_settings = workspace.paths.bootstrap_config_file()
bootstrap_settings_backup = os.path.join(backup_path, '{}.bak'.format(os.path.basename(bootstrap_settings)))
assert os.path.exists(bootstrap_settings), "Bootstrap settings file does not exist"
assert os.path.exists(bootstrap_settings_backup), "Bootstrap settings backup does not exist"
assert filecmp.cmp(bootstrap_settings, bootstrap_settings_backup), "Bootstrap settings and backup do not match"
# modify settings
workspace.settings.modify_bootstrap_setting('remote_filesystem', 0)
workspace.settings.modify_bootstrap_setting('wait_for_connect', wait_for_connect)
workspace.settings.modify_bootstrap_setting('remote_ip', '0.36.27.18')
workspace.settings.modify_bootstrap_setting('additional_setting', 'value1')
# verify files are different
assert not filecmp.cmp(bootstrap_settings, bootstrap_settings_backup), "Modified bootstrap settings and backup" \
" are equal, they should be different"
# restore backup
workspace.settings.restore_bootstrap_settings(backup_path)
# verify files match
assert filecmp.cmp(bootstrap_settings, bootstrap_settings_backup), "Restored bootstrap settings and backup " \
"are different, they should be equal"
@@ -134,7 +134,7 @@ class TestAbstractResourceLocator(object):
def test_Cache_IsCalled_ReturnsCachePath(self):
mock_abstract_resource_locator = abstract_resource_locator.AbstractResourceLocator(
mock_build_directory, mock_project)
expected_path = os.path.join(mock_abstract_resource_locator.dev(), 'Cache')
expected_path = os.path.join(mock_abstract_resource_locator.cache())
assert mock_abstract_resource_locator.cache() == expected_path
@@ -178,7 +178,7 @@ class TestAbstractResourceLocator(object):
def test_AssetProcessorConfigFile_IsCalled_ReturnsAssetProcessorConfigFilePath(self):
mock_abstract_resource_locator = abstract_resource_locator.AbstractResourceLocator(
mock_build_directory, mock_project)
expected_path = os.path.join(mock_abstract_resource_locator.dev(), 'AssetProcessorPlatformConfig.ini')
expected_path = os.path.join(mock_abstract_resource_locator.dev(), 'AssetProcessorPlatformConfig.setreg')
assert mock_abstract_resource_locator.asset_processor_config_file() == expected_path
@@ -60,7 +60,7 @@ class TestAssetProcessor(object):
under_test.start(connect_to_ap=True)
assert under_test._ap_proc is not None
mock_popen.assert_called_once_with([mock_ap_path, '--zeroAnalysisMode', '--gamefolder', 'AutomatedTesting',
mock_popen.assert_called_once_with([mock_ap_path, '--zeroAnalysisMode', '--regset="/Amazon/AzCore/Bootstrap/project_path=AutomatedTesting"',
'--acceptInput', '--platforms', 'bar'], cwd=os.path.dirname(mock_ap_path))
mock_connect.assert_called()
@@ -105,8 +105,8 @@ class TestAssetProcessor(object):
@mock.patch('ly_test_tools._internal.managers.workspace.AbstractWorkspaceManager')
@mock.patch('subprocess.run')
def test_BatchProcess_NoFastscanBatchCompletes_Success(self, mock_run, mock_workspace):
under_test = ly_test_tools.lumberyard.asset_processor.AssetProcessor(mock_workspace)
mock_workspace.project = None
under_test = ly_test_tools.lumberyard.asset_processor.AssetProcessor(mock_workspace)
apb_path = mock_workspace.paths.asset_processor_batch()
mock_run.return_value.returncode = 0
result, _ = under_test.batch_process(1, False)
@@ -118,23 +118,23 @@ class TestAssetProcessor(object):
@mock.patch('ly_test_tools._internal.managers.workspace.AbstractWorkspaceManager')
@mock.patch('subprocess.run')
def test_BatchProcess_FastscanBatchCompletes_Success(self, mock_run, mock_workspace):
under_test = ly_test_tools.lumberyard.asset_processor.AssetProcessor(mock_workspace)
mock_workspace.project = 'AutomatedTesting'
under_test = ly_test_tools.lumberyard.asset_processor.AssetProcessor(mock_workspace)
apb_path = mock_workspace.paths.asset_processor_batch()
mock_run.return_value.returncode = 0
result = under_test.batch_process(1, True)
assert result
mock_run.assert_called_once_with([apb_path, '--zeroAnalysisMode', '--gamefolder', 'AutomatedTesting'],
mock_run.assert_called_once_with([apb_path, '--zeroAnalysisMode', '--regset="/Amazon/AzCore/Bootstrap/project_path=AutomatedTesting"'],
close_fds=True, capture_output=False,
timeout=1)
@mock.patch('ly_test_tools._internal.managers.workspace.AbstractWorkspaceManager')
@mock.patch('subprocess.run')
def test_BatchProcess_ReturnCodeFail_Failure(self, mock_run, mock_workspace):
under_test = ly_test_tools.lumberyard.asset_processor.AssetProcessor(mock_workspace)
mock_workspace.project = None
under_test = ly_test_tools.lumberyard.asset_processor.AssetProcessor(mock_workspace)
apb_path = mock_workspace.paths.asset_processor_batch()
mock_run.return_value.returncode = 1
@@ -145,42 +145,11 @@ class TestAssetProcessor(object):
@mock.patch('ly_test_tools._internal.managers.workspace.AbstractWorkspaceManager')
@mock.patch('os.path.isfile')
@mock.patch('ly_test_tools.lumberyard.asset_processor.file_system.unlock_file')
def test_EnableAssetProcessorPlatform_PlatformInConfig_ConfigUpdated(self, mock_unlock, mock_isfile,
mock_workspace):
mock_isfile.return_value = True
def test_EnableAssetProcessorPlatform_AssetProcessorObject_Updated(self, mock_workspace):
under_test = ly_test_tools.lumberyard.asset_processor.AssetProcessor(mock_workspace)
apconfig_path = mock_workspace.paths.asset_processor_config_file()
mock_config_content = '[Platforms]\n;foo\n;bar\n[Other]\nsomething\n'
mock_open_config = mock.mock_open(read_data=mock_config_content)
patcher = mock.patch('builtins.open', mock_open_config)
patcher.start()
under_test.enable_asset_processor_platform('foo')
mock_unlock.assert_called_once_with(apconfig_path)
mock_open_config.assert_called_once_with(apconfig_path, 'r+')
file_handle = mock_open_config()
file_handle.writelines.assert_called_once_with(['[Platforms]\n', 'foo\n', ';bar\n', '[Other]\n', 'something\n'])
patcher.stop()
@mock.patch('ly_test_tools._internal.managers.workspace.AbstractWorkspaceManager')
@mock.patch('os.path.isfile')
@mock.patch('ly_test_tools.lumberyard.asset_processor.file_system.unlock_file')
def test_EnableAssetProcessorPlatform_FileDoesNotExist_ErrorRaised(self, mock_unlock, mock_isfile, mock_workspace):
mock_isfile.return_value = False
under_test = ly_test_tools.lumberyard.asset_processor.AssetProcessor(mock_workspace)
apconfig_path = mock_workspace.paths.asset_processor_config_file()
with pytest.raises(IOError):
under_test.enable_asset_processor_platform('foo')
mock_isfile.assert_called_once_with(apconfig_path)
mock_unlock.assert_not_called()
assert "foo" in under_test._enabled_platform_overrides
@mock.patch('ly_test_tools._internal.managers.workspace.AbstractWorkspaceManager')
def test_BackupAPSettings_Called_CallsBackupAPSettings(self, mock_workspace):
@@ -234,7 +234,6 @@ class TestAndroidLauncher:
mock_workspace.shader_compiler.stop.assert_called_once()
@mock.patch('ly_test_tools.launchers.platforms.base.Launcher._config_ini_to_dict')
@mock.patch('ly_test_tools.lumberyard.settings.LySettings.modify_bootstrap_setting', mock.MagicMock)
@mock.patch('ly_test_tools.lumberyard.settings.LySettings.modify_platform_setting', mock.MagicMock)
def test_ConfigureSettings_DefaultValues_SetsValues(self, mock_config):
mock_config.return_value = VALID_ANDROID_CONFIG
@@ -243,7 +242,6 @@ class TestAndroidLauncher:
launcher = ly_test_tools.launchers.AndroidLauncher(mock_workspace, ["dummy"])
launcher.configure_settings()
assert mock_workspace.settings.modify_bootstrap_setting.call_count == 6
assert mock_workspace.settings.modify_platform_setting.call_count == 8
@mock.patch('ly_test_tools.launchers.platforms.base.Launcher._config_ini_to_dict')
@@ -59,7 +59,7 @@ class TestMacResourceLocator(object):
def test_ProjectLog_HasPath_ReturnsPath(self):
expected = os.path.join(
mac_resource_locator.platform_cache(),
mac_resource_locator.project(),
'user',
'log')
@@ -67,7 +67,7 @@ class TestMacResourceLocator(object):
def test_ProjectScreenshots_HasPath_ReturnsPath(self):
expected = os.path.join(
mac_resource_locator.platform_cache(),
mac_resource_locator.project(),
'user',
'ScreenShots')
@@ -64,7 +64,7 @@ class TestWindowsResourceLocator(object):
def test_ProjectLog_HasPath_ReturnsPath(self):
expected = os.path.join(
windows_resource_locator.platform_cache(),
windows_resource_locator.project(),
'user',
'log')
@@ -72,7 +72,7 @@ class TestWindowsResourceLocator(object):
def test_ProjectScreenshots_HasPath_ReturnsPath(self):
expected = os.path.join(
windows_resource_locator.platform_cache(),
windows_resource_locator.project(),
'user',
'ScreenShots')