From: "Daniel P. Berrangé" <berrange@redhat.com>
To: "Cédric Le Goater" <clg@redhat.com>
Cc: qemu-devel@nongnu.org, qemu-arm@nongnu.org,
"Peter Maydell" <peter.maydell@linaro.org>,
"Steven Lee" <steven_lee@aspeedtech.com>,
"Troy Lee" <leetroy@gmail.com>,
"Jamin Lin" <jamin_lin@aspeedtech.com>,
"Andrew Jeffery" <andrew@codeconstruct.com.au>,
"Joel Stanley" <joel@jms.id.au>, "Thomas Huth" <thuth@redhat.com>,
"Philippe Mathieu-Daudé" <philmd@linaro.org>
Subject: Re: [PATCH] tests/functional: Convert most Aspeed machine tests
Date: Wed, 16 Oct 2024 10:30:40 +0100 [thread overview]
Message-ID: <Zw-HwHsGaO0W2fbc@redhat.com> (raw)
In-Reply-To: <20241016090741.2026630-1-clg@redhat.com>
On Wed, Oct 16, 2024 at 11:07:41AM +0200, Cédric Le Goater wrote:
> This is a simple conversion of the tests with some cleanups and
> adjustments to match the new test framework. Replace the zephyr image
> MD5 hashes with SHA256 hashes while at it.
>
> The SDK tests depend on a ssh class from avocado.utils which is
> difficult to replace. To be addressed separately.
>
> Signed-off-by: Cédric Le Goater <clg@redhat.com>
> ---
> tests/avocado/machine_aspeed.py | 252 --------------------------
> tests/functional/meson.build | 2 +
> tests/functional/test_arm_aspeed.py | 269 ++++++++++++++++++++++++++++
> 3 files changed, 271 insertions(+), 252 deletions(-)
> create mode 100644 tests/functional/test_arm_aspeed.py
>
> diff --git a/tests/functional/test_arm_aspeed.py b/tests/functional/test_arm_aspeed.py
> new file mode 100644
> index 000000000000..2f9a90f64d8f
> --- /dev/null
> +++ b/tests/functional/test_arm_aspeed.py
> @@ -0,0 +1,269 @@
> +#!/usr/bin/env python3
> +#
> +# Functional test that boots the ASPEED SoCs with firmware
> +#
> +# Copyright (C) 2022 ASPEED Technology Inc
> +#
> +# SPDX-License-Identifier: GPL-2.0-or-later
> +
> +import os
> +import time
> +import subprocess
> +import tempfile
> +
> +from qemu_test import QemuSystemTest, Asset
> +from qemu_test import wait_for_console_pattern
> +from qemu_test import exec_command_and_wait_for_pattern
> +from qemu_test import interrupt_interactive_console_until_pattern
> +from qemu_test import exec_command
> +from qemu_test import has_cmd
> +from qemu_test.utils import archive_extract
> +from zipfile import ZipFile
> +from unittest import skipUnless
> +
> +class AST1030Machine(QemuSystemTest):
> +
> + def test_ast1030_zephyros_1_04(self):
> + asset_url = Asset(
> + ('https://github.com/AspeedTech-BMC'
> + '/zephyr/releases/download/v00.01.04/ast1030-evb-demo.zip'),
> + '4ac6210adcbc61294927918707c6762483fd844dde5e07f3ba834ad1f91434d3')
Don't instantiate assets inline to test code, as this makes them
invisible to the logic that pre-downloads assets prior to running
tests. As a result you're liable to have test timeouts if the
on-the-fly asset download takes too long.
Instead You should use a class level varible with an "ASSET_" name
prefix eg
ASSET_<BLAH> = Asset(....)
See other converted tests for examples of the pattern.
> + kernel_name = "ast1030-evb-demo/zephyr.elf"
> + zip_file = asset_url.fetch()
> + with ZipFile(zip_file, 'r') as zf:
> + zf.extract(kernel_name, path=self.workdir)
> + kernel_file = os.path.join(self.workdir, kernel_name)
> +
> + self.set_machine('ast1030-evb')
> + self.vm.set_console()
> + self.vm.add_args('-kernel', kernel_file, '-nographic')
> + self.vm.launch()
> + wait_for_console_pattern(self, "Booting Zephyr OS")
> + exec_command_and_wait_for_pattern(self, "help",
> + "Available commands")
> +
With regards,
Daniel
--
|: https://berrange.com -o- https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org -o- https://fstop138.berrange.com :|
|: https://entangle-photo.org -o- https://www.instagram.com/dberrange :|
next prev parent reply other threads:[~2024-10-16 9:32 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-10-16 9:07 [PATCH] tests/functional: Convert most Aspeed machine tests Cédric Le Goater
2024-10-16 9:30 ` Daniel P. Berrangé [this message]
2024-10-16 16:42 ` Philippe Mathieu-Daudé
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=Zw-HwHsGaO0W2fbc@redhat.com \
--to=berrange@redhat.com \
--cc=andrew@codeconstruct.com.au \
--cc=clg@redhat.com \
--cc=jamin_lin@aspeedtech.com \
--cc=joel@jms.id.au \
--cc=leetroy@gmail.com \
--cc=peter.maydell@linaro.org \
--cc=philmd@linaro.org \
--cc=qemu-arm@nongnu.org \
--cc=qemu-devel@nongnu.org \
--cc=steven_lee@aspeedtech.com \
--cc=thuth@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).