All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2 00/11] tests/acceptance: Fix 64-bit MIPS target tests
@ 2019-10-19 15:34 Philippe Mathieu-Daudé
  2019-10-19 15:34 ` [PATCH v2 01/11] Acceptance tests: refactor wait_for_console_pattern Philippe Mathieu-Daudé
                   ` (11 more replies)
  0 siblings, 12 replies; 24+ messages in thread
From: Philippe Mathieu-Daudé @ 2019-10-19 15:34 UTC (permalink / raw)
  To: qemu-devel
  Cc: Eduardo Habkost, Philippe Mathieu-Daudé,
	Aleksandar Markovic, Cleber Rosa, Aleksandar Rikalo,
	Aurelien Jarno

v2:
- Fixed GIT_COMMITTER_NAME
- do no include Aleksandar Rikalo mailmap change

Commit 9090d3332cdcc introduced a regression which makes the
64-bit target tests to fail.

This series fix it (by previously refactoring the linux_ssh_malta
test), and also add another test for the 5KEc CPU.

I had to include Avocado-related patches not yet merged again to
avoid sending patches that will later not apply.

Please review,

Phil.

Cleber Rosa (1):
  Acceptance tests: refactor wait_for_console_pattern

Philippe Mathieu-Daudé (10):
  tests/acceptance: Fixe wait_for_console_pattern() hangs
  tests/acceptance: Send <carriage return> on serial lines
  tests/acceptance: Refactor exec_command_and_wait_for_pattern()
  tests/boot_linux_console: Use Avocado archive::gzip_uncompress()
  tests/boot_linux_console: Run BusyBox on 5KEc 64-bit cpu
  tests/ssh_linux_malta: Run tests using a snapshot image
  tests/ssh_linux_malta: Remove duplicated test
  tests/ssh_linux_malta: Match stricter console output
  tests/ssh_linux_malta: Refactor how to get image/kernel info
  tests/ssh_linux_malta: Fix 64-bit target tests

 tests/acceptance/avocado_qemu/__init__.py |  45 ++++++++
 tests/acceptance/boot_linux_console.py    |  88 ++++++++-------
 tests/acceptance/linux_ssh_mips_malta.py  | 124 +++++++++++-----------
 3 files changed, 158 insertions(+), 99 deletions(-)

-- 
2.21.0



^ permalink raw reply	[flat|nested] 24+ messages in thread

* [PATCH v2 01/11] Acceptance tests: refactor wait_for_console_pattern
  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 ` 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é
                   ` (10 subsequent siblings)
  11 siblings, 1 reply; 24+ messages in thread
From: Philippe Mathieu-Daudé @ 2019-10-19 15:34 UTC (permalink / raw)
  To: qemu-devel
  Cc: Eduardo Habkost, Aleksandar Markovic, Cleber Rosa,
	Aleksandar Rikalo, Philippe Mathieu-Daudé,
	Aurelien Jarno

From: Cleber Rosa <crosa@redhat.com>

The same utility method is already present in two different test
files, so let's consolidate it into a single utility function.

Signed-off-by: Cleber Rosa <crosa@redhat.com>
Message-Id: <20190916164011.7653-1-crosa@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
[PMD: failure_message is optional]
Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
---
 tests/acceptance/avocado_qemu/__init__.py | 25 +++++++++++++++++++++
 tests/acceptance/boot_linux_console.py    | 27 +++++------------------
 tests/acceptance/linux_ssh_mips_malta.py  | 18 +++------------
 3 files changed, 33 insertions(+), 37 deletions(-)

diff --git a/tests/acceptance/avocado_qemu/__init__.py b/tests/acceptance/avocado_qemu/__init__.py
index bd41e0443c..e3101cba30 100644
--- a/tests/acceptance/avocado_qemu/__init__.py
+++ b/tests/acceptance/avocado_qemu/__init__.py
@@ -8,6 +8,7 @@
 # This work is licensed under the terms of the GNU GPL, version 2 or
 # later.  See the COPYING file in the top-level directory.
 
+import logging
 import os
 import sys
 import uuid
@@ -53,6 +54,30 @@ def pick_default_qemu_bin(arch=None):
         return qemu_bin_from_src_dir_path
 
 
+def wait_for_console_pattern(test, success_message, failure_message=None):
+    """
+    Waits for messages to appear on the console, while logging the content
+
+    :param test: an Avocado test containing a VM that will have its console
+                 read and probed for a success or failure message
+    :type test: :class:`avocado_qemu.Test`
+    :param success_message: if this message appears, test succeeds
+    :param failure_message: if this message appears, test fails
+    """
+    console = test.vm.console_socket.makefile()
+    console_logger = logging.getLogger('console')
+    while True:
+        msg = console.readline().strip()
+        if not msg:
+            continue
+        console_logger.debug(msg)
+        if success_message in msg:
+            break
+        if failure_message and failure_message in msg:
+            fail = 'Failure message found in console: %s' % failure_message
+            test.fail(fail)
+
+
 class Test(avocado.Test):
     def setUp(self):
         self._vms = {}
diff --git a/tests/acceptance/boot_linux_console.py b/tests/acceptance/boot_linux_console.py
index 8a9a314ab4..8897e0c253 100644
--- a/tests/acceptance/boot_linux_console.py
+++ b/tests/acceptance/boot_linux_console.py
@@ -9,12 +9,12 @@
 # later.  See the COPYING file in the top-level directory.
 
 import os
-import logging
 import lzma
 import gzip
 import shutil
 
 from avocado_qemu import Test
+from avocado_qemu import wait_for_console_pattern
 from avocado.utils import process
 from avocado.utils import archive
 
@@ -29,31 +29,14 @@ class BootLinuxConsole(Test):
 
     KERNEL_COMMON_COMMAND_LINE = 'printk.time=0 '
 
-    def wait_for_console_pattern(self, success_message,
-                                 failure_message='Kernel panic - not syncing'):
-        """
-        Waits for messages to appear on the console, while logging the content
-
-        :param success_message: if this message appears, test succeeds
-        :param failure_message: if this message appears, test fails
-        """
-        console = self.vm.console_socket.makefile()
-        console_logger = logging.getLogger('console')
-        while True:
-            msg = console.readline().strip()
-            if not msg:
-                continue
-            console_logger.debug(msg)
-            if success_message in msg:
-                break
-            if failure_message in msg:
-                fail = 'Failure message found in console: %s' % failure_message
-                self.fail(fail)
+    def wait_for_console_pattern(self, success_message):
+        wait_for_console_pattern(self, success_message,
+                                 failure_message='Kernel panic - not syncing')
 
     def exec_command_and_wait_for_pattern(self, command, success_message):
         command += '\n'
         self.vm.console_socket.sendall(command.encode())
