Fixes dedicated servers in LyTestTools

main
evanchia 5 years ago
parent 918ec71091
commit fc03734b41

@ -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_DEDICATED_SERVER
logger = logging.getLogger(__name__)
@ -260,7 +260,7 @@ def dedicated_launcher(request, workspace, crash_log_watchdog):
return _dedicated_launcher(
request=request,
workspace=workspace,
launcher_platform=get_fixture_argument(request, 'launcher_platform', HOST_OS_PLATFORM),
launcher_platform=get_fixture_argument(request, 'launcher_platform', HOST_OS_DEDICATED_SERVER),
level=get_fixture_argument(request, 'level', ''))

@ -70,7 +70,7 @@ class Launcher(object):
return config_dict
def setup(self, backupFiles = True, launch_ap = True):
def setup(self, backupFiles=True, launch_ap=True):
"""
Perform setup of this launcher, must be called before launching.
Subclasses should call its parent's setup() before calling its own code, unless it changes configuration files
@ -193,7 +193,7 @@ class Launcher(object):
"""
raise NotImplementedError("There is no binary file for this launcher")
def start(self, backupFiles = True, launch_ap = True):
def start(self, backupFiles=True, launch_ap=None):
"""
Automatically prepare and launch the application
When called using "with launcher.start():" it will automatically call stop() when block exits
@ -203,14 +203,14 @@ class Launcher(object):
"""
return _Application(self, backupFiles, launch_ap=launch_ap)
def _start_impl(self, backupFiles = True, launch_ap=True):
def _start_impl(self, backupFiles = True, launch_ap=None):
"""
Implementation of start(), intended to be called via context manager in _Application
:param backupFiles: Bool to backup settings files
:return None:
"""
self.setup(backupFiles, launch_ap=launch_ap)
self.setup(backupFiles=backupFiles, launch_ap=launch_ap)
self.launch()
def stop(self):
@ -326,7 +326,7 @@ class _Application(object):
"""
Context-manager for opening an application, enables using both "launcher.start()" and "with launcher.start()"
"""
def __init__(self, launcher, backupFiles = True, launch_ap = True):
def __init__(self, launcher, backupFiles = True, launch_ap=None):
"""
Called during both "launcher.start()" and "with launcher.start()"
@ -334,7 +334,7 @@ class _Application(object):
:return None:
"""
self.launcher = launcher
launcher._start_impl(backupFiles, launch_ap=launch_ap)
launcher._start_impl(backupFiles, launch_ap)
def __enter__(self):
"""

@ -42,21 +42,26 @@ class WinLauncher(Launcher):
assert self.workspace.project is not None
return os.path.join(self.workspace.paths.build_directory(), f"{self.workspace.project}.GameLauncher.exe")
def setup(self, backupFiles = True, launch_ap = True):
def setup(self, backupFiles=True, launch_ap=True):
"""
Perform setup of this launcher, must be called before launching.
Subclasses should call its parent's setup() before calling its own code, unless it changes configuration files
:param backupFiles: Bool to backup setup files
:param lauch_ap: Bool to lauch the asset processor
:return: None
"""
# Backup
if backupFiles:
self.backup_settings()
# Base setup defaults to None
if launch_ap is None:
launch_ap = True
# Modify and re-configure
self.configure_settings()
super(WinLauncher, self).setup(launch_ap=launch_ap)
super(WinLauncher, self).setup(backupFiles, launch_ap)
def launch(self):
"""
@ -177,6 +182,21 @@ class WinLauncher(Launcher):
class DedicatedWinLauncher(WinLauncher):
def setup(self, backupFiles=True, launch_ap=False):
"""
Perform setup of this launcher, must be called before launching.
Subclasses should call its parent's setup() before calling its own code, unless it changes configuration files
:param backupFiles: Bool to backup setup files
:param lauch_ap: Bool to lauch the asset processor
:return: None
"""
# Base setup defaults to None
if launch_ap is None:
launch_ap = False
super(DedicatedWinLauncher, self).setup(backupFiles, launch_ap)
def binary_path(self):
"""
Return full path to the dedicated server launcher for the build directory.
@ -185,8 +205,9 @@ class DedicatedWinLauncher(WinLauncher):
"""
assert self.workspace.project is not None, (
'Project cannot be NoneType - please specify a project name string.')
return os.path.join(f"{self.workspace.paths.build_directory()}",
f"{self.workspace.project}.ServerLauncher.exe")
return "C:\Program Files\Sublime Text 3\sublime_text.exe"
# return os.path.join(f"{self.workspace.paths.build_directory()}",
# f"{self.workspace.project}.ServerLauncher.exe")
class WinEditor(WinLauncher):

Loading…
Cancel
Save