Found actual issue where the logs were being routed to the artifact folder
Signed-off-by: evanchia <evanchia@amazon.com>
This commit is contained in:
@@ -771,7 +771,8 @@ class EditorTestSuite():
|
||||
output = editor.get_output()
|
||||
return_code = editor.get_returncode()
|
||||
editor_log_content = editor_utils.retrieve_editor_log_content(run_id, log_name, workspace)
|
||||
|
||||
# Save the editor log
|
||||
workspace.artifact_manager.save_artifact(os.path.join(editor_utils.retrieve_log_path(), log_name))
|
||||
if return_code == 0:
|
||||
test_result = Result.Pass.create(test_spec, output, editor_log_content)
|
||||
else:
|
||||
@@ -779,6 +780,9 @@ class EditorTestSuite():
|
||||
if has_crashed:
|
||||
test_result = Result.Crash.create(test_spec, output, return_code, editor_utils.retrieve_crash_output
|
||||
(run_id, workspace, self._TIMEOUT_CRASH_LOG), None)
|
||||
# Save the crash log
|
||||
crash_file_name = os.path.basename(workspace.paths.crash_log())
|
||||
workspace.artifact_manager.save_artifact(os.path.join(editor_utils.retrieve_log_path(), crash_file_name))
|
||||
editor_utils.cycle_crash_report(run_id, workspace)
|
||||
else:
|
||||
test_result = Result.Fail.create(test_spec, output, editor_log_content)
|
||||
@@ -842,7 +846,8 @@ class EditorTestSuite():
|
||||
output = editor.get_output()
|
||||
return_code = editor.get_returncode()
|
||||
editor_log_content = editor_utils.retrieve_editor_log_content(run_id, log_name, workspace)
|
||||
|
||||
# Save the editor log
|
||||
workspace.artifact_manager.save_artifact(os.path.join(editor_utils.retrieve_log_path(), log_name))
|
||||
if return_code == 0:
|
||||
# No need to scrap the output, as all the tests have passed
|
||||
for test_spec in test_spec_list:
|
||||
@@ -863,6 +868,10 @@ class EditorTestSuite():
|
||||
# The first test with "Unknown" result (no data in output) is likely the one that crashed
|
||||
crash_error = editor_utils.retrieve_crash_output(run_id, workspace,
|
||||
self._TIMEOUT_CRASH_LOG)
|
||||
# Save the crash log
|
||||
crash_file_name = os.path.basename(workspace.paths.crash_log())
|
||||
workspace.artifact_manager.save_artifact(
|
||||
os.path.join(editor_utils.retrieve_log_path(), crash_file_name))
|
||||
editor_utils.cycle_crash_report(run_id, workspace)
|
||||
results[test_spec_name] = Result.Crash.create(result.test_spec, output, return_code,
|
||||
crash_error, result.editor_log)
|
||||
|
||||
@@ -71,15 +71,9 @@ def retrieve_crash_output(run_id: int, workspace: AbstractWorkspaceManager, time
|
||||
:return str: The contents of the editor crash file (error.log)
|
||||
"""
|
||||
crash_info = "-- No crash log available --"
|
||||
error_log_regex = ""
|
||||
log_path = retrieve_log_path(run_id, workspace)
|
||||
# Gather all of the files in the log directory
|
||||
dir_files = [f for f in os.listdir(log_path) if os.path.isfile(os.path.join(log_path, f))]
|
||||
for file_name in dir_files:
|
||||
# Search for all .log files with either "crash" or "error" because they could be renamed
|
||||
if ("error" in file_name.lower() or "crash" in file_name.lower()) and (file_name.endswith(".log")):
|
||||
crash_log = os.path.join(log_path, file_name)
|
||||
break
|
||||
# Grab the file name of the crash log which can be different depending on platform
|
||||
crash_file_name = os.path.basename(workspace.paths.crash_log())
|
||||
crash_log = os.path.join(retrieve_log_path(run_id, workspace), crash_file_name)
|
||||
try:
|
||||
waiter.wait_for(lambda: os.path.exists(crash_log), timeout=timeout)
|
||||
except AssertionError:
|
||||
@@ -100,7 +94,7 @@ def cycle_crash_report(run_id: int, workspace: AbstractWorkspaceManager) -> None
|
||||
:param workspace: Workspace fixture
|
||||
"""
|
||||
log_path = retrieve_log_path(run_id, workspace)
|
||||
files_to_cycle = ['error.log', 'error.dmp']
|
||||
files_to_cycle = ['crash.log', 'error.log', 'error.dmp']
|
||||
for filename in files_to_cycle:
|
||||
filepath = os.path.join(log_path, filename)
|
||||
name, ext = os.path.splitext(filename)
|
||||
|
||||
@@ -61,6 +61,8 @@ class TestEditorTestUtils(unittest.TestCase):
|
||||
|
||||
@mock.patch('os.listdir')
|
||||
@mock.patch('ly_test_tools.o3de.editor_test_utils.retrieve_log_path')
|
||||
@mock.patch('os.path.join', mock.MagicMock())
|
||||
@mock.patch('os.path.basename', mock.MagicMock())
|
||||
@mock.patch('os.path.isfile', mock.MagicMock())
|
||||
@mock.patch('ly_test_tools.environment.waiter.wait_for', mock.MagicMock())
|
||||
def test_RetrieveCrashOutput_CrashLogExists_ReturnsLogInfo(self, mock_retrieve_log_path, mock_listdir):
|
||||
@@ -79,6 +81,7 @@ class TestEditorTestUtils(unittest.TestCase):
|
||||
def test_RetrieveCrashOutput_CrashLogNotExists_ReturnsError(self, mock_retrieve_log_path, mock_listdir):
|
||||
mock_retrieve_log_path.return_value = 'mock_log_path'
|
||||
mock_workspace = mock.MagicMock()
|
||||
mock_workspace.paths.crash_log.return_value = 'mock_file.log'
|
||||
error_message = "No crash log available"
|
||||
mock_listdir.return_value = ['mock_file.log']
|
||||
|
||||
@@ -91,7 +94,7 @@ class TestEditorTestUtils(unittest.TestCase):
|
||||
@mock.patch('os.path.exists')
|
||||
def test_CycleCrashReport_DmpExists_NamedCorrectly(self, mock_exists, mock_retrieve_log_path, mock_strftime,
|
||||
mock_rename):
|
||||
mock_exists.side_effect = [False, True]
|
||||
mock_exists.side_effect = [False, False, True]
|
||||
mock_retrieve_log_path.return_value = 'mock_log_path'
|
||||
mock_workspace = mock.MagicMock()
|
||||
mock_strftime.return_value = 'mock_strftime'
|
||||
@@ -107,7 +110,7 @@ class TestEditorTestUtils(unittest.TestCase):
|
||||
@mock.patch('os.path.exists')
|
||||
def test_CycleCrashReport_LogExists_NamedCorrectly(self, mock_exists, mock_retrieve_log_path, mock_strftime,
|
||||
mock_rename):
|
||||
mock_exists.side_effect = [True, False]
|
||||
mock_exists.side_effect = [False, True, False]
|
||||
mock_retrieve_log_path.return_value = 'mock_log_path'
|
||||
mock_workspace = mock.MagicMock()
|
||||
mock_strftime.return_value = 'mock_strftime'
|
||||
|
||||
@@ -589,6 +589,7 @@ class TestRunningTests(unittest.TestCase):
|
||||
@mock.patch('ly_test_tools.o3de.editor_test_utils.retrieve_log_path')
|
||||
@mock.patch('ly_test_tools.o3de.editor_test_utils.get_testcase_module_filepath')
|
||||
@mock.patch('ly_test_tools.o3de.editor_test_utils.cycle_crash_report')
|
||||
@mock.patch('os.path.join', mock.MagicMock())
|
||||
def test_ExecEditorTest_TestSucceeds_ReturnsPass(self, mock_cycle_crash, mock_get_testcase_filepath,
|
||||
mock_retrieve_log, mock_retrieve_editor_log,
|
||||
mock_get_output_results, mock_create):
|
||||
@@ -616,6 +617,7 @@ class TestRunningTests(unittest.TestCase):
|
||||
@mock.patch('ly_test_tools.o3de.editor_test_utils.retrieve_log_path')
|
||||
@mock.patch('ly_test_tools.o3de.editor_test_utils.get_testcase_module_filepath')
|
||||
@mock.patch('ly_test_tools.o3de.editor_test_utils.cycle_crash_report')
|
||||
@mock.patch('os.path.join', mock.MagicMock())
|
||||
def test_ExecEditorTest_TestFails_ReturnsFail(self, mock_cycle_crash, mock_get_testcase_filepath,
|
||||
mock_retrieve_log, mock_retrieve_editor_log,
|
||||
mock_get_output_results, mock_create):
|
||||
@@ -644,6 +646,8 @@ class TestRunningTests(unittest.TestCase):
|
||||
@mock.patch('ly_test_tools.o3de.editor_test_utils.retrieve_log_path')
|
||||
@mock.patch('ly_test_tools.o3de.editor_test_utils.get_testcase_module_filepath')
|
||||
@mock.patch('ly_test_tools.o3de.editor_test_utils.cycle_crash_report')
|
||||
@mock.patch('os.path.join', mock.MagicMock())
|
||||
@mock.patch('os.path.basename', mock.MagicMock())
|
||||
def test_ExecEditorTest_TestCrashes_ReturnsCrash(self, mock_cycle_crash, mock_get_testcase_filepath,
|
||||
mock_retrieve_log, mock_retrieve_editor_log,
|
||||
mock_get_output_results, mock_retrieve_crash, mock_create):
|
||||
@@ -699,10 +703,14 @@ class TestRunningTests(unittest.TestCase):
|
||||
@mock.patch('ly_test_tools.o3de.editor_test_utils.retrieve_log_path')
|
||||
@mock.patch('ly_test_tools.o3de.editor_test_utils.get_testcase_module_filepath')
|
||||
@mock.patch('ly_test_tools.o3de.editor_test_utils.cycle_crash_report')
|
||||
@mock.patch('os.path.join', mock.MagicMock())
|
||||
def test_ExecEditorMultitest_AllTestsPass_ReturnsPasses(self, mock_cycle_crash, mock_get_testcase_filepath,
|
||||
mock_retrieve_log, mock_retrieve_editor_log, mock_create):
|
||||
mock_test_suite = ly_test_tools.o3de.editor_test.EditorTestSuite()
|
||||
mock_workspace = mock.MagicMock()
|
||||
mock_artifact_manager = mock.MagicMock()
|
||||
mock_artifact_manager.save_artifact.return_value = mock.MagicMock()
|
||||
mock_workspace.artifact_manager = mock_artifact_manager
|
||||
mock_workspace.paths.engine_root.return_value = ""
|
||||
mock_editor = mock.MagicMock()
|
||||
mock_editor.get_returncode.return_value = 0
|
||||
@@ -727,6 +735,7 @@ class TestRunningTests(unittest.TestCase):
|
||||
@mock.patch('ly_test_tools.o3de.editor_test_utils.retrieve_log_path')
|
||||
@mock.patch('ly_test_tools.o3de.editor_test_utils.get_testcase_module_filepath')
|
||||
@mock.patch('ly_test_tools.o3de.editor_test_utils.cycle_crash_report')
|
||||
@mock.patch('os.path.join', mock.MagicMock())
|
||||
def test_ExecEditorMultitest_OneFailure_CallsCorrectFunc(self, mock_cycle_crash, mock_get_testcase_filepath,
|
||||
mock_retrieve_log, mock_retrieve_editor_log, mock_get_results):
|
||||
mock_test_suite = ly_test_tools.o3de.editor_test.EditorTestSuite()
|
||||
@@ -752,6 +761,8 @@ class TestRunningTests(unittest.TestCase):
|
||||
@mock.patch('ly_test_tools.o3de.editor_test_utils.retrieve_log_path')
|
||||
@mock.patch('ly_test_tools.o3de.editor_test_utils.get_testcase_module_filepath')
|
||||
@mock.patch('ly_test_tools.o3de.editor_test_utils.cycle_crash_report')
|
||||
@mock.patch('os.path.join', mock.MagicMock())
|
||||
@mock.patch('os.path.basename', mock.MagicMock())
|
||||
def test_ExecEditorMultitest_OneCrash_ReportsOnUnknownResult(self, mock_cycle_crash, mock_get_testcase_filepath,
|
||||
mock_retrieve_log, mock_retrieve_editor_log,
|
||||
mock_get_results, mock_retrieve_crash, mock_create):
|
||||
@@ -787,6 +798,8 @@ class TestRunningTests(unittest.TestCase):
|
||||
@mock.patch('ly_test_tools.o3de.editor_test_utils.retrieve_log_path')
|
||||
@mock.patch('ly_test_tools.o3de.editor_test_utils.get_testcase_module_filepath')
|
||||
@mock.patch('ly_test_tools.o3de.editor_test_utils.cycle_crash_report')
|
||||
@mock.patch('os.path.join', mock.MagicMock())
|
||||
@mock.patch('os.path.basename', mock.MagicMock())
|
||||
def test_ExecEditorMultitest_ManyUnknown_ReportsUnknownResults(self, mock_cycle_crash, mock_get_testcase_filepath,
|
||||
mock_retrieve_log, mock_retrieve_editor_log,
|
||||
mock_get_results, mock_retrieve_crash, mock_create):
|
||||
|
||||
Reference in New Issue
Block a user