1
0
mirror of https://github.com/systemd/systemd.git synced 2025-03-22 06:50:18 +03:00

test: Check stdin for interactivity, not stderr

(cherry picked from commit c9a50ebd8f2142808fca45dc2acff8ddc391cf7e)
This commit is contained in:
Daan De Meyer 2025-03-03 11:44:42 +01:00 committed by Luca Boccassi
parent edfb2eb497
commit 829af7b1e0

View File

@ -395,7 +395,7 @@ def main() -> None:
shell = bool(int(os.getenv('TEST_SHELL', '0')))
summary = Summary.get(args)
if shell and not sys.stderr.isatty():
if shell and not sys.stdin.isatty():
print(
'--interactive must be passed to meson test to use TEST_SHELL=1',
file=sys.stderr,
@ -443,7 +443,7 @@ def main() -> None:
journal_file.unlink(missing_ok=True)
if not sys.stderr.isatty():
if not sys.stdin.isatty():
dropin += textwrap.dedent(
"""
[Unit]
@ -458,7 +458,7 @@ def main() -> None:
"""
)
if sys.stderr.isatty():
if sys.stdin.isatty():
dropin += textwrap.dedent(
"""
[Service]
@ -489,7 +489,7 @@ def main() -> None:
'--credential', f'systemd.extra-unit.emergency-exit.service={shlex.quote(EMERGENCY_EXIT_SERVICE)}', # noqa: E501
'--credential', f'systemd.unit-dropin.emergency.target={shlex.quote(EMERGENCY_EXIT_DROPIN)}',
]
if not sys.stderr.isatty()
if not sys.stdin.isatty()
else []
),
'--credential', f'systemd.unit-dropin.{args.unit}={shlex.quote(dropin)}',
@ -514,13 +514,13 @@ def main() -> None:
'systemd.crash_action=poweroff',
'loglevel=6',
]
if not sys.stderr.isatty()
if not sys.stdin.isatty()
else []
),
]
),
'--credential', f"journal.storage={'persistent' if sys.stderr.isatty() else args.storage}",
*(['--runtime-build-sources=no', '--register=no'] if not sys.stderr.isatty() else []),
'--credential', f"journal.storage={'persistent' if sys.stdin.isatty() else args.storage}",
*(['--runtime-build-sources=no', '--register=no'] if not sys.stdin.isatty() else []),
'vm' if args.vm or os.getuid() != 0 or os.getenv('TEST_PREFER_QEMU', '0') == '1' else 'boot',
] # fmt: skip