1
0
mirror of https://github.com/systemd/systemd.git synced 2024-11-01 09:21:26 +03:00
systemd/.github/workflows/test_mkosi_boot.py

28 lines
470 B
Python
Raw Normal View History

#!/usr/bin/env python3
# SPDX-License-Identifier: LGPL-2.1-or-later
import pexpect
import sys
def run() -> None:
p = pexpect.spawnu(" ".join(sys.argv[1:]), logfile=sys.stdout, timeout=300)
p.expect("login:")
p.sendline("root")
p.expect("#")
p.sendline("systemctl poweroff")
p.expect(pexpect.EOF)
try:
run()
except pexpect.EOF:
print("UNEXPECTED EOF")
sys.exit(1)
except pexpect.TIMEOUT:
print("TIMED OUT")
sys.exit(1)