diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-05-30 02:22:46 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-05-30 02:22:46 +0000 |
commit | df66ab078d7415dcd983ff92d225098db2c7244a (patch) | |
tree | b8c6ffe2ccf913c52d04e69d9c2d62181f738ed4 /test/test-shutdown.py | |
parent | Releasing progress-linux version 252.23-1~deb12u1~progress6.99u1. (diff) | |
download | systemd-df66ab078d7415dcd983ff92d225098db2c7244a.tar.xz systemd-df66ab078d7415dcd983ff92d225098db2c7244a.zip |
Merging upstream version 252.25.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'test/test-shutdown.py')
-rwxr-xr-x | test/test-shutdown.py | 22 |
1 files changed, 15 insertions, 7 deletions
diff --git a/test/test-shutdown.py b/test/test-shutdown.py index 00f7a6c..9b4b647 100755 --- a/test/test-shutdown.py +++ b/test/test-shutdown.py @@ -11,18 +11,21 @@ import pexpect def run(args): - ret = 1 logger = logging.getLogger("test-shutdown") + logfile = None + + if args.logfile: + logger.debug("Logging pexpect IOs to %s", args.logfile) + logfile = open(args.logfile, 'w') + elif args.verbose: + logfile = sys.stdout logger.info("spawning test") - console = pexpect.spawn(args.command, args.arg, env={ - "TERM": "linux", + console = pexpect.spawn(args.command, args.arg, logfile=logfile, env={ + "TERM": "dumb", }, encoding='utf-8', timeout=60) - if args.verbose: - console.logfile = sys.stdout - logger.debug("child pid %d", console.pid) try: @@ -38,12 +41,16 @@ def run(args): console.send('c') console.expect('screen1 ', 10) + logger.info('wait for the machine to fully boot') + console.sendline('systemctl is-system-running --wait') + console.expect(r'\b(running|degraded)\b', 60) + # console.interact() console.sendline('tty') console.expect(r'/dev/(pts/\d+)') pty = console.match.group(1) - logger.info("window 1 at line %s", pty) + logger.info("window 1 at tty %s", pty) logger.info("schedule reboot") console.sendline('shutdown -r') @@ -100,6 +107,7 @@ def run(args): def main(): parser = argparse.ArgumentParser(description='test logind shutdown feature') parser.add_argument("-v", "--verbose", action="store_true", help="verbose") + parser.add_argument("--logfile", metavar='FILE', help="Save all test input/output to the given path") parser.add_argument("command", help="command to run") parser.add_argument("arg", nargs='*', help="args for command") |