adds new HOST_OS_GENERIC_EXECUTABLE constant and adds error handling if the executable doesn't exist in the path provided

This commit is contained in:
jromnoa
2021-05-10 16:27:30 -07:00
parent 5885899497
commit 757a26825a
4 changed files with 15 additions and 5 deletions
@@ -37,6 +37,7 @@ if WINDOWS:
HOST_OS_PLATFORM = 'windows'
HOST_OS_EDITOR = 'windows_editor'
HOST_OS_DEDICATED_SERVER = 'windows_dedicated'
HOST_OS_GENERIC_EXECUTABLE = 'windows_generic'
import ly_test_tools.mobile.android
from ly_test_tools.launchers import (
AndroidLauncher, WinLauncher, DedicatedWinLauncher, WinEditor, WinGenericLauncher)
@@ -29,7 +29,7 @@ import ly_test_tools.environment.file_system
import ly_test_tools.launchers.launcher_helper
import ly_test_tools.launchers.platforms.base
import ly_test_tools.environment.watchdog
from ly_test_tools import ALL_PLATFORM_OPTIONS, HOST_OS_PLATFORM
from ly_test_tools import ALL_PLATFORM_OPTIONS, HOST_OS_PLATFORM, HOST_OS_GENERIC_EXECUTABLE
logger = logging.getLogger(__name__)
@@ -287,7 +287,7 @@ def generic_launcher(workspace, request, crash_log_watchdog):
# type: (...) -> ly_test_tools.launchers.platforms.base.Launcher
return _generic_launcher(
workspace=workspace,
launcher_platform=get_fixture_argument(request, 'launcher_platform', HOST_OS_PLATFORM),
launcher_platform=get_fixture_argument(request, 'launcher_platform', HOST_OS_GENERIC_EXECUTABLE),
exe_file_name=get_fixture_argument(request, 'exe_file_name', ''))
@@ -75,5 +75,5 @@ def create_generic_launcher(workspace, launcher_platform, exe_file_name, args=No
:param args: List of arguments to pass to the launcher's 'args' argument during construction
:return: Launcher instance.
"""
launcher_class = ly_test_tools.LAUNCHERS.get(launcher_platform, ly_test_tools.HOST_OS_PLATFORM)
launcher_class = ly_test_tools.LAUNCHERS.get(launcher_platform, ly_test_tools.HOST_OS_GENERIC_EXECUTABLE)
return launcher_class(workspace, exe_file_name, args)
@@ -210,12 +210,21 @@ class WinGenericLauncher(WinLauncher):
def __init__(self, build, exe_file_name, args=None):
super(WinGenericLauncher, self).__init__(build, args)
self.exe_file_name = exe_file_name
self.expected_executable_path = os.path.join(
self.workspace.paths.build_directory(), f"{self.exe_file_name}.exe")
if not os.path.exists(self.expected_executable_path):
raise ProcessNotStartedError(
f"Unable to locate executable '{self.exe_file_name}.exe' "
f"in path: '{self.expected_executable_path}'")
def binary_path(self):
"""
Return full path to the .exe file for this build's configuration and project
Relies on the build_directory() in self.workspace.paths to be accurate
:return: full path to the given exe file
"""
assert self.workspace.project is not None
return os.path.join(self.workspace.paths.build_directory(), f"{self.exe_file_name}.exe")
assert self.workspace.project is not None, (
'Project cannot be NoneType - please specify a project name string.')
return self.expected_executable_path