mirror of
https://github.com/facebook/sapling.git
synced 2024-10-06 23:07:18 +03:00
update the systemd-related integration tests to work on Ubuntu
Summary: The systemd binary is installed in a different location on Debian-based distributions (e.g., Ubuntu) from RedHat-based distributions. Update the integration tests to look in both places. Reviewed By: wez Differential Revision: D21297591 fbshipit-source-id: 67e5a698080205b8624c1f38aa49e75c20b6a28c
This commit is contained in:
parent
d20afab335
commit
8392001e38
@ -116,6 +116,17 @@ class FindExeClass(object):
|
||||
def SYSTEMD_FB_EDENFS_SERVICE(self) -> str:
|
||||
return os.path.join(self.EDEN_SRC_ROOT, "eden/fs/service/fb-edenfs@.service")
|
||||
|
||||
@cached_property
|
||||
def SYSTEMD(self) -> str:
|
||||
# systemd is installed at /usr/lib/systemd/systemd on RedHat-like distributions,
|
||||
# and /bin/systemd on Debian-like distributions.
|
||||
candidates = ["/usr/lib/systemd/systemd", "/bin/systemd"]
|
||||
for path in candidates:
|
||||
if os.access(path, os.X_OK):
|
||||
return path
|
||||
|
||||
raise Exception(f"unable to find systemd: candidates checked={candidates}")
|
||||
|
||||
@cached_property
|
||||
def TAKEOVER_TOOL(self) -> str:
|
||||
return self._find_exe(
|
||||
|
@ -413,7 +413,8 @@ def _transient_managed_systemd_user_service_manager(
|
||||
"""Create an isolated systemd instance using 'systemd-run systemd'."""
|
||||
|
||||
child_systemd_service = parent_systemd.systemd_run(
|
||||
command=["/usr/lib/systemd/systemd", "--user", "--unit=basic.target"],
|
||||
# pyre-ignore[6]: T38947910
|
||||
command=[FindExe.SYSTEMD, "--user", "--unit=basic.target"],
|
||||
properties={
|
||||
"Description": f"Eden test systemd user service manager "
|
||||
f"({xdg_runtime_dir})",
|
||||
@ -486,10 +487,11 @@ class _TransientUnmanagedSystemdUserServiceManager:
|
||||
pathlib.Path(FindExe.FORCE_SD_BOOTED).resolve(strict=True)
|
||||
)
|
||||
process = subprocess.Popen(
|
||||
# pyre-ignore[6]: T38947910
|
||||
[
|
||||
"timeout",
|
||||
f"{self.__lifetime_duration}s",
|
||||
"/usr/lib/systemd/systemd",
|
||||
FindExe.SYSTEMD,
|
||||
"--user",
|
||||
"--unit=basic.target",
|
||||
"--log-target=console",
|
||||
|
Loading…
Reference in New Issue
Block a user