Merge pull request #5531 from aws-lumberyard-dev/linux_ar
Enable python-based tests in Linux AR
This commit is contained in:
@@ -13,7 +13,10 @@ import os
|
||||
import pytest
|
||||
import subprocess
|
||||
|
||||
import ly_test_tools
|
||||
|
||||
|
||||
@pytest.mark.skipif(not ly_test_tools.WINDOWS, reason="Only succeeds on windows https://github.com/o3de/o3de/issues/5539")
|
||||
@pytest.mark.SUITE_smoke
|
||||
class TestCLIToolSerializeContextToolsWorks(object):
|
||||
def test_CLITool_SerializeContextTools_Works(self, build_directory):
|
||||
|
||||
@@ -11,10 +11,13 @@ Test should run in both gpu and non gpu
|
||||
import pytest
|
||||
import os
|
||||
from automatedtesting_shared.base import TestAutomationBase
|
||||
|
||||
import ly_test_tools
|
||||
import ly_test_tools.environment.file_system as file_system
|
||||
|
||||
|
||||
@pytest.mark.SUITE_smoke
|
||||
@pytest.mark.skipif(not ly_test_tools.WINDOWS, reason="Only succeeds on windows https://github.com/o3de/o3de/issues/5539")
|
||||
@pytest.mark.parametrize("launcher_platform", ["windows_editor"])
|
||||
@pytest.mark.parametrize("project", ["AutomatedTesting"])
|
||||
@pytest.mark.parametrize("level", ["temp_level"])
|
||||
|
||||
@@ -20,6 +20,7 @@ _PROCESS_OUTPUT_ENCODING = 'utf-8'
|
||||
|
||||
# Default list of processes names to kill
|
||||
LY_PROCESS_KILL_LIST = [
|
||||
'AssetBuilder', 'AssetProcessor', 'AssetProcessorBatch',
|
||||
'CrySCompileServer', 'Editor',
|
||||
'Profiler', 'RemoteConsole',
|
||||
'rc' # Resource Compiler
|
||||
@@ -376,18 +377,18 @@ def _safe_kill_processes(processes):
|
||||
logger.info(f"Terminating process '{proc.name()}' with id '{proc.pid}'")
|
||||
proc.kill()
|
||||
except psutil.AccessDenied:
|
||||
logger.warning("Termination failed, Access Denied", exc_info=True)
|
||||
logger.warning("Termination failed, Access Denied with stacktrace:", exc_info=True)
|
||||
except psutil.NoSuchProcess:
|
||||
logger.debug("Termination request ignored, process was already terminated during iteration", exc_info=True)
|
||||
logger.debug("Termination request ignored, process was already terminated during iteration with stacktrace:", exc_info=True)
|
||||
except Exception: # purposefully broad
|
||||
logger.warning("Unexpected exception ignored while terminating process", exc_info=True)
|
||||
logger.debug("Unexpected exception ignored while terminating process, with stacktrace:", exc_info=True)
|
||||
|
||||
def on_terminate(proc):
|
||||
logger.info(f"process '{proc.name()}' with id '{proc.pid}' terminated with exit code {proc.returncode}")
|
||||
try:
|
||||
psutil.wait_procs(processes, timeout=30, callback=on_terminate)
|
||||
except Exception: # purposefully broad
|
||||
logger.warning("Unexpected exception while waiting for processes to terminate", exc_info=True)
|
||||
logger.debug("Unexpected exception while waiting for processes to terminate, with stacktrace:", exc_info=True)
|
||||
|
||||
|
||||
def _terminate_and_confirm_dead(proc):
|
||||
|
||||
@@ -74,9 +74,9 @@ class TestEditorTestUtils(unittest.TestCase):
|
||||
def test_RetrieveCrashOutput_CrashLogNotExists_ReturnsError(self, mock_retrieve_log_path):
|
||||
mock_retrieve_log_path.return_value = 'mock_log_path'
|
||||
mock_workspace = mock.MagicMock()
|
||||
expected = "-- No crash log available --\n[Errno 2] No such file or directory: 'mock_log_path\\\\error.log'"
|
||||
error_message = "No crash log available"
|
||||
|
||||
assert expected == editor_test_utils.retrieve_crash_output(0, mock_workspace, 0)
|
||||
assert error_message in editor_test_utils.retrieve_crash_output(0, mock_workspace, 0)
|
||||
|
||||
@mock.patch('os.path.getmtime', mock.MagicMock())
|
||||
@mock.patch('os.rename')
|
||||
|
||||
@@ -371,15 +371,15 @@ class TestProcessMatching(unittest.TestCase):
|
||||
mock_log_warn.assert_called()
|
||||
|
||||
@mock.patch('psutil.wait_procs')
|
||||
@mock.patch('logging.Logger.warning')
|
||||
def test_SafeKillProcList_RaisesError_NoRaiseAndLogsError(self, mock_log_warn, mock_wait_procs):
|
||||
@mock.patch('logging.Logger.debug')
|
||||
def test_SafeKillProcList_RaisesError_NoRaiseAndLogsError(self, mock_log, mock_wait_procs):
|
||||
mock_wait_procs.side_effect = psutil.PermissionError()
|
||||
proc_mock = mock.MagicMock()
|
||||
|
||||
process_utils._safe_kill_processes(proc_mock)
|
||||
|
||||
mock_wait_procs.assert_called()
|
||||
mock_log_warn.assert_called()
|
||||
mock_log.assert_called()
|
||||
|
||||
@mock.patch('psutil.process_iter')
|
||||
@mock.patch('logging.Logger.debug')
|
||||
|
||||
@@ -23,7 +23,7 @@ ly_set(PAL_TRAIT_PROF_PIX_SUPPORTED FALSE)
|
||||
# Test library support
|
||||
ly_set(PAL_TRAIT_TEST_GOOGLE_TEST_SUPPORTED TRUE)
|
||||
ly_set(PAL_TRAIT_TEST_GOOGLE_BENCHMARK_SUPPORTED TRUE)
|
||||
ly_set(PAL_TRAIT_TEST_LYTESTTOOLS_SUPPORTED FALSE)
|
||||
ly_set(PAL_TRAIT_TEST_LYTESTTOOLS_SUPPORTED TRUE)
|
||||
ly_set(PAL_TRAIT_TEST_PYTEST_SUPPORTED TRUE)
|
||||
ly_set(PAL_TRAIT_TEST_TARGET_TYPE MODULE)
|
||||
|
||||
|
||||
@@ -83,7 +83,7 @@
|
||||
"CMAKE_OPTIONS": "-G 'Ninja Multi-Config' -DCMAKE_C_COMPILER=clang-12 -DCMAKE_CXX_COMPILER=clang++-12 -DLY_PARALLEL_LINK_JOBS=4",
|
||||
"CMAKE_LY_PROJECTS": "AutomatedTesting",
|
||||
"CMAKE_TARGET": "all",
|
||||
"CTEST_OPTIONS": "-E Gem::EMotionFX.Editor.Tests -LE (SUITE_sandbox|SUITE_awsi) -L FRAMEWORK_googletest --no-tests=error",
|
||||
"CTEST_OPTIONS": "-E (AutomatedTesting::Atom_TestSuite_Main|AutomatedTesting::PhysicsTests_Main|AutomatedTesting::PrefabTests|AutomatedTesting::TerrainTests_Main|Gem::EMotionFX.Editor.Tests) -L (SUITE_smoke|SUITE_main) -LE (REQUIRES_gpu) --no-tests=error",
|
||||
"TEST_RESULTS": "True"
|
||||
}
|
||||
},
|
||||
@@ -96,7 +96,7 @@
|
||||
"CMAKE_OPTIONS": "-G 'Ninja Multi-Config' -DCMAKE_C_COMPILER=clang-12 -DCMAKE_CXX_COMPILER=clang++-12 -DLY_UNITY_BUILD=FALSE -DLY_PARALLEL_LINK_JOBS=4",
|
||||
"CMAKE_LY_PROJECTS": "AutomatedTesting",
|
||||
"CMAKE_TARGET": "all",
|
||||
"CTEST_OPTIONS": "-E Gem::EMotionFX.Editor.Tests -LE (SUITE_sandbox|SUITE_awsi) -L FRAMEWORK_googletest --no-tests=error",
|
||||
"CTEST_OPTIONS": "-E (AutomatedTesting::Atom_TestSuite_Main|AutomatedTesting::PhysicsTests_Main|AutomatedTesting::PrefabTests|AutomatedTesting::TerrainTests_Main|Gem::EMotionFX.Editor.Tests) -L (SUITE_smoke|SUITE_main) -LE (REQUIRES_gpu) --no-tests=error",
|
||||
"TEST_RESULTS": "True"
|
||||
}
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user