-        self.wait_for_console_pattern(success_message)
+        wait_for_console_pattern(self, success_message)
 
     def extract_from_deb(self, deb, path):
         """
diff --git a/tests/acceptance/linux_ssh_mips_malta.py b/tests/acceptance/linux_ssh_mips_malta.py
index 25a1df5098..ffbb06f846 100644
--- a/tests/acceptance/linux_ssh_mips_malta.py
+++ b/tests/acceptance/linux_ssh_mips_malta.py
@@ -13,6 +13,7 @@ import time
 
 from avocado import skipUnless
 from avocado_qemu import Test
+from avocado_qemu import wait_for_console_pattern
 from avocado.utils import process
 from avocado.utils import archive
 from avocado.utils import ssh
@@ -40,19 +41,6 @@ class LinuxSSH(Test):
     def setUp(self):
         super(LinuxSSH, self).setUp()
 
-    def wait_for_console_pattern(self, success_message,
-                                 failure_message='Oops'):
-        console = self.vm.console_socket.makefile()
-        console_logger = logging.getLogger('console')
-        while True:
-            msg = console.readline()
-            console_logger.debug(msg.strip())
-            if success_message in msg:
-                break
-            if failure_message in msg:
-                fail = 'Failure message found in console: %s' % failure_message
-                self.fail(fail)
-
     def get_portfwd(self):
         res = self.vm.command('human-monitor-command',
                               command_line='info usernet')
@@ -109,7 +97,7 @@ class LinuxSSH(Test):
 
         self.log.info('VM launched, waiting for sshd')
         console_pattern = 'Starting OpenBSD Secure Shell server: sshd'
-        self.wait_for_console_pattern(console_pattern)
+        wait_for_console_pattern(self, console_pattern, 'Oops')
         self.log.info('sshd ready')
 
         self.ssh_connect('root', 'root')
@@ -117,7 +105,7 @@ class LinuxSSH(Test):
     def shutdown_via_ssh(self):
         self.ssh_command('poweroff')
         self.ssh_disconnect_vm()
-        self.wait_for_console_pattern('Power down')
+        wait_for_console_pattern(self, 'Power down', 'Oops')
 
     def ssh_command_output_contains(self, cmd, exp):
         stdout, _ = self.ssh_command(cmd)
-- 
2.21.0



^ permalink raw reply related	[flat|nested] 24+ messages in thread

* [PATCH v2 02/11] tests/acceptance: Fixe wait_for_console_pattern() hangs
  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-19 15:34 ` 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é
                   ` (9 subsequent siblings)
  11 siblings, 1 reply; 24+ messages in thread
From: Philippe Mathieu-Daudé @ 2019-10-19 15:34 UTC (permalink / raw)
  To: qemu-devel
  Cc: Eduardo Habkost, Aleksandar Markovic, Cleber Rosa,
	Aleksandar Rikalo, Philippe Mathieu-Daudé,
	Aurelien Jarno

From: Philippe Mathieu-Daudé <philmd@redhat.com>

Because of a possible deadlock (QEMU waiting for the socket to
become writable) let's close the console socket as soon as we
stop to use it.

Suggested-by: Cleber Rosa <crosa@redhat.com>
Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
---
 tests/acceptance/avocado_qemu/__init__.py | 1 +
 1 file changed, 1 insertion(+)

diff --git a/tests/acceptance/avocado_qemu/__init__.py b/tests/acceptance/avocado_qemu/__init__.py
index e3101cba30..a0450e5263 100644
--- a/tests/acceptance/avocado_qemu/__init__.py
+++ b/tests/acceptance/avocado_qemu/__init__.py
@@ -74,6 +74,7 @@ def wait_for_console_pattern(test, success_message, failure_message=None):
         if success_message in msg:
             break
         if failure_message and failure_message in msg:
+            console.close()
             fail = 'Failure message found in console: %s' % failure_message
             test.fail(fail)
 
-- 
2.21.0



^ permalink raw reply related	[flat|nested] 24+ messages in thread

* [PATCH v2 03/11] tests/acceptance: Send <carriage return> on serial lines
  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-19 15:34 ` [PATCH v2 02/11] tests/acceptance: Fixe wait_for_console_pattern() hangs Philippe Mathieu-Daudé
@ 2019-10-19 15:34 ` Philippe Mathieu-Daudé
  2019-10-19 15:34 ` [PATCH v2 04/11] tests/acceptance: Refactor exec_command_and_wait_for_pattern() Philippe Mathieu-Daudé
                   ` (8 subsequent siblings)
  11 siblings, 0 replies; 24+ messages in thread
From: Philippe Mathieu-Daudé @ 2019-10-19 15:34 UTC (permalink / raw)
  To: qemu-devel
  Cc: Eduardo Habkost, Philippe Mathieu-Daudé,
	Aleksandar Markovic, Cleber Rosa, Aleksandar Rikalo,
	Aurelien Jarno

Some firmwares don't parse the <Newline> control character and
expect a <carriage return>.

Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
---
 tests/acceptance/boot_linux_console.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tests/acceptance/boot_linux_console.py b/tests/acceptance/boot_linux_console.py
index 8897e0c253..497faa4f7f 100644
--- a/tests/acceptance/boot_linux_console.py
+++ b/tests/acceptance/boot_linux_console.py
@@ -34,7 +34,7 @@ class BootLinuxConsole(Test):
                                  failure_message='Kernel panic - not syncing')
 
     def exec_command_and_wait_for_pattern(self, command, success_message):
-        command += '\n'
+        command += '\r\n'
         self.vm.console_socket.sendall(command.encode())
         wait_for_console_pattern(self, success_message)
 
-- 
2.21.0



^ permalink raw reply related	[flat|nested] 24+ messages in thread

* [PATCH v2 04/11] tests/acceptance: Refactor exec_command_and_wait_for_pattern()
  2019-10-19 15:34 [PATCH v2 00/11] tests/acceptance: Fix 64-bit MIPS target tests Philippe Mathieu-Daudé
                   ` (2 preceding siblings ...)
  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 ` Philippe Mathieu-Daudé
  2019-10-19 15:34 ` [PATCH v2 05/11] tests/boot_linux_console: Use Avocado archive::gzip_uncompress() Philippe Mathieu-Daudé
                   ` (7 subsequent siblings)
  11 siblings, 0 replies; 24+ messages in thread
From: Philippe Mathieu-Daudé @ 2019-10-19 15:34 UTC (permalink / raw)
  To: qemu-devel
  Cc: Eduardo Habkost, Aleksandar Markovic, Cleber Rosa,
	Aleksandar Rikalo, Philippe Mathieu-Daudé,
	Aurelien Jarno

From: Philippe Mathieu-Daudé <philmd@redhat.com>

The same utility method is already present in two different test
files, so let's consolidate it into a single utility function.

Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
---
v2: fix self -> test, failure_message is optional, added doc
---
 tests/acceptance/avocado_qemu/__init__.py | 19 +++++++++++++++++++
 tests/acceptance/boot_linux_console.py    | 18 +++++++-----------
 2 files changed, 26 insertions(+), 11 deletions(-)

diff --git a/tests/acceptance/avocado_qemu/__init__.py b/tests/acceptance/avocado_qemu/__init__.py
index a0450e5263..7bc77118dd 100644
--- a/tests/acceptance/avocado_qemu/__init__.py
+++ b/tests/acceptance/avocado_qemu/__init__.py
@@ -79,6 +79,25 @@ def wait_for_console_pattern(test, success_message, failure_message=None):
             test.fail(fail)
 
 
+def exec_command_and_wait_for_pattern(test, command,
+                                      success_message, failure_message=None):
+    """
+    Send a command to a console (appending CRLF characters), then wait
+    for success_message to appear on the console, while logging the.
+    content. Mark the test as failed if failure_message is found instead.
+
+    :param test: an Avocado test containing a VM that will have its console
+                 read and probed for a success or failure message
+    :type test: :class:`avocado_qemu.Test`
+    :param command: the command to send
+    :param success_message: if this message appears, test succeeds
+    :param failure_message: if this message appears, test fails
+    """
+    command += '\r\n'
+    test.vm.console_socket.sendall(command.encode())
+    wait_for_console_pattern(test, success_message, failure_message)
+
+
 class Test(avocado.Test):
     def setUp(self):
         self._vms = {}
diff --git a/tests/acceptance/boot_linux_console.py b/tests/acceptance/boot_linux_console.py
index 497faa4f7f..4b419b0559 100644
--- a/tests/acceptance/boot_linux_console.py
+++ b/tests/acceptance/boot_linux_console.py
@@ -14,6 +14,7 @@ import gzip
 import shutil
 
 from avocado_qemu import Test
+from avocado_qemu import exec_command_and_wait_for_pattern
 from avocado_qemu import wait_for_console_pattern
 from avocado.utils import process
 from avocado.utils import archive
@@ -33,11 +34,6 @@ class BootLinuxConsole(Test):
         wait_for_console_pattern(self, success_message,
                                  failure_message='Kernel panic - not syncing')
 
-    def exec_command_and_wait_for_pattern(self, command, success_message):
-        command += '\r\n'
-        self.vm.console_socket.sendall(command.encode())
-        wait_for_console_pattern(self, success_message)
-
     def extract_from_deb(self, deb, path):
         """
         Extracts a file from a deb package into the test workdir
