All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Philippe Mathieu-Daudé" <f4bug@amsat.org>
To: qemu-devel@nongnu.org
Cc: "Damien Hedde" <damien.hedde@greensocs.com>,
	"Huacai Chen" <zltjiangshi@gmail.com>,
	"Aleksandar Rikalo" <aleksandar.rikalo@syrmia.com>,
	"Eduardo Habkost" <ehabkost@redhat.com>,
	"Paul Burton" <paulburton@kernel.org>,
	"Thomas Huth" <huth@tuxfamily.org>,
	"Edgar E . Iglesias" <edgar.iglesias@gmail.com>,
	"Philippe Mathieu-Daudé" <f4bug@amsat.org>,
	"Wainer dos Santos Moschetta" <wainersm@redhat.com>,
	"Aleksandar Markovic" <aleksandar.qemu.devel@gmail.com>,
	"Hervé Poussineau" <hpoussin@reactos.org>,
	"Cleber Rosa" <crosa@redhat.com>,
	"Huacai Chen" <chenhc@lemote.com>,
	"Philippe Mathieu-Daudé" <philmd@redhat.com>,
	"Aurelien Jarno" <aurelien@aurel32.net>,
	"Richard Henderson" <rth@twiddle.net>
Subject: [PATCH 16/16] tests/acceptance: Test the MIPSsim machine
Date: Mon, 28 Sep 2020 19:15:39 +0200	[thread overview]
Message-ID: <20200928171539.788309-17-f4bug@amsat.org> (raw)
In-Reply-To: <20200928171539.788309-1-f4bug@amsat.org>

Add a test for the mipssim machine, based on the recommended
test setup from Thomas Huth:
https://www.mail-archive.com/qemu-devel@nongnu.org/msg606846.html

The test is quick and can be run as:

  $ avocado --show=console run -t machine:mipssim tests/acceptance/
   (1/1) tests/acceptance/machine_mips_mipssim.py:MipsSimMachine.test_mipssim_linux_console:
  console: Linux version 3.6.11 (root@711bb8ba16a7) (gcc version 4.8.3 (Buildroot 2014.11) ) #2 Sun Sep 27 13:39:35 UTC 2020
  console: Setting default memory size 0x02000000
  console: bootconsole [early0] enabled
  console: CPU revision is: 00019300 (MIPS 24Kc)
  console: FPU revision is: 00739300
  ...
  console: CPU frequency 12.00 MHz
  console: Calibrating delay loop... 950.27 BogoMIPS (lpj=4751360)
  ...
  console: MIPSNet Ethernet driver. Version: 2007-11-17. (c)2005 MIPS Technologies, Inc.
  ...
  console: Welcome to Buildroot
  console: buildroot login: root
  console: # root
  console: -sh: root: not found
  console: # ping -c 3 10.0.2.2
  console: PING 10.0.2.2 (10.0.2.2): 56 data bytes
  console: 64 bytes from 10.0.2.2: seq=0 ttl=255 time=48.231 ms
  console: 64 bytes from 10.0.2.2: seq=1 ttl=255 time=9.407 ms
  console: 64 bytes from 10.0.2.2: seq=2 ttl=255 time=2.298 ms
  console: --- 10.0.2.2 ping statistics ---
  console: 3 packets transmitted, 3 packets received, 0% packet loss
  PASS (7.99 s)

Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
---
Cc: Thomas Huth <huth@tuxfamily.org>
---
 MAINTAINERS                              |  1 +
 tests/acceptance/machine_mips_mipssim.py | 56 ++++++++++++++++++++++++
 2 files changed, 57 insertions(+)
 create mode 100644 tests/acceptance/machine_mips_mipssim.py

diff --git a/MAINTAINERS b/MAINTAINERS
index 5eed1e692b4..17d8a012b0e 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -240,6 +240,7 @@ F: include/hw/misc/mips_*
 F: include/hw/timer/mips_gictimer.h
 F: tests/acceptance/linux_ssh_mips_malta.py
 F: tests/acceptance/machine_mips_malta.py
+F: tests/acceptance/machine_mips_mipssim.py
 F: tests/tcg/mips/
 K: ^Subject:.*(?i)mips
 
