From b1c452168037a1a2f64d36f9062ec10e1dec411a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Date: Sat, 19 Oct 2019 17:34:33 +0200 Subject: tests/ssh_linux_malta: Run tests using a snapshot image MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit If a test fails, it can corrupt the underlying QCow2 image, making further tests failing. Fix this by running each test with a snapshot. Signed-off-by: Philippe Mathieu-Daudé Signed-off-by: Aleksandar Markovic Reviewed-by: Aleksandar Markovic Message-Id: <20191019153437.9820-8-f4bug@amsat.org> --- tests/acceptance/linux_ssh_mips_malta.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'tests') diff --git a/tests/acceptance/linux_ssh_mips_malta.py b/tests/acceptance/linux_ssh_mips_malta.py index 25a1df5..6ecf335 100644 --- a/tests/acceptance/linux_ssh_mips_malta.py +++ b/tests/acceptance/linux_ssh_mips_malta.py @@ -102,7 +102,7 @@ class LinuxSSH(Test): self.vm.add_args('-no-reboot', '-kernel', kernel_path, '-append', kernel_command_line, - '-hda', image_path, + '-drive', 'file=%s,snapshot=on' % image_path, '-netdev', 'user,id=vnet,hostfwd=:127.0.0.1:0-:22', '-device', 'pcnet,netdev=vnet') self.vm.launch() -- cgit v1.1 From c91839ffa8402e10a8c3db1fe9fc60ee9ca953cf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Date: Sat, 19 Oct 2019 17:34:34 +0200 Subject: tests/ssh_linux_malta: Remove duplicated test MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Remove duplicated test (probably copy/paste error in commit 9090d3332cdcc). Signed-off-by: Philippe Mathieu-Daudé Signed-off-by: Aleksandar Markovic Reviewed-by: Aleksandar Markovic Message-Id: <20191019153437.9820-9-f4bug@amsat.org> --- tests/acceptance/linux_ssh_mips_malta.py | 3 --- 1 file changed, 3 deletions(-) (limited to 'tests') diff --git a/tests/acceptance/linux_ssh_mips_malta.py b/tests/acceptance/linux_ssh_mips_malta.py index 6ecf335..007bcdb 100644 --- a/tests/acceptance/linux_ssh_mips_malta.py +++ b/tests/acceptance/linux_ssh_mips_malta.py @@ -153,9 +153,6 @@ class LinuxSSH(Test): 'cat /proc/interrupts', 'eth0') self.ssh_command_output_contains( - 'cat /proc/interrupts', - 'eth0') - self.ssh_command_output_contains( 'cat /proc/devices', 'input') self.ssh_command_output_contains( -- cgit v1.1 From 848149ad598623c6fdd401e8376c8e28c84503a5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Date: Sat, 19 Oct 2019 17:34:35 +0200 Subject: tests/ssh_linux_malta: Match stricter console output MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Match on stricter console output. Signed-off-by: Philippe Mathieu-Daudé Signed-off-by: Aleksandar Markovic Reviewed-by: Aleksandar Markovic Message-Id: <20191019153437.9820-10-f4bug@amsat.org> --- tests/acceptance/linux_ssh_mips_malta.py | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) (limited to 'tests') diff --git a/tests/acceptance/linux_ssh_mips_malta.py b/tests/acceptance/linux_ssh_mips_malta.py index 007bcdb..b19598e 100644 --- a/tests/acceptance/linux_ssh_mips_malta.py +++ b/tests/acceptance/linux_ssh_mips_malta.py @@ -139,19 +139,19 @@ class LinuxSSH(Test): '3.2.0-4-4kc-malta') self.ssh_command_output_contains( 'cat /proc/interrupts', - 'timer') + 'XT-PIC timer') self.ssh_command_output_contains( 'cat /proc/interrupts', - 'i8042') + 'XT-PIC i8042') self.ssh_command_output_contains( 'cat /proc/interrupts', - 'serial') + 'XT-PIC serial') self.ssh_command_output_contains( 'cat /proc/interrupts', - 'ata_piix') + 'XT-PIC ata_piix') self.ssh_command_output_contains( 'cat /proc/interrupts', - 'eth0') + 'XT-PIC eth0') self.ssh_command_output_contains( 'cat /proc/devices', 'input') @@ -163,13 +163,13 @@ class LinuxSSH(Test): 'fb') self.ssh_command_output_contains( 'cat /proc/ioports', - 'serial') + ' : serial') self.ssh_command_output_contains( 'cat /proc/ioports', - 'ata_piix') + ' : ata_piix') self.ssh_command_output_contains( 'cat /proc/ioports', - 'piix4_smbus') + ' : piix4_smbus') self.ssh_command_output_contains( 'lspci -d 11ab:4620', 'GT-64120') @@ -179,7 +179,7 @@ class LinuxSSH(Test): self.ssh_command_output_contains( 'cat /proc/mtd', 'YAMON') - # Empty 'Board Config' + # Empty 'Board Config' (64KB) self.ssh_command_output_contains( 'md5sum /dev/mtd2ro', '0dfbe8aa4c20b52e1b8bf3cb6cbdf193') -- cgit v1.1 From a7b198ed7d1b84b9e45c808a16f248c634a8c797 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Date: Sat, 19 Oct 2019 17:34:36 +0200 Subject: tests/ssh_linux_malta: Refactor how to get image/kernel info MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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é Signed-off-by: Aleksandar Markovic Reviewed-by: Aleksandar Markovic Message-Id: <20191019153437.9820-11-f4bug@amsat.org> --- tests/acceptance/linux_ssh_mips_malta.py | 75 +++++++++++++++++++------------- 1 file changed, 44 insertions(+), 31 deletions(-) (limited to 'tests') diff --git a/tests/acceptance/linux_ssh_mips_malta.py b/tests/acceptance/linux_ssh_mips_malta.py index b19598e..14b8a5b 100644 --- a/tests/acceptance/linux_ssh_mips_malta.py +++ b/tests/acceptance/linux_ssh_mips_malta.py @@ -25,15 +25,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') @@ -91,8 +120,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') @@ -184,7 +212,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') @@ -200,12 +231,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): """ @@ -214,12 +240,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): """ @@ -228,11 +249,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): """ @@ -241,8 +258,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') -- cgit v1.1 From 220ad858d3baf8b772cfddb8b657f9c799e98ddd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Date: Sat, 19 Oct 2019 17:34:37 +0200 Subject: tests/ssh_linux_malta: Fix 64-bit target tests MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Commit 9090d3332cdcc added tests for specific to the 32-bit machines, which inadvertently make the 64-bit tests failing. Now than we have this information available in the CPU_INFO array, use it to have the 64-bit tests back. Signed-off-by: Philippe Mathieu-Daudé Signed-off-by: Aleksandar Markovic Reviewed-by: Aleksandar Markovic Message-Id: <20191019153437.9820-12-f4bug@amsat.org> --- tests/acceptance/linux_ssh_mips_malta.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'tests') diff --git a/tests/acceptance/linux_ssh_mips_malta.py b/tests/acceptance/linux_ssh_mips_malta.py index 14b8a5b..aa12001 100644 --- a/tests/acceptance/linux_ssh_mips_malta.py +++ b/tests/acceptance/linux_ssh_mips_malta.py @@ -43,8 +43,8 @@ class LinuxSSH(Test): } } CPU_INFO = { - 32: {'kernel_release': '3.2.0-4-4kc-malta'}, - 64: {'kernel_release': '3.2.0-4-5kc-malta'} + 32: {'cpu': 'MIPS 24Kc', 'kernel_release': '3.2.0-4-4kc-malta'}, + 64: {'cpu': 'MIPS 20Kc', 'kernel_release': '3.2.0-4-5kc-malta'} } def get_url(self, endianess, path=''): @@ -155,16 +155,16 @@ class LinuxSSH(Test): else: self.fail('"%s" output does not contain "%s"' % (cmd, exp)) - def run_common_commands(self): + def run_common_commands(self, wordsize): self.ssh_command_output_contains( 'cat /proc/cpuinfo', - '24Kc') + self.CPU_INFO[wordsize]['cpu']) self.ssh_command_output_contains( 'uname -m', 'mips') self.ssh_command_output_contains( 'uname -r', - '3.2.0-4-4kc-malta') + self.CPU_INFO[wordsize]['kernel_release']) self.ssh_command_output_contains( 'cat /proc/interrupts', 'XT-PIC timer') @@ -221,7 +221,7 @@ class LinuxSSH(Test): stdout, _ = self.ssh_command('uname -a') self.assertIn(True, [uname_m + " GNU/Linux" in line for line in stdout]) - self.run_common_commands() + self.run_common_commands(wordsize) self.shutdown_via_ssh() def test_mips_malta32eb_kernel3_2_0(self): -- cgit v1.1