@@ -166,12 +162,12 @@ class BootLinuxConsole(Test):
         self.vm.launch()
         self.wait_for_console_pattern('Boot successful.')
 
-        self.exec_command_and_wait_for_pattern('cat /proc/cpuinfo',
-                                               'BogoMIPS')
-        self.exec_command_and_wait_for_pattern('uname -a',
-                                               'Debian')
-        self.exec_command_and_wait_for_pattern('reboot',
-                                               'reboot: Restarting system')
+        exec_command_and_wait_for_pattern(self, 'cat /proc/cpuinfo',
+                                                'BogoMIPS')
+        exec_command_and_wait_for_pattern(self, 'uname -a',
+                                                'Debian')
+        exec_command_and_wait_for_pattern(self, 'reboot',
+                                                'reboot: Restarting system')
 
     def do_test_mips_malta32el_nanomips(self, kernel_url, kernel_hash):
         kernel_path_xz = self.fetch_asset(kernel_url, asset_hash=kernel_hash)
-- 
2.21.0



^ permalink raw reply related	[flat|nested] 24+ messages in thread

* [PATCH v2 05/11] tests/boot_linux_console: Use Avocado archive::gzip_uncompress()
  2019-10-19 15:34 [PATCH v2 00/11] tests/acceptance: Fix 64-bit MIPS target tests Philippe Mathieu-Daudé
                   ` (3 preceding siblings ...)
  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 ` 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é
                   ` (6 subsequent siblings)
  11 siblings, 0 replies; 24+ messages in thread
From: Philippe Mathieu-Daudé @ 2019-10-19 15:34 UTC (permalink / raw)
  To: qemu-devel
  Cc: Eduardo Habkost, Philippe Mathieu-Daudé,
	Aleksandar Markovic, Cleber Rosa, Aleksandar Rikalo,
	Aurelien Jarno

Avocado 67.0 [*] introduced the avocado.utils.archive module which
provides handling of gzip files. Use the gzip_uncompress() method.

[*] https://avocado-framework.readthedocs.io/en/67.0/api/utils/avocado.utils.html#avocado.utils.archive.gzip_uncompress

Suggested-by: Cleber Rosa <crosa@redhat.com>
Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
---
v2: New patch replacing the gunzip() refactor
---
 tests/acceptance/boot_linux_console.py | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/tests/acceptance/boot_linux_console.py b/tests/acceptance/boot_linux_console.py
index 4b419b0559..67d7e96d98 100644
--- a/tests/acceptance/boot_linux_console.py
+++ b/tests/acceptance/boot_linux_console.py
@@ -145,10 +145,7 @@ class BootLinuxConsole(Test):
         initrd_hash = 'bf806e17009360a866bf537f6de66590de349a99'
         initrd_path_gz = self.fetch_asset(initrd_url, asset_hash=initrd_hash)
         initrd_path = self.workdir + "rootfs.cpio"
-
-        with gzip.open(initrd_path_gz, 'rb') as f_in:
-            with open(initrd_path, 'wb') as f_out:
-                shutil.copyfileobj(f_in, f_out)
+        archive.gzip_uncompress(initrd_path_gz, initrd_path)
 
         self.vm.set_machine('malta')
         self.vm.set_console()
-- 
2.21.0



^ permalink raw reply related	[flat|nested] 24+ messages in thread

* [PATCH v2 06/11] tests/boot_linux_console: Run BusyBox on 5KEc 64-bit cpu
  2019-10-19 15:34 [PATCH v2 00/11] tests/acceptance: Fix 64-bit MIPS target tests Philippe Mathieu-Daudé
                   ` (4 preceding siblings ...)
  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 ` 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é
                   ` (5 subsequent siblings)
  11 siblings, 0 replies; 24+ messages in thread
From: Philippe Mathieu-Daudé @ 2019-10-19 15:34 UTC (permalink / raw)
  To: qemu-devel
  Cc: Eduardo Habkost, Philippe Mathieu-Daudé,
	Aleksandar Markovic, Cleber Rosa, Aleksandar Rikalo,
	Aurelien Jarno

This tests boots a Linux kernel on a Malta machine up to a
busybox shell on the serial console. Few commands are executed
before halting the machine (via reboot).

We use the Fedora 24 kernel extracted from the image at:
https://fedoraproject.org/wiki/Architectures/MIPS
and the initrd cpio image from the kerneltests project:
https://kerneltests.org/

If MIPS is a target being built, "make check-acceptance" will
automatically include this test by the use of the "arch:mips" tags.

Alternatively, this test can be run using:

  $ avocado --show=console run -t arch:mips64el tests/acceptance/boot_linux_console.py
  console: [    0.000000] Linux version 3.19.3.mtoman.20150408 (mtoman@debian-co3-1) (gcc version 5.0.0 20150316 (Red Hat 5.0.0-0.20) (GCC) ) #3 Wed Apr 8 14:32:50 UTC 2015
  console: [    0.000000] Early serial console at I/O port 0x3f8 (options '38400n8')
  console: [    0.000000] bootconsole [uart0] enabled
  console: [    0.000000] CPU0 revision is: 00018900 (MIPS 5KE)
  console: [    0.000000] Checking for the multiply/shift bug... no.
  console: [    0.000000] Checking for the daddiu bug... no.
  [...]
  console: Boot successful.
  console: cat /proc/cpuinfo
  console: / # cat /proc/cpuinfo
  console: system type            : MIPS Malta
  console: machine                        : Unknown
  console: processor              : 0
  console: cpu model              : MIPS 5KE V0.0
  console: : 1616.89
  console: wait instruction       : nouname -a
  console: microsecond timers     : yes
  console: tlb_entries            : 32
  console: extra interrupt vector : yes
  console: hardware watchpoint    : yes, count: 1, address/irw mask: [0x0ff8]
  console: isa                    : mips1 mips2 mips3 mips4 mips5 mips32r1 mips32r2 mips64r1 mips64r2
  console: ASEs implemented       :
  console: shadow register sets   : 1
  console: kscratch registers     : 0
  console: package                        : 0
  console: core                   : 0
  console: VCED exceptions                : not available
  console: VCEI exceptions                : not available
  console: / #
  console: / # uname -a
  console: Linux buildroot 3.19.3.mtoman.20150408 #3 Wed Apr 8 14:32:50 UTC 2015 mips64 GNU/Linux
  console: reboot
  console: / #
  console: / # reboot
  console: / #
  console: / # reboot: Restarting system
  PASS (7.04 s)
  JOB TIME   : 7.20 s

Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
---
 tests/acceptance/boot_linux_console.py | 40 ++++++++++++++++++++++++++
 1 file changed, 40 insertions(+)