diff --git a/tests/acceptance/machine_mips_mipssim.py b/tests/acceptance/machine_mips_mipssim.py
new file mode 100644
index 00000000000..b2749917b08
--- /dev/null
+++ b/tests/acceptance/machine_mips_mipssim.py
@@ -0,0 +1,56 @@
+# Functional tests for the MIPS simulator (MIPSsim machine)
+#
+# Copyright (c) 2020 Philippe Mathieu-Daudé <f4bug@amsat.org>
+#
+# This work is licensed under the terms of the GNU GPL, version 2 or later.
+# See the COPYING file in the top-level directory.
+#
+# SPDX-License-Identifier: GPL-2.0-or-later
+
+import os
+import logging
+import time
+
+from avocado import skipUnless
+from avocado_qemu import Test
+from avocado_qemu import exec_command_and_wait_for_pattern
+from avocado_qemu import interrupt_interactive_console_until_pattern
+from avocado_qemu import wait_for_console_pattern
+
+class MipsSimMachine(Test):
+
+    timeout = 30
+    KERNEL_COMMON_COMMAND_LINE = 'printk.time=0 '
+
+    @skipUnless(os.getenv('AVOCADO_ALLOW_UNTRUSTED_CODE'), 'untrusted code')
+    def test_mipssim_linux_console(self):
+        """
+        Boots the Linux kernel and checks that the console is operational
+        :avocado: tags=arch:mipsel
+        :avocado: tags=machine:mipssim
+        :avocado: tags=device:mipsnet
+        """
+        kernel_url = ('https://github.com/philmd/qemu-testing-blob/raw/'
+                      '32ea5764e1de8fffa0d59366c44822cd06d7c8e0/'
+                      'mips/mipssim/mipsel/vmlinux')
+        kernel_hash = '0f9aeca3a2e25b5b0cc4999571f39a7ad58cdc43'
+        kernel_path = self.fetch_asset(kernel_url, asset_hash=kernel_hash)
+
+        initrd_url = ('https://github.com/philmd/qemu-testing-blob/raw/'
+                      '32ea5764e1de8fffa0d59366c44822cd06d7c8e0/'
+                      'mips/mipssim/mipsel/rootfs.cpio')
+        initrd_hash = 'b20359bdfae66387e5a17d6692686d59c189417b'
+        initrd_path = self.fetch_asset(initrd_url, asset_hash=initrd_hash)
+
+        self.vm.set_console()
+        self.vm.add_args('-kernel', kernel_path,
+                         '-initrd', initrd_path,
+                         '-append', self.KERNEL_COMMON_COMMAND_LINE)
+        self.vm.launch()
+
+        wait_for_console_pattern(self, 'Welcome to Buildroot')
+        interrupt_interactive_console_until_pattern(self,
+                                                    interrupt_string='root\r',
+                                                    success_message='#')
+        pattern = '3 packets transmitted, 3 packets received, 0% packet loss'
+        exec_command_and_wait_for_pattern(self, 'ping -c 3 10.0.2.2', pattern)
-- 
2.26.2



  parent reply	other threads:[~2020-09-28 17:31 UTC|newest]

