From: "Philippe Mathieu-Daudé" <f4bug@amsat.org>
To: qemu-devel@nongnu.org
Cc: "Eduardo Habkost" <ehabkost@redhat.com>,
"Philippe Mathieu-Daudé" <f4bug@amsat.org>,
"Aleksandar Markovic" <amarkovic@wavecomp.com>,
"Cleber Rosa" <crosa@redhat.com>,
"Aleksandar Rikalo" <aleksandar.rikalo@rt-rk.com>,
"Aurelien Jarno" <aurelien@aurel32.net>
Subject: [PATCH v2 10/11] tests/ssh_linux_malta: Refactor how to get image/kernel info
Date: Sat, 19 Oct 2019 17:34:36 +0200 [thread overview]
Message-ID: <20191019153437.9820-11-f4bug@amsat.org> (raw)
In-Reply-To: <20191019153437.9820-1-f4bug@amsat.org>
The qcow and kernel images use a similar pattern regarding they
are for big/little endianess, or 32/64 bit.
Refactor using more dictionary keys.
Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
---
tests/acceptance/linux_ssh_mips_malta.py | 75 ++++++++++++++----------
1 file changed, 44 insertions(+), 31 deletions(-)
diff --git a/tests/acceptance/linux_ssh_mips_malta.py b/tests/acceptance/linux_ssh_mips_malta.py
index 822b0553ff..2139c80f5f 100644
--- a/tests/acceptance/linux_ssh_mips_malta.py
+++ b/tests/acceptance/linux_ssh_mips_malta.py
@@ -26,15 +26,44 @@ class LinuxSSH(Test):
KERNEL_COMMON_COMMAND_LINE = 'printk.time=0 '
VM_IP = '127.0.0.1'
+ BASE_URL = 'https://people.debian.org/~aurel32/qemu/'
IMAGE_INFO = {
- 'be': {'image_url': ('https://people.debian.org/~aurel32/qemu/mips/'
- 'debian_wheezy_mips_standard.qcow2'),
- 'image_hash': '8987a63270df67345b2135a6b7a4885a35e392d5'},
- 'le': {'image_url': ('https://people.debian.org/~aurel32/qemu/mipsel/'
- 'debian_wheezy_mipsel_standard.qcow2'),
- 'image_hash': '7866764d9de3ef536ffca24c9fb9f04ffdb45802'}
+ 'be': {'base_url': 'mips',
+ 'image_name': 'debian_wheezy_mips_standard.qcow2',
+ 'image_hash': '8987a63270df67345b2135a6b7a4885a35e392d5',
+ 'kernel_hash': {
+ 32: '592e384a4edc16dade52a6cd5c785c637bcbc9ad',
+ 64: 'db6eea7de35d36c77d8c165b6bcb222e16eb91db'}
+ },
+ 'le': {'base_url': 'mipsel',
+ 'image_name': 'debian_wheezy_mipsel_standard.qcow2',
+ 'image_hash': '7866764d9de3ef536ffca24c9fb9f04ffdb45802',
+ 'kernel_hash': {
+ 32: 'a66bea5a8adaa2cb3d36a1d4e0ccdb01be8f6c2a',
+ 64: '6a7f77245acf231415a0e8b725d91ed2f3487794'}
+ }
+ }
+ CPU_INFO = {
+ 32: {'kernel_release': '3.2.0-4-4kc-malta'},
+ 64: {'kernel_release': '3.2.0-4-5kc-malta'}
}
+ def get_url(self, endianess, path=''):
+ qkey = {'le': 'el', 'be': ''}
+ return '%s/mips%s/%s' % (self.BASE_URL, qkey[endianess], path)
+
+ def get_image_info(self, endianess):
+ dinfo = self.IMAGE_INFO[endianess]
+ image_url = self.get_url(endianess, dinfo['image_name'])
+ image_hash = dinfo['image_hash']
+ return (image_url, image_hash)
+
+ def get_kernel_info(self, endianess, wordsize):
+ minfo = self.CPU_INFO[wordsize]
+ kernel_url = self.get_url(endianess,
+ 'vmlinux-%s' % minfo['kernel_release'])
+ kernel_hash = self.IMAGE_INFO[endianess]['kernel_hash'][wordsize]
+ return kernel_url, kernel_hash
@skipUnless(ssh.SSH_CLIENT_BINARY, 'No SSH client available')
@skipUnless(os.getenv('AVOCADO_TIMEOUT_EXPECTED'), 'Test might timeout')
@@ -79,8 +108,7 @@ class LinuxSSH(Test):
return stdout_lines, stderr_lines
def boot_debian_wheezy_image_and_ssh_login(self, endianess, kernel_path):
- image_url = self.IMAGE_INFO[endianess]['image_url']
- image_hash = self.IMAGE_INFO[endianess]['image_hash']
+ image_url, image_hash = self.get_image_info(endianess)
image_path = self.fetch_asset(image_url, asset_hash=image_hash)
self.vm.set_machine('malta')
@@ -172,7 +200,10 @@ class LinuxSSH(Test):
'md5sum /dev/mtd2ro',
'0dfbe8aa4c20b52e1b8bf3cb6cbdf193')
- def check_mips_malta(self, endianess, kernel_path, uname_m):
+ def check_mips_malta(self, uname_m, endianess):
+ wordsize = 64 if '64' in uname_m else 32
+ kernel_url, kernel_hash = self.get_kernel_info(endianess, wordsize)
+ kernel_path = self.fetch_asset(kernel_url, asset_hash=kernel_hash)
self.boot_debian_wheezy_image_and_ssh_login(endianess, kernel_path)
stdout, _ = self.ssh_command('uname -a')
@@ -188,12 +219,7 @@ class LinuxSSH(Test):
:avocado: tags=endian:big
:avocado: tags=device:pcnet32
"""
- kernel_url = ('https://people.debian.org/~aurel32/qemu/mips/'
- 'vmlinux-3.2.0-4-4kc-malta')
- kernel_hash = '592e384a4edc16dade52a6cd5c785c637bcbc9ad'
- kernel_path = self.fetch_asset(kernel_url, asset_hash=kernel_hash)
-
- self.check_mips_malta('be', kernel_path, 'mips')
+ self.check_mips_malta('mips', 'be')
def test_mips_malta32el_kernel3_2_0(self):
"""
@@ -202,12 +228,7 @@ class LinuxSSH(Test):
:avocado: tags=endian:little
:avocado: tags=device:pcnet32
"""
- kernel_url = ('https://people.debian.org/~aurel32/qemu/mipsel/'
- 'vmlinux-3.2.0-4-4kc-malta')
- kernel_hash = 'a66bea5a8adaa2cb3d36a1d4e0ccdb01be8f6c2a'
- kernel_path = self.fetch_asset(kernel_url, asset_hash=kernel_hash)
-
- self.check_mips_malta('le', kernel_path, 'mips')
+ self.check_mips_malta('mips', 'le')
def test_mips_malta64eb_kernel3_2_0(self):
"""
@@ -216,11 +237,7 @@ class LinuxSSH(Test):
:avocado: tags=endian:big
:avocado: tags=device:pcnet32
"""
- kernel_url = ('https://people.debian.org/~aurel32/qemu/mips/'
- 'vmlinux-3.2.0-4-5kc-malta')
- kernel_hash = 'db6eea7de35d36c77d8c165b6bcb222e16eb91db'
- kernel_path = self.fetch_asset(kernel_url, asset_hash=kernel_hash)
- self.check_mips_malta('be', kernel_path, 'mips64')
+ self.check_mips_malta('mips64', 'be')
def test_mips_malta64el_kernel3_2_0(self):
"""
@@ -229,8 +246,4 @@ class LinuxSSH(Test):
:avocado: tags=endian:little
:avocado: tags=device:pcnet32
"""
- kernel_url = ('https://people.debian.org/~aurel32/qemu/mipsel/'
- 'vmlinux-3.2.0-4-5kc-malta')
- kernel_hash = '6a7f77245acf231415a0e8b725d91ed2f3487794'
- kernel_path = self.fetch_asset(kernel_url, asset_hash=kernel_hash)
- self.check_mips_malta('le', kernel_path, 'mips64')
+ self.check_mips_malta('mips64', 'le')
--
2.21.0
next prev parent reply other threads:[~2019-10-19 15:39 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-10-19 15:34 [PATCH v2 00/11] tests/acceptance: Fix 64-bit MIPS target tests Philippe Mathieu-Daudé
2019-10-19 15:34 ` [PATCH v2 01/11] Acceptance tests: refactor wait_for_console_pattern Philippe Mathieu-Daudé
2019-10-24 9:25 ` Aleksandar Markovic
2019-10-19 15:34 ` [PATCH v2 02/11] tests/acceptance: Fixe wait_for_console_pattern() hangs Philippe Mathieu-Daudé
2019-10-24 9:23 ` Aleksandar Markovic
2019-10-19 15:34 ` [PATCH v2 03/11] tests/acceptance: Send <carriage return> on serial lines Philippe Mathieu-Daudé
2019-10-19 15:34 ` [PATCH v2 04/11] tests/acceptance: Refactor exec_command_and_wait_for_pattern() Philippe Mathieu-Daudé
2019-10-19 15:34 ` [PATCH v2 05/11] tests/boot_linux_console: Use Avocado archive::gzip_uncompress() Philippe Mathieu-Daudé
2019-10-19 15:34 ` [PATCH v2 06/11] tests/boot_linux_console: Run BusyBox on 5KEc 64-bit cpu Philippe Mathieu-Daudé
2019-10-19 15:34 ` [PATCH v2 07/11] tests/ssh_linux_malta: Run tests using a snapshot image Philippe Mathieu-Daudé
2019-10-19 15:52 ` Aleksandar Markovic
2020-01-18 11:32 ` Philippe Mathieu-Daudé
2020-01-18 11:35 ` Philippe Mathieu-Daudé
2019-10-19 15:34 ` [PATCH v2 08/11] tests/ssh_linux_malta: Remove duplicated test Philippe Mathieu-Daudé
2019-10-19 15:51 ` Aleksandar Markovic
2019-10-19 15:34 ` [PATCH v2 09/11] tests/ssh_linux_malta: Match stricter console output Philippe Mathieu-Daudé
2019-10-19 15:50 ` Aleksandar Markovic
2019-10-19 15:34 ` Philippe Mathieu-Daudé [this message]
2019-10-19 15:51 ` [PATCH v2 10/11] tests/ssh_linux_malta: Refactor how to get image/kernel info Aleksandar Markovic
2019-10-19 15:34 ` [PATCH v2 11/11] tests/ssh_linux_malta: Fix 64-bit target tests Philippe Mathieu-Daudé
2019-10-19 15:50 ` Aleksandar Markovic
2019-10-24 9:23 ` [PATCH 00/11] tests/acceptance: Fix 64-bit MIPS " Aleksandar Markovic
2019-10-25 16:46 ` Aleksandar Markovic
2019-10-25 17:17 ` 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=20191019153437.9820-11-f4bug@amsat.org \
--to=f4bug@amsat.org \
--cc=aleksandar.rikalo@rt-rk.com \
--cc=amarkovic@wavecomp.com \
--cc=aurelien@aurel32.net \
--cc=crosa@redhat.com \
--cc=ehabkost@redhat.com \
--cc=qemu-devel@nongnu.org \
/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).