diff --git a/tests/acceptance/boot_linux_console.py b/tests/acceptance/boot_linux_console.py
index 67d7e96d98..e505a41eed 100644
--- a/tests/acceptance/boot_linux_console.py
+++ b/tests/acceptance/boot_linux_console.py
@@ -166,6 +166,46 @@ class BootLinuxConsole(Test):
         exec_command_and_wait_for_pattern(self, 'reboot',
                                                 'reboot: Restarting system')
 
+    def test_mips64el_malta_5KEc_cpio(self):
+        """
+        :avocado: tags=arch:mips64el
+        :avocado: tags=machine:malta
+        :avocado: tags=endian:little
+        """
+        kernel_url = ('https://github.com/philmd/qemu-testing-blob/'
+                      'raw/9ad2df38/mips/malta/mips64el/'
+                      'vmlinux-3.19.3.mtoman.20150408')
+        kernel_hash = '00d1d268fb9f7d8beda1de6bebcc46e884d71754'
+        kernel_path = self.fetch_asset(kernel_url, asset_hash=kernel_hash)
+        initrd_url = ('https://github.com/groeck/linux-build-test/'
+                      'raw/8584a59e/rootfs/'
+                      'mipsel64/rootfs.mipsel64r1.cpio.gz')
+        initrd_hash = '1dbb8a396e916847325284dbe2151167'
+        initrd_path_gz = self.fetch_asset(initrd_url, algorithm='md5',
+                                          asset_hash=initrd_hash)
+        initrd_path = self.workdir + "rootfs.cpio"
+        archive.gzip_uncompress(initrd_path_gz, initrd_path)
+
+        self.vm.set_machine('malta')
+        self.vm.set_console()
+        kernel_command_line = (self.KERNEL_COMMON_COMMAND_LINE
+                               + 'console=ttyS0 console=tty '
+                               + 'rdinit=/sbin/init noreboot')
+        self.vm.add_args('-cpu', '5KEc',
+                         '-kernel', kernel_path,
+                         '-initrd', initrd_path,
+                         '-append', kernel_command_line,
+                         '-no-reboot')
+        self.vm.launch()
+        wait_for_console_pattern(self, 'Boot successful.')
+
+        exec_command_and_wait_for_pattern(self, 'cat /proc/cpuinfo',
+                                                'MIPS 5KE')
+        exec_command_and_wait_for_pattern(self, 'uname -a',
+                                                '3.19.3.mtoman.20150408')
+        exec_command_and_wait_for_pattern(self, 'reboot',
+                                                'reboot: Restarting system')
+
     def do_test_mips_malta32el_nanomips(self, kernel_url, kernel_hash):
         kernel_path_xz = self.fetch_asset(kernel_url, asset_hash=kernel_hash)
         kernel_path = self.workdir + "kernel"
-- 
2.21.0



^ permalink raw reply related	[flat|nested] 24+ messages in thread

* [PATCH v2 07/11] tests/ssh_linux_malta: Run tests using a snapshot image
  2019-10-19 15:34 [PATCH v2 00/11] tests/acceptance: Fix 64-bit MIPS target tests Philippe Mathieu-Daudé
                   ` (5 preceding siblings ...)
  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 ` Philippe Mathieu-Daudé
  2019-10-19 15:52   ` Aleksandar Markovic
  2020-01-18 11:32   ` Philippe Mathieu-Daudé
  2019-10-19 15:34 ` [PATCH v2 08/11] tests/ssh_linux_malta: Remove duplicated test Philippe Mathieu-Daudé
                   ` (4 subsequent siblings)
  11 siblings, 2 replies; 24+ messages in thread
From: Philippe Mathieu-Daudé @ 2019-10-19 15:34 UTC (permalink / raw)
  To: qemu-devel
  Cc: Eduardo Habkost, Philippe Mathieu-Daudé,
	Aleksandar Markovic, Cleber Rosa, Aleksandar Rikalo,
	Aurelien Jarno

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é <f4bug@amsat.org>
---
 tests/acceptance/linux_ssh_mips_malta.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tests/acceptance/linux_ssh_mips_malta.py b/tests/acceptance/linux_ssh_mips_malta.py
index ffbb06f846..27907e8fbd 100644
--- a/tests/acceptance/linux_ssh_mips_malta.py
+++ b/tests/acceptance/linux_ssh_mips_malta.py
@@ -90,7 +90,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()
-- 
2.21.0



^ permalink raw reply related	[flat|nested] 24+ messages in thread

