From 0a0abc373c07a7744adac48891a393e0882fdb6f Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Thu, 30 May 2024 04:19:40 +0200 Subject: Merging upstream version 252.25. Signed-off-by: Daniel Baumann --- test/TEST-69-SHUTDOWN/test.sh | 1 + test/test-functions | 2 +- test/test-network/systemd-networkd-tests.py | 1 + test/test-shutdown.py | 22 +++++++++++++++------- test/units/testsuite-30.sh | 2 +- test/units/testsuite-45.sh | 8 ++++---- test/units/testsuite-72.sh | 9 +++++++++ 7 files changed, 32 insertions(+), 13 deletions(-) (limited to 'test') diff --git a/test/TEST-69-SHUTDOWN/test.sh b/test/TEST-69-SHUTDOWN/test.sh index c7f78fe..09497b3 100755 --- a/test/TEST-69-SHUTDOWN/test.sh +++ b/test/TEST-69-SHUTDOWN/test.sh @@ -32,6 +32,7 @@ ExecStart=/bin/true EOF inst /usr/bin/screen echo "PS1='screen\$WINDOW # '" >>"$workspace/root/.bashrc" + echo "TERM=linux" >>"$workspace/root/.bash_profile" echo 'startup_message off' >"$workspace/etc/screenrc" echo 'bell_msg ""' >>"$workspace/etc/screenrc" } diff --git a/test/test-functions b/test/test-functions index da17bff..097babf 100644 --- a/test/test-functions +++ b/test/test-functions @@ -2203,7 +2203,7 @@ install_zoneinfo() { inst_any /usr/share/zoneinfo/Australia/Sydney inst_any /usr/share/zoneinfo/Europe/Berlin inst_any /usr/share/zoneinfo/Europe/Dublin - inst_any /usr/share/zoneinfo/Europe/Kiev + inst_any /usr/share/zoneinfo/Europe/Kyiv inst_any /usr/share/zoneinfo/Pacific/Auckland inst_any /usr/share/zoneinfo/Pacific/Honolulu inst_any /usr/share/zoneinfo/CET diff --git a/test/test-network/systemd-networkd-tests.py b/test/test-network/systemd-networkd-tests.py index 45aa1b0..a9286e9 100755 --- a/test/test-network/systemd-networkd-tests.py +++ b/test/test-network/systemd-networkd-tests.py @@ -3116,6 +3116,7 @@ class NetworkdNetworkTests(unittest.TestCase, Utilities): print(output) self.assertRegex(output, 'inet6 .* scope link') + @unittest.skip("Re-enable once https://github.com/systemd/systemd/issues/30056 is resolved") def test_sysctl(self): copy_network_unit('25-sysctl.network', '12-dummy.netdev') start_networkd() 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") diff --git a/test/units/testsuite-30.sh b/test/units/testsuite-30.sh index 57f4666..91ee199 100755 --- a/test/units/testsuite-30.sh +++ b/test/units/testsuite-30.sh @@ -16,7 +16,7 @@ systemd-run --on-clock-change touch /tmp/clock-changed test ! -f /tmp/timezone-changed test ! -f /tmp/clock-changed -timedatectl set-timezone Europe/Kiev +timedatectl set-timezone Europe/Kyiv while test ! -f /tmp/timezone-changed ; do sleep .5 ; done diff --git a/test/units/testsuite-45.sh b/test/units/testsuite-45.sh index ba01daa..76124cd 100755 --- a/test/units/testsuite-45.sh +++ b/test/units/testsuite-45.sh @@ -55,12 +55,12 @@ test_timezone() { assert_in "Local time:" "$(timedatectl --no-pager)" echo 'change timezone' - assert_eq "$(timedatectl --no-pager set-timezone Europe/Kiev 2>&1)" "" - assert_eq "$(readlink /etc/localtime | sed 's#^.*zoneinfo/##')" "Europe/Kiev" + assert_eq "$(timedatectl --no-pager set-timezone Europe/Kyiv 2>&1)" "" + assert_eq "$(readlink /etc/localtime | sed 's#^.*zoneinfo/##')" "Europe/Kyiv" if [[ -f /etc/timezone ]]; then - assert_eq "$(cat /etc/timezone)" "Europe/Kiev" + assert_eq "$(cat /etc/timezone)" "Europe/Kyiv" fi - assert_in "Time zone: Europe/Kiev \(EES*T, \+0[0-9]00\)" "$(timedatectl)" + assert_in "Time zone: Europe/Kyiv \(EES*T, \+0[0-9]00\)" "$(timedatectl)" if [[ -n "$ORIG_TZ" ]]; then echo 'reset timezone to original' diff --git a/test/units/testsuite-72.sh b/test/units/testsuite-72.sh index 9effc98..d6c20ef 100755 --- a/test/units/testsuite-72.sh +++ b/test/units/testsuite-72.sh @@ -12,6 +12,15 @@ if ! test -x "$SYSUPDATE"; then exit 0 fi +# Loopback devices may not be supported. They are used because sfdisk cannot +# change the sector size of a file, and we want to test both 512 and 4096 byte +# sectors. If loopback devices are not supported, we can only test one sector +# size, and the underlying device is likely to have a sector size of 512 bytes. +if [[ ! -e /dev/loop-control ]]; then + echo "No loopback device support" + SECTOR_SIZES="512" +fi + export SYSTEMD_PAGER=cat export SYSTEMD_LOG_LEVEL=debug -- cgit v1.2.3