Thread overview: 56+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-09-28 17:15 [PATCH 00/16] hw/mips: Set CPU frequency Philippe Mathieu-Daudé
2020-09-28 17:15 ` [PATCH 01/16] hw/core/cpu: Let CPU object have a clock source Philippe Mathieu-Daudé
2020-09-30  7:43   ` Igor Mammedov
2020-09-30 10:16     ` Philippe Mathieu-Daudé
2020-09-30 10:16       ` Philippe Mathieu-Daudé
2020-10-05 16:40       ` Igor Mammedov
2020-10-05 16:40         ` Igor Mammedov
2020-10-05 17:19         ` Philippe Mathieu-Daudé
2020-10-05 17:19           ` Philippe Mathieu-Daudé
2020-10-05 17:44         ` Eduardo Habkost
2020-10-05 17:44           ` Eduardo Habkost
2020-10-05 18:09           ` Philippe Mathieu-Daudé
2020-10-05 18:09             ` Philippe Mathieu-Daudé
2020-10-05 18:29             ` Philippe Mathieu-Daudé
2020-10-05 18:29               ` Philippe Mathieu-Daudé
2020-10-05 19:22               ` Eduardo Habkost
2020-10-05 19:22                 ` Eduardo Habkost
2020-10-06 18:11                 ` Philippe Mathieu-Daudé
2020-10-06 18:11                   ` Philippe Mathieu-Daudé
2020-10-06 19:53                   ` Philippe Mathieu-Daudé
2020-10-06 19:53                     ` Philippe Mathieu-Daudé
2020-10-05 18:43             ` Eduardo Habkost
2020-10-05 18:43               ` Eduardo Habkost
2020-09-28 17:15 ` [PATCH 02/16] target/mips: Move cpu_mips_get_random() with CP0 helpers Philippe Mathieu-Daudé
2020-09-30 18:04   ` Aleksandar Markovic
2020-09-28 17:15 ` [PATCH 03/16] target/mips/cp0_timer: Explicit unit in variable name Philippe Mathieu-Daudé
2020-09-30 18:10   ` Aleksandar Markovic
2020-09-28 17:15 ` [PATCH 04/16] target/mips/cpu: Introduce mips_cpu_properties[] Philippe Mathieu-Daudé
2020-09-28 17:15 ` [PATCH 05/16] target/mips/cpu: Set default CPU frequency to 200 MHz Philippe Mathieu-Daudé
2020-09-28 17:15 ` [PATCH 06/16] target/mips: Keep CP0 counter in sync with the CPU frequency Philippe Mathieu-Daudé
2020-09-28 17:15 ` [PATCH 07/16] hw/mips/r4k: Explicit CPU frequency is 200 MHz Philippe Mathieu-Daudé
2020-09-28 17:15 ` [PATCH 08/16] hw/mips/fuloong2e: Set CPU frequency to 533 MHz Philippe Mathieu-Daudé
2020-09-28 17:15 ` [PATCH 09/16] hw/mips/mipssim: Correct CPU frequency Philippe Mathieu-Daudé
2020-09-28 17:15 ` [PATCH 10/16] hw/mips/jazz: Correct CPU frequencies Philippe Mathieu-Daudé
2020-09-28 17:15 ` [PATCH 11/16] hw/mips/cps: Expose input clock and connect it to CPU cores Philippe Mathieu-Daudé
2020-09-28 17:15 ` [PATCH 12/16] hw/mips/boston: Set CPU frequency to 1 GHz Philippe Mathieu-Daudé
2020-09-28 17:15 ` [PATCH 13/16] hw/mips/malta: Set CPU frequency to 320 MHz Philippe Mathieu-Daudé
2020-09-28 17:15 ` [PATCH 14/16] hw/mips/cps: Do not allow use without input clock Philippe Mathieu-Daudé
2020-09-28 17:15 ` [PATCH 15/16] target/mips/cpu: Do not allow system-mode " Philippe Mathieu-Daudé
2020-09-29 13:01   ` Igor Mammedov
2020-09-29 14:40     ` Philippe Mathieu-Daudé
2020-10-05  7:39       ` Philippe Mathieu-Daudé
2020-10-05 16:25       ` Igor Mammedov
2020-09-28 17:15 ` Philippe Mathieu-Daudé [this message]
2020-09-28 20:33   ` [PATCH 16/16] tests/acceptance: Test the MIPSsim machine Willian Rampazzo
2020-09-29  9:09     ` Philippe Mathieu-Daudé
2020-09-29  9:38       ` Alex Bennée
2020-09-29  9:50         ` Philippe Mathieu-Daudé
2020-09-30  8:43         ` Daniel P. Berrangé
2020-09-30  9:49           ` Alex Bennée
2020-09-30 10:08             ` Philippe Mathieu-Daudé
2020-09-29  2:46 ` [PATCH 00/16] hw/mips: Set CPU frequency no-reply
2020-09-29  8:58   ` Philippe Mathieu-Daudé
2020-09-30  7:40 ` Igor Mammedov
2020-09-30 10:13   ` Philippe Mathieu-Daudé
2020-10-09 15:40 ` 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=20200928171539.788309-17-f4bug@amsat.org \
    --to=f4bug@amsat.org \
    --cc=aleksandar.qemu.devel@gmail.com \
    --cc=aleksandar.rikalo@syrmia.com \
    --cc=aurelien@aurel32.net \
    --cc=chenhc@lemote.com \
    --cc=crosa@redhat.com \
    --cc=damien.hedde@greensocs.com \
    --cc=edgar.iglesias@gmail.com \
    --cc=ehabkost@redhat.com \
    --cc=hpoussin@reactos.org \
    --cc=huth@tuxfamily.org \
    --cc=paulburton@kernel.org \
    --cc=philmd@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=rth@twiddle.net \
    --cc=wainersm@redhat.com \
    --cc=zltjiangshi@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is 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.