* [PATCH v2 08/11] tests/ssh_linux_malta: Remove duplicated test
  2019-10-19 15:34 [PATCH v2 00/11] tests/acceptance: Fix 64-bit MIPS target tests Philippe Mathieu-Daudé
                   ` (6 preceding siblings ...)
  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:34 ` 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é
                   ` (3 subsequent siblings)
  11 siblings, 1 reply; 24+ messages in thread
From: Philippe Mathieu-Daudé @ 2019-10-19 15:34 UTC (permalink / raw)
  To: qemu-devel
  Cc: Eduardo Habkost, Philippe Mathieu-Daudé,
	Aleksandar Markovic, Cleber Rosa, Aleksandar Rikalo,
	Aurelien Jarno

Remove duplicated test (probably copy/paste error in
commit 9090d3332cdcc).

Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
---
 tests/acceptance/linux_ssh_mips_malta.py | 3 ---
 1 file changed, 3 deletions(-)

diff --git a/tests/acceptance/linux_ssh_mips_malta.py b/tests/acceptance/linux_ssh_mips_malta.py
index 27907e8fbd..5523ae2144 100644
--- a/tests/acceptance/linux_ssh_mips_malta.py
+++ b/tests/acceptance/linux_ssh_mips_malta.py
@@ -140,9 +140,6 @@ class LinuxSSH(Test):
         self.ssh_command_output_contains(
             'cat /proc/interrupts',
             'eth0')
-        self.ssh_command_output_contains(
-            'cat /proc/interrupts',
-            'eth0')
         self.ssh_command_output_contains(
             'cat /proc/devices',
             'input')
-- 
2.21.0



^ permalink raw reply related	[flat|nested] 24+ messages in thread

* [PATCH v2 09/11] tests/ssh_linux_malta: Match stricter console output
  2019-10-19 15:34 [PATCH v2 00/11] tests/acceptance: Fix 64-bit MIPS target tests Philippe Mathieu-Daudé
                   ` (7 preceding siblings ...)
  2019-10-19 15:34 ` [PATCH v2 08/11] tests/ssh_linux_malta: Remove duplicated test Philippe Mathieu-Daudé
@ 2019-10-19 15:34 ` Philippe Mathieu-Daudé
  2019-10-19 15:50   ` Aleksandar Markovic
  2019-10-19 15:34 ` [PATCH v2 10/11] tests/ssh_linux_malta: Refactor how to get image/kernel info Philippe Mathieu-Daudé
                   ` (2 subsequent siblings)
  11 siblings, 1 reply; 24+ messages in thread
From: Philippe Mathieu-Daudé @ 2019-10-19 15:34 UTC (permalink / raw)
  To: qemu-devel
  Cc: Eduardo Habkost, Philippe Mathieu-Daudé,
	Aleksandar Markovic, Cleber Rosa, Aleksandar Rikalo,
	Aurelien Jarno

Match on stricter console output.

Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
---
 tests/acceptance/linux_ssh_mips_malta.py | 18 +++++++++---------
 1 file changed, 9 insertions(+), 9 deletions(-)

diff --git a/tests/acceptance/linux_ssh_mips_malta.py b/tests/acceptance/linux_ssh_mips_malta.py
index 5523ae2144..822b0553ff 100644
--- a/tests/acceptance/linux_ssh_mips_malta.py
+++ b/tests/acceptance/linux_ssh_mips_malta.py
@@ -127,19 +127,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')
@@ -151,13 +151,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')
@@ -167,7 +167,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')
-- 
2.21.0



^ permalink raw reply related	[flat|nested] 24+ messages in thread

* [PATCH v2 10/11] tests/ssh_linux_malta: Refactor how to get image/kernel info
  2019-10-19 15:34 [PATCH v2 00/11] tests/acceptance: Fix 64-bit MIPS target tests Philippe Mathieu-Daudé
                   ` (8 preceding siblings ...)
  2019-10-19 15:34 ` [PATCH v2 09/11] tests/ssh_linux_malta: Match stricter console output Philippe Mathieu-Daudé
@ 2019-10-19 15:34 ` Philippe Mathieu-Daudé
  2019-10-19 15:51   ` 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-24  9:23 ` [PATCH 00/11] tests/acceptance: Fix 64-bit MIPS " Aleksandar Markovic
  11 siblings, 1 reply; 24+ messages in thread
From: Philippe Mathieu-Daudé @ 2019-10-19 15:34 UTC (permalink / raw)
  To: qemu-devel
  Cc: Eduardo Habkost, Philippe Mathieu-Daudé,
	Aleksandar Markovic, Cleber Rosa, Aleksandar Rikalo,
	Aurelien Jarno

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



^ permalink raw reply related	[flat|nested] 24+ messages in thread

* [PATCH v2 11/11] tests/ssh_linux_malta: Fix 64-bit target tests
  2019-10-19 15:34 [PATCH v2 00/11] tests/acceptance: Fix 64-bit MIPS target tests Philippe Mathieu-Daudé
                   ` (9 preceding siblings ...)
  2019-10-19 15:34 ` [PATCH v2 10/11] tests/ssh_linux_malta: Refactor how to get image/kernel info Philippe Mathieu-Daudé
@ 2019-10-19 15:34 ` 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
  11 siblings, 1 reply; 24+ messages in thread
From: Philippe Mathieu-Daudé @ 2019-10-19 15:34 UTC (permalink / raw)
  To: qemu-devel
  Cc: Eduardo Habkost, Philippe Mathieu-Daudé,
	Aleksandar Markovic, Cleber Rosa, Aleksandar Rikalo,
	Aurelien Jarno

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é <f4bug@amsat.org>
---
v2: do not include Aleksandar Rikalo mailmap change
---
 tests/acceptance/linux_ssh_mips_malta.py | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/tests/acceptance/linux_ssh_mips_malta.py b/tests/acceptance/linux_ssh_mips_malta.py
index 2139c80f5f..fc13f9e4d4 100644
--- a/tests/acceptance/linux_ssh_mips_malta.py
+++ b/tests/acceptance/linux_ssh_mips_malta.py
@@ -44,8 +44,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=''):
@@ -143,16 +143,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')
@@ -209,7 +209,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):
-- 
2.21.0



^ permalink raw reply related	[flat|nested] 24+ messages in thread

* Re: [PATCH v2 09/11] tests/ssh_linux_malta: Match stricter console output
  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
  0 siblings, 0 replies; 24+ messages in thread
From: Aleksandar Markovic @ 2019-10-19 15:50 UTC (permalink / raw)
  To: Philippe Mathieu-Daudé
  Cc: Eduardo Habkost, qemu-devel, Aleksandar Markovic, Cleber Rosa,
	Aleksandar Rikalo, Aurelien Jarno

[-- Attachment #1: Type: text/plain, Size: 2537 bytes --]

On Saturday, October 19, 2019, Philippe Mathieu-Daudé <f4bug@amsat.org>
wrote:

> Match on stricter console output.
>
> Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
> ---
>  tests/acceptance/linux_ssh_mips_malta.py | 18 +++++++++---------
>  1 file changed, 9 insertions(+), 9 deletions(-)
>
>
Reviewed-by: Aleksandar Markovic <amarkovic@wavecomp.com>


> diff --git a/tests/acceptance/linux_ssh_mips_malta.py
> b/tests/acceptance/linux_ssh_mips_malta.py
> index 5523ae2144..822b0553ff 100644
> --- a/tests/acceptance/linux_ssh_mips_malta.py
> +++ b/tests/acceptance/linux_ssh_mips_malta.py
> @@ -127,19 +127,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')
> @@ -151,13 +151,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')
> @@ -167,7 +167,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')
> --
> 2.21.0
>
>
>

[-- Attachment #2: Type: text/html, Size: 3985 bytes --]

^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: [PATCH v2 11/11] tests/ssh_linux_malta: Fix 64-bit target tests
  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
  0 siblings, 0 replies; 24+ messages in thread
From: Aleksandar Markovic @ 2019-10-19 15:50 UTC (permalink / raw)
  To: Philippe Mathieu-Daudé
  Cc: Eduardo Habkost, qemu-devel, Aleksandar Markovic, Cleber Rosa,
	Aleksandar Rikalo, Aurelien Jarno

[-- Attachment #1: Type: text/plain, Size: 2472 bytes --]

On Saturday, October 19, 2019, Philippe Mathieu-Daudé <f4bug@amsat.org>
wrote:

> 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é <f4bug@amsat.org>
> ---
> v2: do not include Aleksandar Rikalo mailmap change
> ---
>  tests/acceptance/linux_ssh_mips_malta.py | 12 ++++++------
>  1 file changed, 6 insertions(+), 6 deletions(-)
>
>
Reviewed-by: Aleksandar Markovic <amarkovic@wavecomp.com>


> diff --git a/tests/acceptance/linux_ssh_mips_malta.py
> b/tests/acceptance/linux_ssh_mips_malta.py
> index 2139c80f5f..fc13f9e4d4 100644
> --- a/tests/acceptance/linux_ssh_mips_malta.py
> +++ b/tests/acceptance/linux_ssh_mips_malta.py
> @@ -44,8 +44,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=''):
> @@ -143,16 +143,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')
> @@ -209,7 +209,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):
> --
> 2.21.0
>
>
>

[-- Attachment #2: Type: text/html, Size: 3695 bytes --]

^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: [PATCH v2 08/11] tests/ssh_linux_malta: Remove duplicated test
  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
  0 siblings, 0 replies; 24+ messages in thread
From: Aleksandar Markovic @ 2019-10-19 15:51 UTC (permalink / raw)
  To: Philippe Mathieu-Daudé
  Cc: Eduardo Habkost, qemu-devel, Aleksandar Markovic, Cleber Rosa,
	Aleksandar Rikalo, Aurelien Jarno

[-- Attachment #1: Type: text/plain, Size: 1033 bytes --]

On Saturday, October 19, 2019, Philippe Mathieu-Daudé <f4bug@amsat.org>
wrote:

> Remove duplicated test (probably copy/paste error in
> commit 9090d3332cdcc).
>
> Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
> ---
>  tests/acceptance/linux_ssh_mips_malta.py | 3 ---
>  1 file changed, 3 deletions(-)
>
>
Reviewed-by: Aleksandar Markovic <amarkovic@wavecomp.com>


> diff --git a/tests/acceptance/linux_ssh_mips_malta.py
> b/tests/acceptance/linux_ssh_mips_malta.py
> index 27907e8fbd..5523ae2144 100644
> --- a/tests/acceptance/linux_ssh_mips_malta.py
> +++ b/tests/acceptance/linux_ssh_mips_malta.py
> @@ -140,9 +140,6 @@ class LinuxSSH(Test):
>          self.ssh_command_output_contains(
>              'cat /proc/interrupts',
>              'eth0')
> -        self.ssh_command_output_contains(
> -            'cat /proc/interrupts',
> -            'eth0')
>          self.ssh_command_output_contains(
>              'cat /proc/devices',
>              'input')
> --
> 2.21.0
>
>
>

[-- Attachment #2: Type: text/html, Size: 1865 bytes --]

^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: [PATCH v2 10/11] tests/ssh_linux_malta: Refactor how to get image/kernel info
  2019-10-19 15:34 ` [PATCH v2 10/11] tests/ssh_linux_malta: Refactor how to get image/kernel info Philippe Mathieu-Daudé
