From patchwork Mon Apr 24 09:22:40 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Alex_Benn=C3=A9e?= X-Patchwork-Id: 676557 Delivered-To: patch@linaro.org Received: by 2002:a5d:4a41:0:0:0:0:0 with SMTP id v1csp2054575wrs; Mon, 24 Apr 2023 02:24:31 -0700 (PDT) X-Google-Smtp-Source: AKy350Ykx987m8LIh0vMYvppQU7ZM87DJXLK45+8qR6E/ZJLvz392JZ4sPBrM4Zm748qdU6aoKjD X-Received: by 2002:a05:6214:c6c:b0:5ea:3abd:db61 with SMTP id t12-20020a0562140c6c00b005ea3abddb61mr16119316qvj.11.1682328271728; Mon, 24 Apr 2023 02:24:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1682328271; cv=none; d=google.com; s=arc-20160816; b=Vpag5mYto39oNhYryWmMrKMNMKuB+k6aFwHdCxgJXO3GXAVU+MPAjXKS3agNOPyF9F rYhy5jx///5xmI2aj9NKFZIfRDNidi+xTyFbu8JfPv7J58kyVYOyJR69TmVfGYEAEn85 VKR4n4jy5SufR3udPjA0eInh94Au2j8TT16w0AQMYNnfc3OR1aFZ5zUcB8FGcjH6ArH7 Zdeqxs1FYSg+W2dodCjTvoo1mkGbsNG4EzEJaGnmCZ6jGe6ovWGpJ0WwQNoXqrsNgacC CtU51Wjiraeph13mwB7AzcqkmRFlN+DZ5D/hzwDH1hUh+8WXanNzW6MYN9+9fawRiY+O szJQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=iONo8m57sFQhz/fKHL0PRqYNSYb2qqSH+RERi0fWhz0=; b=JJn7untSZQ3CAOwLT8hckSafeCGcKctdvv/uCY0F7w9hgP61/Hyo9DxdfXD88gLHbB 5b/xKilfSAPG9yCTaxl2WNS0bzQb+YYffJG2nRghaakrIn/vIrPSduXQ/2IUrC4G8zK2 oOqsiklB4W0l344riveoMdoRb7yKKLCnEer7qU7Xb6sCd+C8qMm8kEKmTwf/4857x510 0E1KdR0vtKfxSI2oDbgp02EsnOr6V/FUVCC2I+NkWixtMxmOeSQtaujoXVv1vLIaHbhN Z1A5KWmfPLMGZSLAPlHIZxzNFGWeNXx5PW0zrav8+fr9KfXuLjQgfK8I+/JDwXTIn3ZM ajag== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="LEuyv/e3"; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id v1-20020a05620a0f0100b0074ae3bf128fsi7199409qkl.343.2023.04.24.02.24.31 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 24 Apr 2023 02:24:31 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="LEuyv/e3"; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pqsQB-00084y-1C; Mon, 24 Apr 2023 05:23:43 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pqsPi-0007Fu-4R for qemu-devel@nongnu.org; Mon, 24 Apr 2023 05:23:23 -0400 Received: from mail-wm1-x32d.google.com ([2a00:1450:4864:20::32d]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pqsPQ-0004nC-U3 for qemu-devel@nongnu.org; Mon, 24 Apr 2023 05:23:12 -0400 Received: by mail-wm1-x32d.google.com with SMTP id 5b1f17b1804b1-3f1957e80a2so69597045e9.1 for ; Mon, 24 Apr 2023 02:22:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1682328175; x=1684920175; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=iONo8m57sFQhz/fKHL0PRqYNSYb2qqSH+RERi0fWhz0=; b=LEuyv/e3JqCM1JRBQ/80AUwhCkNtixL5P+kLNXbmykg4VQAjPIIOYkZd7KVH0xlzK0 NX6+MSDjcLG0Q7CA2yZeMchuCvyA733XhykLN95rWNe3xk5W0iqZyWYFaR4HddhNjX9r TmGkbTBC9X9TzVrNo4HDxudtyu+g67CsHiEt/kzmlHSVCe+ojTmEDLGh2pR9V/8awmnX gwSTIPwirSxlue0VTF1ADZgqV30dOnwYC95gT9BAZeQwyklJ+Mlr9LwN4TTdPCdE800W WvZs+rm78T6HkGelekl7e3sRa8ssZicRm055vKt+Tboyvs212fNXIq7zSg/RM+sYDlUk YNWg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1682328175; x=1684920175; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=iONo8m57sFQhz/fKHL0PRqYNSYb2qqSH+RERi0fWhz0=; b=DtBAT2RsJLGoNboyt5g0UtjEjyj1DdlajluwYM/tcuzfQTkBFHOVuZ5WK4dXyyAQDa LWzvCuFFlQEUMTOUBbrAljNpR4cSHQ7xHgnSCUaUGwHo2YuFjpGAcWmP1+LVBsOk9bSp 14WR72JJQH4D18Vk5dukjFJIOPAs6t+/B5+Djlm+ehRuS+yShJxpdAOmeg8Ux4gqG242 mE+6LwlW8zF8P2mYII3qC9NCuD1dV9NBanxsCJ+n3f5N0vfb5oZYE8zNMIaqROIFKVTS SRirpECCDp+25gS8CAxZAguXHTiraT0Yg++D64qTqpCKTWWEUUN89spcqXXMnz2lBIVq 8XMA== X-Gm-Message-State: AAQBX9fdVi7lv0sdDo/UEQuzlIS2Q3NqyFiWbqohhBa/AUiiYVKuXHOv uee9ZNgkFbI6vgvHErVJ7GcfTQ== X-Received: by 2002:a05:6000:1181:b0:2fc:3596:7392 with SMTP id g1-20020a056000118100b002fc35967392mr10023134wrx.24.1682328175002; Mon, 24 Apr 2023 02:22:55 -0700 (PDT) Received: from zen.linaroharston ([85.9.250.243]) by smtp.gmail.com with ESMTPSA id z14-20020a5d4d0e000000b002efb4f2d240sm10339317wrt.87.2023.04.24.02.22.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 24 Apr 2023 02:22:53 -0700 (PDT) Received: from zen.lan (localhost [127.0.0.1]) by zen.linaroharston (Postfix) with ESMTP id 77D8C1FFC1; Mon, 24 Apr 2023 10:22:50 +0100 (BST) From: =?utf-8?q?Alex_Benn=C3=A9e?= To: qemu-devel@nongnu.org Cc: Wainer dos Santos Moschetta , Beraldo Leal , Thomas Huth , =?utf-8?q?Alex_Benn=C3=A9e?= , "Edgar E. Iglesias" , Paolo Bonzini , Aurelien Jarno , Peter Maydell , Juan Quintela , =?utf-8?q?C=C3=A9dric_Le_Goater?= , Richard Henderson , Joel Stanley , Leif Lindholm , Markus Armbruster , Radoslaw Biernacki , Stefan Hajnoczi , =?utf-8?q?Marc-Andr=C3=A9_Lureau?= , John Snow , Andrew Jeffery , David Hildenbrand , Bastian Koppelmann , Max Filippov , qemu-s390x@nongnu.org, Cleber Rosa , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , =?utf-8?q?Dani?= =?utf-8?q?el_P=2E_Berrang=C3=A9?= , qemu-arm@nongnu.org, Eduardo Habkost , Ilya Leoshkevich Subject: [PATCH 09/18] tests/avocado/machine_aspeed: Fix the broken ast2[56]00_evb_sdk tests Date: Mon, 24 Apr 2023 10:22:40 +0100 Message-Id: <20230424092249.58552-10-alex.bennee@linaro.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230424092249.58552-1-alex.bennee@linaro.org> References: <20230424092249.58552-1-alex.bennee@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::32d; envelope-from=alex.bennee@linaro.org; helo=mail-wm1-x32d.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org From: Thomas Huth test_arm_ast2500_evb_sdk and test_arm_ast2600_evb_sdk are currently failing. The problem is that they are trying to look for the login prompt that does not have a newline at the end - but the logic in _console_interaction() only handles full lines. It used to work by accident in the past since there were sometimes kernel (warning and error) messages popping up that finally provided a newline character in the output, but since the tests have been changed to run with the "quiet" kernel parameter, this is not working anymore. To make this work reliably, we must not look for the "login:" prompt, but have to use some text ending with a newline instead. And in the ast2600 test, switch to ssh instead of trying to log into the serial console - this works much more reliable and also has the benefit of excercising the network interface here a little bit, too. Signed-off-by: Thomas Huth Reviewed-by: Cédric Le Goater Message-Id: <20230421110345.1294131-3-thuth@redhat.com> [AJB: remove stray debug log] Signed-off-by: Alex Bennée --- tests/avocado/machine_aspeed.py | 30 +++++++++++++++++------------- 1 file changed, 17 insertions(+), 13 deletions(-) diff --git a/tests/avocado/machine_aspeed.py b/tests/avocado/machine_aspeed.py index 2b532c4834..724ee72c02 100644 --- a/tests/avocado/machine_aspeed.py +++ b/tests/avocado/machine_aspeed.py @@ -10,6 +10,7 @@ import tempfile import subprocess +from avocado_qemu import LinuxSSHMixIn from avocado_qemu import QemuSystemTest from avocado_qemu import wait_for_console_pattern from avocado_qemu import exec_command @@ -268,7 +269,7 @@ def test_arm_ast2600_evb_buildroot_tpm(self): self.do_test_arm_aspeed_buildroot_poweroff() -class AST2x00MachineSDK(QemuSystemTest): +class AST2x00MachineSDK(QemuSystemTest, LinuxSSHMixIn): EXTRA_BOOTARGS = ( 'quiet ' @@ -295,7 +296,7 @@ def do_test_arm_aspeed_sdk_start(self, image): self.require_netdev('user') self.vm.set_console() self.vm.add_args('-drive', 'file=' + image + ',if=mtd,format=raw', - '-net', 'nic', '-net', 'user') + '-net', 'nic', '-net', 'user,hostfwd=:127.0.0.1:0-:22') self.vm.launch() self.wait_for_console_pattern('U-Boot 2019.04') @@ -323,7 +324,7 @@ def test_arm_ast2500_evb_sdk(self): self.do_test_arm_aspeed_sdk_start( self.workdir + '/ast2500-default/image-bmc') - self.wait_for_console_pattern('ast2500-default login:') + self.wait_for_console_pattern('nodistro.0 ast2500-default ttyS4') @skipIf(os.getenv('GITLAB_CI'), 'Running on GitLab') def test_arm_ast2600_evb_sdk(self): @@ -345,22 +346,25 @@ def test_arm_ast2600_evb_sdk(self): 'ds1338,bus=aspeed.i2c.bus.5,address=0x32'); self.do_test_arm_aspeed_sdk_start( self.workdir + '/ast2600-default/image-bmc') - self.wait_for_console_pattern('ast2600-default login:') - exec_command_and_wait_for_pattern(self, 'root', 'Password:') - exec_command_and_wait_for_pattern(self, '0penBmc', 'root@ast2600-default:~#') + self.wait_for_console_pattern('nodistro.0 ast2600-default ttyS4') - exec_command_and_wait_for_pattern(self, - 'echo lm75 0x4d > /sys/class/i2c-dev/i2c-5/device/new_device', + self.ssh_connect('root', '0penBmc', False) + self.ssh_command('dmesg -c > /dev/null') + + self.ssh_command_output_contains( + 'echo lm75 0x4d > /sys/class/i2c-dev/i2c-5/device/new_device ; ' + 'dmesg -c', 'i2c i2c-5: new_device: Instantiated device lm75 at 0x4d'); - exec_command_and_wait_for_pattern(self, + self.ssh_command_output_contains( 'cat /sys/class/hwmon/hwmon19/temp1_input', '0') self.vm.command('qom-set', path='/machine/peripheral/tmp-test', property='temperature', value=18000); - exec_command_and_wait_for_pattern(self, + self.ssh_command_output_contains( 'cat /sys/class/hwmon/hwmon19/temp1_input', '18000') - exec_command_and_wait_for_pattern(self, - 'echo ds1307 0x32 > /sys/class/i2c-dev/i2c-5/device/new_device', + self.ssh_command_output_contains( + 'echo ds1307 0x32 > /sys/class/i2c-dev/i2c-5/device/new_device ; ' + 'dmesg -c', 'i2c i2c-5: new_device: Instantiated device ds1307 at 0x32'); year = time.strftime("%Y") - exec_command_and_wait_for_pattern(self, 'hwclock -f /dev/rtc1', year); + self.ssh_command_output_contains('/sbin/hwclock -f /dev/rtc1', year);