From 3e624bb13b18b241d00c8d375d5774acde25aa3f Mon Sep 17 00:00:00 2001 From: Frantisek Sumsal Date: Fri, 27 May 2022 11:41:55 +0200 Subject: [PATCH 1/2] test: bump the post-reboot expect() timeout as it may take a bit longer on slower machines: ``` [ OK ] Reached target System Reboot. Found cgroup2 on /sys/fs/cgroup/, full unified hierarchy Failed to open watchdog device /dev/watchdog0, ignoring: No such file or directory binfmt_misc is not mounted, not detaching entries. Sending SIGTERM to remaining processes... ERROR:test-shutdown:Timeout exceeded. command: /systemd-meson-build/systemd-nspawn <...snip...> buffer (last 100 chars): 'mbinfmt_misc is not mounted, not detaching entries.\x1b[0m\r\nSending SIGTERM to remaining processes...\r\n' before (last 100 chars): 'mbinfmt_misc is not mounted, not detaching entries.\x1b[0m\r\nSending SIGTERM to remaining processes...\r\n' after: match: None match_index: None exitstatus: None flag_eof: False pid: 572528 child_fd: 5 closed: False timeout: 30 delimiter: logfile: <_io.TextIOWrapper name='' mode='w' encoding='utf-8'> logfile_read: None logfile_send: None maxread: 2000 ignorecase: False searchwindowsize: None delaybeforesend: 0.05 delayafterclose: 0.1 delayafterterminate: 0.1 searcher: searcher_re: 0: re.compile('H login: ') INFO:test-shutdown:killing child pid 572528 E: nspawn failed with exit code 1 ``` --- test/test-shutdown.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/test-shutdown.py b/test/test-shutdown.py index d34e224942..1a91753b87 100755 --- a/test/test-shutdown.py +++ b/test/test-shutdown.py @@ -73,7 +73,7 @@ def run(args): logger.info("waiting for reboot") - console.expect('H login: ', 10) + console.expect('H login: ', 30) console.sendline('root') console.expect('bash.*# ', 10) From 47a00df1f0700e471adb96b1ec80b05f56c8032d Mon Sep 17 00:00:00 2001 From: Frantisek Sumsal Date: Fri, 27 May 2022 11:45:15 +0200 Subject: [PATCH 2/2] test: fix a couple of pylint warnings --- test/test-shutdown.py | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/test/test-shutdown.py b/test/test-shutdown.py index 1a91753b87..77ac3a7d9f 100755 --- a/test/test-shutdown.py +++ b/test/test-shutdown.py @@ -4,9 +4,10 @@ import argparse import logging -import pexpect import sys +import pexpect + def run(args): @@ -21,7 +22,7 @@ def run(args): if args.verbose: console.logfile = sys.stdout - logger.debug("child pid %d" % console.pid) + logger.debug("child pid %d", console.pid) try: logger.info("waiting for login prompt") @@ -88,13 +89,12 @@ def run(args): ret = 0 except Exception as e: logger.error(e) - logger.info("killing child pid %d" % console.pid) + logger.info("killing child pid %d", console.pid) console.terminate() return ret - -if __name__ == '__main__': +def main(): parser = argparse.ArgumentParser(description='test logind shutdown feature') parser.add_argument("-v", "--verbose", action="store_true", help="verbose") parser.add_argument("command", help="command to run") @@ -109,6 +109,9 @@ if __name__ == '__main__': logging.basicConfig(level=level) - sys.exit(run(args)) + return run(args) + +if __name__ == '__main__': + sys.exit(main()) # vim: sw=4 et