@ 2019-10-19 15:51   ` Aleksandar Markovic
  0 siblings, 0 replies; 24+ messages in thread
From: Aleksandar Markovic @ 2019-10-19 15:51 UTC (permalink / raw)
  To: Philippe Mathieu-Daudé
  Cc: Eduardo Habkost, qemu-devel, Aleksandar Markovic, Cleber Rosa,
	Aleksandar Rikalo, Aurelien Jarno

[-- Attachment #1: Type: text/plain, Size: 6783 bytes --]

On Saturday, October 19, 2019, Philippe Mathieu-Daudé <f4bug@amsat.org>
wrote:

> 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(-)
>
>
Reviewed-by: Aleksandar Markovic <amarkovic@wavecomp.com>

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
>
>
>

[-- Attachment #2: Type: text/html, Size: 9857 bytes --]

^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: [PATCH v2 07/11] tests/ssh_linux_malta: Run tests using a snapshot image
  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é
  1 sibling, 0 replies; 24+ messages in thread
From: Aleksandar Markovic @ 2019-10-19 15:52 UTC (permalink / raw)
  To: Philippe Mathieu-Daudé
  Cc: Eduardo Habkost, qemu-devel, Aleksandar Markovic, Cleber Rosa,
	Aleksandar Rikalo, Aurelien Jarno

[-- Attachment #1: Type: text/plain, Size: 1237 bytes --]

On Saturday, October 19, 2019, Philippe Mathieu-Daudé <f4bug@amsat.org>
wrote:

> 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é <f4bug@amsat.org>
> ---
>  tests/acceptance/linux_ssh_mips_malta.py | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
>
Reviewed-by: Aleksandar Markovic <amarkovic@wavecomp.com>


> diff --git a/tests/acceptance/linux_ssh_mips_malta.py
> b/tests/acceptance/linux_ssh_mips_malta.py
> index ffbb06f846..27907e8fbd 100644
> --- a/tests/acceptance/linux_ssh_mips_malta.py
> +++ b/tests/acceptance/linux_ssh_mips_malta.py
> @@ -90,7 +90,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()
> --
> 2.21.0
>
>
>

[-- Attachment #2: Type: text/html, Size: 2117 bytes --]

^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: [PATCH v2 02/11] tests/acceptance: Fixe wait_for_console_pattern() hangs
  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
  0 siblings, 0 replies; 24+ messages in thread
From: Aleksandar Markovic @ 2019-10-24  9:23 UTC (permalink / raw)
  To: Philippe Mathieu-Daudé
  Cc: Eduardo Habkost, qemu-devel, Aleksandar Markovic, Cleber Rosa,
	Aleksandar Rikalo, Philippe Mathieu-Daudé,
	Aurelien Jarno

[-- Attachment #1: Type: text/plain, Size: 1208 bytes --]

On Saturday, October 19, 2019, Philippe Mathieu-Daudé <f4bug@amsat.org>
wrote:

> From: Philippe Mathieu-Daudé <philmd@redhat.com>
>
> Because of a possible deadlock (QEMU waiting for the socket to
> become writable) let's close the console socket as soon as we
> stop to use it.
>
> Suggested-by: Cleber Rosa <crosa@redhat.com>
> Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
> ---
>  tests/acceptance/avocado_qemu/__init__.py | 1 +
>  1 file changed, 1 insertion(+)
>
>

Reviewed-by: Aleksandar Markovic <amarkovic@wavecomp.com>


> diff --git a/tests/acceptance/avocado_qemu/__init__.py
> b/tests/acceptance/avocado_qemu/__init__.py
> index e3101cba30..a0450e5263 100644
> --- a/tests/acceptance/avocado_qemu/__init__.py
> +++ b/tests/acceptance/avocado_qemu/__init__.py
> @@ -74,6 +74,7 @@ def wait_for_console_pattern(test, success_message,
> failure_message=None):
>          if success_message in msg:
>              break
>          if failure_message and failure_message in msg:
> +            console.close()
>              fail = 'Failure message found in console: %s' %
> failure_message
>              test.fail(fail)
>
> --
> 2.21.0
>
>
>

[-- Attachment #2: Type: text/html, Size: 2726 bytes --]

^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: [PATCH 00/11] tests/acceptance: Fix 64-bit MIPS target tests
  2019-10-19 15:34 [PATCH v2 00/11] tests/acceptance: Fix 64-bit MIPS target tests Philippe Mathieu-Daudé
                   ` (10 preceding siblings ...)
  2019-10-19 15:34 ` [PATCH v2 11/11] tests/ssh_linux_malta: Fix 64-bit target tests Philippe Mathieu-Daudé
@ 2019-10-24  9:23 ` Aleksandar Markovic
  2019-10-25 16:46   ` Aleksandar Markovic
  11 siblings, 1 reply; 24+ messages in thread
From: Aleksandar Markovic @ 2019-10-24  9:23 UTC (permalink / raw)
  To: Philippe Mathieu-Daudé
  Cc: Eduardo Habkost, qemu-devel, Aleksandar Markovic, Cleber Rosa,
	Aleksandar Rikalo, Aurelien Jarno

[-- Attachment #1: Type: text/plain, Size: 1603 bytes --]

ping for Cleber and Eduardo

On Saturday, October 19, 2019, Philippe Mathieu-Daudé <f4bug@amsat.org>
wrote:

> v2:
> - Fixed GIT_COMMITTER_NAME
> - do no include Aleksandar Rikalo mailmap change
>
> Commit 9090d3332cdcc introduced a regression which makes the
> 64-bit target tests to fail.
>
> This series fix it (by previously refactoring the linux_ssh_malta
> test), and also add another test for the 5KEc CPU.
>
> I had to include Avocado-related patches not yet merged again to
> avoid sending patches that will later not apply.
>
> Please review,
>
> Phil.
>
> Cleber Rosa (1):
>   Acceptance tests: refactor wait_for_console_pattern
>
> Philippe Mathieu-Daudé (10):
>   tests/acceptance: Fixe wait_for_console_pattern() hangs
>   tests/acceptance: Send <carriage return> on serial lines
>   tests/acceptance: Refactor exec_command_and_wait_for_pattern()
>   tests/boot_linux_console: Use Avocado archive::gzip_uncompress()
>   tests/boot_linux_console: Run BusyBox on 5KEc 64-bit cpu
>   tests/ssh_linux_malta: Run tests using a snapshot image
>   tests/ssh_linux_malta: Remove duplicated test
>   tests/ssh_linux_malta: Match stricter console output
>   tests/ssh_linux_malta: Refactor how to get image/kernel info
>   tests/ssh_linux_malta: Fix 64-bit target tests
>
>  tests/acceptance/avocado_qemu/__init__.py |  45 ++++++++
>  tests/acceptance/boot_linux_console.py    |  88 ++++++++-------
>  tests/acceptance/linux_ssh_mips_malta.py  | 124 +++++++++++-----------
>  3 files changed, 158 insertions(+), 99 deletions(-)
>
> --
> 2.21.0
>
>
>

[-- Attachment #2: Type: text/html, Size: 1903 bytes --]

^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: [PATCH v2 01/11] Acceptance tests: refactor wait_for_console_pattern
  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
  0 siblings, 0 replies; 24+ messages in thread
From: Aleksandar Markovic @ 2019-10-24  9:25 UTC (permalink / raw)
  To: Philippe Mathieu-Daudé
  Cc: Eduardo Habkost, qemu-devel, Aleksandar Markovic, Cleber Rosa,
	Aleksandar Rikalo, Philippe Mathieu-Daudé,
	Aurelien Jarno

[-- Attachment #1: Type: text/plain, Size: 6935 bytes --]

On Saturday, October 19, 2019, Philippe Mathieu-Daudé <f4bug@amsat.org>
wrote:

> From: Cleber Rosa <crosa@redhat.com>
>
> The same utility method is already present in two different test
> files, so let's consolidate it into a single utility function.
>
> Signed-off-by: Cleber Rosa <crosa@redhat.com>
> Message-Id: <20190916164011.7653-1-crosa@redhat.com>
> Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
> [PMD: failure_message is optional]
> Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
> ---
>  tests/acceptance/avocado_qemu/__init__.py | 25 +++++++++++++++++++++
>  tests/acceptance/boot_linux_console.py    | 27 +++++------------------
>  tests/acceptance/linux_ssh_mips_malta.py  | 18 +++------------
>  3 files changed, 33 insertions(+), 37 deletions(-)
>
>

Reviewed-by: Aleksandar Markovic <amarkovic@wavecomp.com>


> diff --git a/tests/acceptance/avocado_qemu/__init__.py
> b/tests/acceptance/avocado_qemu/__init__.py
> index bd41e0443c..e3101cba30 100644
> --- a/tests/acceptance/avocado_qemu/__init__.py
> +++ b/tests/acceptance/avocado_qemu/__init__.py
> @@ -8,6 +8,7 @@
>  # This work is licensed under the terms of the GNU GPL, version 2 or
>  # later.  See the COPYING file in the top-level directory.
>
> +import logging
>  import os
>  import sys
>  import uuid
> @@ -53,6 +54,30 @@ def pick_default_qemu_bin(arch=None):
>          return qemu_bin_from_src_dir_path
>
>
> +def wait_for_console_pattern(test, success_message, failure_message=None):
> +    """
> +    Waits for messages to appear on the console, while logging the content
> +
> +    :param test: an Avocado test containing a VM that will have its
> console
> +                 read and probed for a success or failure message
> +    :type test: :class:`avocado_qemu.Test`
> +    :param success_message: if this message appears, test succeeds
> +    :param failure_message: if this message appears, test fails
> +    """
> +    console = test.vm.console_socket.makefile()
> +    console_logger = logging.getLogger('console')
> +    while True:
> +        msg = console.readline().strip()
> +        if not msg:
> +            continue
> +        console_logger.debug(msg)
> +        if success_message in msg:
> +            break
> +        if failure_message and failure_message in msg:
> +            fail = 'Failure message found in console: %s' %
> failure_message
> +            test.fail(fail)
> +
> +
>  class Test(avocado.Test):
>      def setUp(self):
>          self._vms = {}
> diff --git a/tests/acceptance/boot_linux_console.py
> b/tests/acceptance/boot_linux_console.py
> index 8a9a314ab4..8897e0c253 100644
> --- a/tests/acceptance/boot_linux_console.py
> +++ b/tests/acceptance/boot_linux_console.py
> @@ -9,12 +9,12 @@
>  # later.  See the COPYING file in the top-level directory.
>
>  import os
> -import logging
>  import lzma
>  import gzip
>  import shutil
>
>  from avocado_qemu import Test
> +from avocado_qemu import wait_for_console_pattern
>  from avocado.utils import process
>  from avocado.utils import archive
>
> @@ -29,31 +29,14 @@ class BootLinuxConsole(Test):
>
>      KERNEL_COMMON_COMMAND_LINE = 'printk.time=0 '
>
> -    def wait_for_console_pattern(self, success_message,
> -                                 failure_message='Kernel panic - not
> syncing'):
> -        """
> -        Waits for messages to appear on the console, while logging the
> content
> -
> -        :param success_message: if this message appears, test succeeds
> -        :param failure_message: if this message appears, test fails
> -        """
> -        console = self.vm.console_socket.makefile()
> -        console_logger = logging.getLogger('console')
> -        while True:
> -            msg = console.readline().strip()
> -            if not msg:
> -                continue
> -            console_logger.debug(msg)
> -            if success_message in msg:
> -                break
> -            if failure_message in msg:
> -                fail = 'Failure message found in console: %s' %
> failure_message
> -                self.fail(fail)
> +    def wait_for_console_pattern(self, success_message):
> +        wait_for_console_pattern(self, success_message,
> +                                 failure_message='Kernel panic - not
> syncing')
>
>      def exec_command_and_wait_for_pattern(self, command,
> success_message):
>          command += '\n'
>          self.vm.console_socket.sendall(command.encode())
> -        self.wait_for_console_pattern(success_message)
> +        wait_for_console_pattern(self, success_message)
>
>      def extract_from_deb(self, deb, path):
>          """
> diff --git a/tests/acceptance/linux_ssh_mips_malta.py
> b/tests/acceptance/linux_ssh_mips_malta.py
> index 25a1df5098..ffbb06f846 100644
> --- a/tests/acceptance/linux_ssh_mips_malta.py
> +++ b/tests/acceptance/linux_ssh_mips_malta.py
> @@ -13,6 +13,7 @@ import time
>
>  from avocado import skipUnless
>  from avocado_qemu import Test
> +from avocado_qemu import wait_for_console_pattern
>  from avocado.utils import process
>  from avocado.utils import archive
>  from avocado.utils import ssh
> @@ -40,19 +41,6 @@ class LinuxSSH(Test):
>      def setUp(self):
>          super(LinuxSSH, self).setUp()
>
> -    def wait_for_console_pattern(self, success_message,
> -                                 failure_message='Oops'):
> -        console = self.vm.console_socket.makefile()
> -        console_logger = logging.getLogger('console')
> -        while True:
> -            msg = console.readline()
> -            console_logger.debug(msg.strip())
> -            if success_message in msg:
> -                break
> -            if failure_message in msg:
> -                fail = 'Failure message found in console: %s' %
> failure_message
> -                self.fail(fail)
> -
>      def get_portfwd(self):
>          res = self.vm.command('human-monitor-command',
>                                command_line='info usernet')
> @@ -109,7 +97,7 @@ class LinuxSSH(Test):
>
>          self.log.info('VM launched, waiting for sshd')
>          console_pattern = 'Starting OpenBSD Secure Shell server: sshd'
> -        self.wait_for_console_pattern(console_pattern)
> +        wait_for_console_pattern(self, console_pattern, 'Oops')
>          self.log.info('sshd ready')
>
>          self.ssh_connect('root', 'root')
> @@ -117,7 +105,7 @@ class LinuxSSH(Test):
>      def shutdown_via_ssh(self):
>          self.ssh_command('poweroff')
>          self.ssh_disconnect_vm()
> -        self.wait_for_console_pattern('Power down')
> +        wait_for_console_pattern(self, 'Power down', 'Oops')
>
>      def ssh_command_output_contains(self, cmd, exp):
>          stdout, _ = self.ssh_command(cmd)
> --
> 2.21.0
>
>
>

[-- Attachment #2: Type: text/html, Size: 9710 bytes --]

^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: [PATCH 00/11] tests/acceptance: Fix 64-bit MIPS target tests
  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é
  0 siblings, 1 reply; 24+ messages in thread
From: Aleksandar Markovic @ 2019-10-25 16:46 UTC (permalink / raw)
  To: Philippe Mathieu-Daudé
  Cc: Eduardo Habkost, qemu-devel, Aleksandar Markovic, Cleber Rosa,
	Aleksandar Rikalo, Aurelien Jarno

On Thu, Oct 24, 2019 at 11:23 AM Aleksandar Markovic
<aleksandar.m.mail@gmail.com> wrote:
>
> ping for Cleber and Eduardo
>

I applied patches 7, 8, 9, 10, and 11 to MIPS queue.

Thanks for all involved!
Aleksandar


^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: [PATCH 00/11] tests/acceptance: Fix 64-bit MIPS target tests
  2019-10-25 16:46   ` Aleksandar Markovic
@ 2019-10-25 17:17     ` Philippe Mathieu-Daudé
  0 siblings, 0 replies; 24+ messages in thread
From: Philippe Mathieu-Daudé @ 2019-10-25 17:17 UTC (permalink / raw)
  To: Aleksandar Markovic, Philippe Mathieu-Daudé
  Cc: Eduardo Habkost, qemu-devel, Aleksandar Markovic, Cleber Rosa,
	Aleksandar Rikalo, Aurelien Jarno

On 10/25/19 6:46 PM, Aleksandar Markovic wrote:
> On Thu, Oct 24, 2019 at 11:23 AM Aleksandar Markovic
> <aleksandar.m.mail@gmail.com> wrote:
>>
>> ping for Cleber and Eduardo
>>
> 
> I applied patches 7, 8, 9, 10, and 11 to MIPS queue.

Thanks Aleksandar!


^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: [PATCH v2 07/11] tests/ssh_linux_malta: Run tests using a snapshot image
  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é
  1 sibling, 1 reply; 24+ messages in thread
From: Philippe Mathieu-Daudé @ 2020-01-18 11:32 UTC (permalink / raw)
  To: Philippe Mathieu-Daudé, qemu-devel
  Cc: Aurelien Jarno, Aleksandar Rikalo, Eduardo Habkost,
	Aleksandar Markovic, Cleber Rosa

Cleber, Eduardo: ping?

On 10/19/19 5:34 PM, Philippe Mathieu-Daudé wrote:
> 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é <f4bug@amsat.org>
> ---
>   tests/acceptance/linux_ssh_mips_malta.py | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/tests/acceptance/linux_ssh_mips_malta.py b/tests/acceptance/linux_ssh_mips_malta.py
> index ffbb06f846..27907e8fbd 100644
> --- a/tests/acceptance/linux_ssh_mips_malta.py
> +++ b/tests/acceptance/linux_ssh_mips_malta.py
> @@ -90,7 +90,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()
> 



^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: [PATCH v2 07/11] tests/ssh_linux_malta: Run tests using a snapshot image
  2020-01-18 11:32   ` Philippe Mathieu-Daudé
@ 2020-01-18 11:35     ` Philippe Mathieu-Daudé
  0 siblings, 0 replies; 24+ messages in thread
From: Philippe Mathieu-Daudé @ 2020-01-18 11:35 UTC (permalink / raw)
  To: Philippe Mathieu-Daudé, QEMU Developers
  Cc: Aurelien Jarno, Aleksandar Rikalo, Eduardo Habkost,
	Aleksandar Markovic, Cleber Rosa

On Sat, Jan 18, 2020 at 12:32 PM Philippe Mathieu-Daudé
<philmd@redhat.com> wrote:
>
> Cleber, Eduardo: ping?

Oops wrong patch =)

> On 10/19/19 5:34 PM, Philippe Mathieu-Daudé wrote:
> > 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é <f4bug@amsat.org>
> > ---
> >   tests/acceptance/linux_ssh_mips_malta.py | 2 +-
> >   1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/tests/acceptance/linux_ssh_mips_malta.py b/tests/acceptance/linux_ssh_mips_malta.py
> > index ffbb06f846..27907e8fbd 100644
> > --- a/tests/acceptance/linux_ssh_mips_malta.py
> > +++ b/tests/acceptance/linux_ssh_mips_malta.py
> > @@ -90,7 +90,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()
> >



^ permalink raw reply	[flat|nested] 24+ messages in thread

end of thread, other threads:[~2020-01-18 11:36 UTC | newest]

Thread overview: 24+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
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 ` [PATCH v2 10/11] tests/ssh_linux_malta: Refactor how to get image/kernel info Philippe Mathieu-Daudé
2019-10-19 15:51   ` 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é

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.