Avocado: more multi-arch tests
v3 cover Avocado: more multi-arch tests
Hi,
Another neanderthal approach to add multi-arch acceptance tests using Avocado.
I couldn't figure how to use the R2D serial, the kernel boots using the sm501 display correctly, but I'm too console-oriented to write UI tests...
Magnus or Zoltan, any hint on this?
Thanks
Phil.
Since v2 (http://lists.gnu.org/archive/html/qemu-devel/2018-06/msg06370.html):
- use Debian packaged kernels, add link to the sources and a comment about how to rebuild these images (Alex)
- use self.arch from Cleber's series
- add mips64el kernel console test
- add sh4 test using the tracing framework
Since v1 (http://lists.gnu.org/archive/html/qemu-devel/2018-04/msg03076.html):
- we can now run other archs (Cleber)
Based-on: [email protected] "Acceptance Tests: basic architecture support" from Cleber Rosa
https://lists.gnu.org/archive/html/qemu-devel/2018-10/msg01821.html
Philippe Mathieu-Daudé (6):
tests/acceptance: Rename the generic BootLinuxConsole test as
test_x86_64_pc
tests/acceptance: Add a kludge to not use the default console tests/acceptance: Add test_mips_4kc_malta in BootLinuxConsole tests/acceptance: Add test_mipsel_5kc_malta in BootLinuxConsole tests/acceptance: Add test_sh4_r2d in BootLinuxConsole tests/acceptance: Add test_sh4_r2d in BootLinuxTracing
scripts/qemu.py | 6 +- tests/acceptance/boot_linux_console.py | 206 ++++++++++++++++++++++++- 2 files changed, 208 insertions(+), 4 deletions(-)
Signature · 1 line
2.19.1
PATCH v3 1/6 tests/acceptance: Rename the generic BootLinuxConsole test as test_x86_64_pc
--- tests/acceptance/boot_linux_console.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
tests/acceptance/boot_linux_console.py +2 -2
@@ -15,7 +15,7 @@ from avocado_qemu import Test class BootLinuxConsole(Test): """ - Boots a x86_64 Linux kernel and checks that the console is operational + Boots a Linux kernel and checks that the console is operational and the kernel command line is properly passed from QEMU to the kernel :avocado: enable
@@ -23,7 +23,7 @@ class BootLinuxConsole(Test): timeout = 60 - def test(self): + def test_x86_64_pc(self): if self.arch != 'x86_64': self.cancel('Currently specific to the x86_64 target arch') kernel_url = ('https://mirrors.kernel.org/fedora/releases/28/'
Signature · 1 line
2.19.1
Re: [Qemu-devel] [PATCH v3 1/6] tests/acceptance: Rename the generic BootLinuxConsole test as test_x86_64_pc
Quoted 20 lines · Philippe Mathieu-Daudé
Signed-off-by Philippe Mathieu-Daudé <[email protected]>--- tests/acceptance/boot_linux_console.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)tests/acceptance/boot_linux_console.py +1
-1@@ -15,7 +15,7 @@ from avocado_qemu import Test class BootLinuxConsole(Test): """ - Boots a x86_64 Linux kernel and checks that the console is operational + Boots a Linux kernel and checks that the console is operational and the kernel command line is properly passed from QEMU to the kernel :avocado: enable
tests/acceptance/boot_linux_console.py class BootLinuxConsole(Test): · line 29
Quoted 8 lines
tests/acceptance/boot_linux_console.py +1
-1@@ -23,7 +23,7 @@ class BootLinuxConsole(Test): timeout = 60 - def test(self): + def test_x86_64_pc(self): if self.arch != 'x86_64': self.cancel('Currently specific to the x86_64 target arch') kernel_url = ('https://mirrors.kernel.org/fedora/releases/28/'
This looks right, but given "self.arch" is still not on master, so I'm holding on to giving the reviewed-by/tested-by.
Question: do you believe a maintainer and/or developer would want to test specific machine types?
RFC PATCH v3 2/6 tests/acceptance: Add a kludge to not use the default console
In reply to Philippe Mathieu-DaudéThe board already instantiate the proper devices, we don't want to add extra devices but connect the chardev to one of the serial already available.
--- scripts/qemu.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
scripts/qemu.py +4 -2
@@ -221,8 +221,10 @@ class QEMUMachine(object): self._name + "-console.sock") chardev = ('socket,id=console,path=%s,server,nowait' % self._console_address) - device = '%s,chardev=console' % self._console_device_type - args.extend(['-chardev', chardev, '-device', device]) + args.extend(['-chardev', chardev]) + if len(self._console_device_type): + device = '%s,chardev=console' % self._console_device_type + args.extend(['-device', device]) return args def _pre_launch(self):
Signature · 1 line
2.19.1
Re: [Qemu-devel] [RFC PATCH v3 2/6] tests/acceptance: Add a kludge to not use the default console
Quoted 14 lines · Philippe Mathieu-Daudé
The board already instantiate the proper devices, we don't want to add extra devices but connect the chardev to one of the serial already available.
Signed-off-by Philippe Mathieu-Daudé <[email protected]>--- scripts/qemu.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)scripts/qemu.py +0
-0
scripts/qemu.py class QEMUMachine(object): · line 225
Quoted 7 lines
scripts/qemu.py +2
-2@@ -221,8 +221,10 @@ class QEMUMachine(object): self._name + "-console.sock") chardev = ('socket,id=console,path=%s,server,nowait' % self._console_address) - device = '%s,chardev=console' % self._console_device_type - args.extend(['-chardev', chardev, '-device', device]) + args.extend(['-chardev', chardev]) + if len(self._console_device_type):
Considering self._console_device_type will come from set_console(), either explicitly as the "device_type" parameter, or from the list on CONSOLE_DEV_TYPES, wouldn't it make more sense to just drop the definitions for the machine types that don't need an explicit device?
That way, self.set_console() could be called with no arguments (instead of the empty string). And this check would become:
if self._console_device_type is not None:
Quoted 6 lines
scripts/qemu.py +2
-0+ device = '%s,chardev=console' % self._console_device_type + args.extend(['-device', device]) return args def _pre_launch(self):
Re: [Qemu-devel] [RFC PATCH v3 2/6] tests/acceptance: Add a kludge to not use the default console
Quoted 28 lines · Cleber Rosa
Quoted 14 lines · Philippe Mathieu-Daudé
The board already instantiate the proper devices, we don't want to add extra devices but connect the chardev to one of the serial already available.
Signed-off-by Philippe Mathieu-Daudé <[email protected]>--- scripts/qemu.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)scripts/qemu.py +0
-0scripts/qemu.py class QEMUMachine(object): · line 225
Quoted 7 lines
scripts/qemu.py +2
-2@@ -221,8 +221,10 @@ class QEMUMachine(object): self._name + "-console.sock") chardev = ('socket,id=console,path=%s,server,nowait' % self._console_address) - device = '%s,chardev=console' % self._console_device_type - args.extend(['-chardev', chardev, '-device', device]) + args.extend(['-chardev', chardev]) + if len(self._console_device_type):Considering
self._console_device_typewill come fromset_console(), either explicitly as the "device_type" parameter, or from the list onCONSOLE_DEV_TYPES, wouldn't it make more sense to just drop the definitions for the machine types that don't need an explicit device?
Quoted 4 lines
That way,
self.set_console()could be called with no arguments (instead of the empty string). And this check would become:if self._console_device_type is not None:
Clever Cleber!
Quoted 9 lines
Quoted 7 lines
scripts/qemu.py +2
-0+ device = '%s,chardev=console' % self._console_device_type + args.extend(['-device', device]) return args def _pre_launch(self):
PATCH v3 3/6 tests/acceptance: Add test_mips_4kc_malta in BootLinuxConsole
In reply to Philippe Mathieu-DaudéSimilar to the test_x86_64_pc test, this boots a Linux kernel on a Malta board (MIPS 4Kc big-endian) and verify the serial is working.
This test requires the dpkg-deb tool (apt/dnf install dpkg) to extract the kernel from the Debian package.
$ avocado --show=console run -p arch=mips tests/acceptance/boot_linux_console.py console: [ 0.000000] Initializing cgroup subsys cpuset console: [ 0.000000] Initializing cgroup subsys cpu console: [ 0.000000] Linux version 2.6.32-5-4kc-malta (Debian 2.6.32-48) ([email protected]) (gcc version 4.3.5 (Debian 4.3.5-4) ) #1 Sat Feb 16 12:43:42 UTC 2013 console: [ 0.000000] console: [ 0.000000] LINUX started... console: [ 0.000000] bootconsole [early0] enabled console: [ 0.000000] CPU revision is: 00019300 (MIPS 24Kc) console: [ 0.000000] FPU revision is: 00739300 console: [ 0.000000] Determined physical RAM map: console: [ 0.000000] memory: 00001000 @ 00000000 (reserved) console: [ 0.000000] memory: 000ef000 @ 00001000 (ROM data) console: [ 0.000000] memory: 005b7000 @ 000f0000 (reserved) console: [ 0.000000] memory: 03958000 @ 006a7000 (usable) console: [ 0.000000] Wasting 54496 bytes for tracking 1703 unused pages console: [ 0.000000] Initrd not found or empty - disabling initrd console: [ 0.000000] Zone PFN ranges: console: [ 0.000000] DMA 0x00000000 -> 0x00001000 console: [ 0.000000] Normal 0x00001000 -> 0x00003fff console: [ 0.000000] Movable zone start PFN for each node console: [ 0.000000] early_node_map[1] active PFN ranges console: [ 0.000000] 0: 0x00000000 -> 0x00003fff console: [ 0.000000] Built 1 zonelists in Zone order, mobility grouping on. Total pages: 16255 console: [ 0.000000] Kernel command line: console=ttyS0 printk.time=0
--- tests/acceptance/boot_linux_console.py | 46 ++++++++++++++++++++++++++ 1 file changed, 46 insertions(+)
tests/acceptance/boot_linux_console.py +46 -0
@@ -9,6 +9,7 @@ # later. See the COPYING file in the top-level directory. import logging +import subprocess from avocado_qemu import Test
@@ -47,3 +48,48 @@ class BootLinuxConsole(Test): break if 'Kernel panic - not syncing' in msg: self.fail("Kernel panic reached") + + def test_mips_4kc_malta(self): + """ + This test requires the dpkg-deb tool (apt/dnf install dpkg) to extract + the kernel from the Debian package. + + The kernel can be rebuilt using this Debian kernel source [1] and + following the instructions on [2]. + + [1] https://kernel-team.pages.debian.net/kernel-handbook/ch-common-tasks.html#s-common-official + [2] http://snapshot.debian.org/package/linux-2.6/2.6.32-48/#linux-source-2.6.32_2.6.32-48 + + :avocado: tags=arch:mips + """ + if self.arch != 'mips': # FIXME use 'arch' tag in parent class? + self.cancel('Currently specific to the %s target arch' % self.arch) + + deb_url = ('http://snapshot.debian.org/archive/debian/20130217T032700Z/' + 'pool/main/l/linux-2.6/' + 'linux-image-2.6.32-5-4kc-malta_2.6.32-48_mips.deb') + deb_hash = 'a8cfc28ad8f45f54811fc6cf74fc43ffcfe0ba04' + deb_path = self.fetch_asset(deb_url, asset_hash=deb_hash) + subprocess.check_call(['dpkg-deb', '--extract', deb_path, self.workdir]) # FIXME move to avocado ... + kernel_path = self.workdir + '/boot/vmlinux-2.6.32-5-4kc-malta' # FIXME ... and use from assets? + + self.vm.set_arch(self.arch) + self.vm.set_machine('malta') + self.vm.set_console("") # XXX this disable isa-serial to use -serial ... + kernel_command_line = 'console=ttyS0 printk.time=0' + self.vm.add_args('-m', "64", + '-serial', "chardev:console", # XXX ... here. + '-kernel', kernel_path, + '-append', kernel_command_line) + + # FIXME below to parent class? + self.vm.launch() + console = self.vm.console_socket.makefile() + console_logger = logging.getLogger('console') + while True: + msg = console.readline() + console_logger.debug(msg.strip()) + if 'Kernel command line: %s' % kernel_command_line in msg: + break + if 'Kernel panic - not syncing' in msg: + self.fail("Kernel panic reached")
Signature · 1 line
2.19.1
Re: [Qemu-devel] [PATCH v3 3/6] tests/acceptance: Add test_mips_4kc_malta in BootLinuxConsole
Quoted 6 lines · Philippe Mathieu-Daudé
Similar to the
test_x86_64_pctest, this boots a Linux kernel on a Malta board (MIPS 4Kc big-endian) and verify the serial is working.This test requires the dpkg-deb tool (apt/dnf install dpkg) to extract the kernel from the Debian package.
Debian packages are really "ar" archives, with a control.tar.gz and data.tar.gz in them. More on that later.
Quoted 35 lines
$ avocado --show=console run -p arch=mips tests/acceptance/boot_linux_console.py console: [ 0.000000] Initializing cgroup subsys cpuset console: [ 0.000000] Initializing cgroup subsys cpu console: [ 0.000000] Linux version 2.6.32-5-4kc-malta (Debian 2.6.32-48) ([email protected]) (gcc version 4.3.5 (Debian 4.3.5-4) ) #1 Sat Feb 16 12:43:42 UTC 2013 console: [ 0.000000] console: [ 0.000000] LINUX started... console: [ 0.000000] bootconsole [early0] enabled console: [ 0.000000] CPU revision is: 00019300 (MIPS 24Kc) console: [ 0.000000] FPU revision is: 00739300 console: [ 0.000000] Determined physical RAM map: console: [ 0.000000] memory: 00001000 @ 00000000 (reserved) console: [ 0.000000] memory: 000ef000 @ 00001000 (ROM data) console: [ 0.000000] memory: 005b7000 @ 000f0000 (reserved) console: [ 0.000000] memory: 03958000 @ 006a7000 (usable) console: [ 0.000000] Wasting 54496 bytes for tracking 1703 unused pages console: [ 0.000000] Initrd not found or empty - disabling initrd console: [ 0.000000] Zone PFN ranges: console: [ 0.000000] DMA 0x00000000 -> 0x00001000 console: [ 0.000000] Normal 0x00001000 -> 0x00003fff console: [ 0.000000] Movable zone start PFN for each node console: [ 0.000000] early_node_map[1] active PFN ranges console: [ 0.000000] 0: 0x00000000 -> 0x00003fff console: [ 0.000000] Built 1 zonelists in Zone order, mobility grouping on. Total pages: 16255 console: [ 0.000000] Kernel command line: console=ttyS0 printk.time=0Signed-off-by Philippe Mathieu-Daudé <[email protected]>--- tests/acceptance/boot_linux_console.py | 46 ++++++++++++++++++++++++++ 1 file changed, 46 insertions(+)tests/acceptance/boot_linux_console.py +0
-0
tests/acceptance/boot_linux_console.py line 12
Quoted 4 lines
tests/acceptance/boot_linux_console.py +1
-0@@ -9,6 +9,7 @@ # later. See the COPYING file in the top-level directory. import logging +import subprocess
It's definitely your call, but I like to think that avocado.utils.process provides simpler and more capable functions:
Quoted 14 lines
tests/acceptance/boot_linux_console.py +7
-0from avocado_qemu import Test@@ -47,3 +48,48 @@ class BootLinuxConsole(Test): break if 'Kernel panic - not syncing' in msg: self.fail("Kernel panic reached") + + def test_mips_4kc_malta(self): + """ + This test requires the dpkg-deb tool (apt/dnf install dpkg) to extract + the kernel from the Debian package. + + The kernel can be rebuilt using this Debian kernel source [1] and
tests/acceptance/boot_linux_console.py class BootLinuxConsole(Test): · line 67
Quoted 10 lines
tests/acceptance/boot_linux_console.py +10
-0+ following the instructions on [2]. + + [1] https://kernel-team.pages.debian.net/kernel-handbook/ch-common-tasks.html#s-common-official + [2] http://snapshot.debian.org/package/linux-2.6/2.6.32-48/#linux-source-2.6.32_2.6.32-48 + + :avocado: tags=arch:mips + """ + if self.arch != 'mips': # FIXME use 'arch' tag in parent class? + self.cancel('Currently specific to the %s target arch' % self.arch) +
I missed how the arch tag in the parent class (common to all tests here) would be useful for this specific test.
tests/acceptance/boot_linux_console.py class BootLinuxConsole(Test): · line 73
Quoted 6 lines
tests/acceptance/boot_linux_console.py +6
-0+ deb_url = ('http://snapshot.debian.org/archive/debian/20130217T032700Z/' + 'pool/main/l/linux-2.6/' + 'linux-image-2.6.32-5-4kc-malta_2.6.32-48_mips.deb') + deb_hash = 'a8cfc28ad8f45f54811fc6cf74fc43ffcfe0ba04' + deb_path = self.fetch_asset(deb_url, asset_hash=deb_hash) + subprocess.check_call(['dpkg-deb', '--extract', deb_path, self.workdir]) # FIXME move to avocado ...
This could become:
# from avocado.utils.process import run
run("ar p %s data.tar.gz | tar zxf - -C %s
./boot/vmlinux-2.6.32-5-4kc-malta" % (deb_path, self.workdir), shell=True)tests/acceptance/boot_linux_console.py class BootLinuxConsole(Test): · line 75
Quoted 2 lines
tests/acceptance/boot_linux_console.py +2
-0+ kernel_path = self.workdir + '/boot/vmlinux-2.6.32-5-4kc-malta' # FIXME ... and use from assets? +
Putting produced/processed files back into the cache would be nice addition to the asset fetcher (or related tools). Not there yet, though.
tests/acceptance/boot_linux_console.py class BootLinuxConsole(Test): · line 78
Quoted 3 lines
tests/acceptance/boot_linux_console.py +3
-0+ self.vm.set_arch(self.arch) + self.vm.set_machine('malta') + self.vm.set_console("") # XXX this disable isa-serial to use -serial ...
See the comments on the previous patch. Basically, if a machine doesn't need an explicit console device to be added, set_console() should do just that (not add one). The ideal API would be to call set_console() without any explicit parameter IMO.
That assumes, what I believe to be true, that we don't want to setup multiple *console* devices per QEMUMachine, right?
Regards,
- Cleber.
Quoted 18 lines
tests/acceptance/boot_linux_console.py +17
-0+ kernel_command_line = 'console=ttyS0 printk.time=0' + self.vm.add_args('-m', "64", + '-serial', "chardev:console", # XXX ... here. + '-kernel', kernel_path, + '-append', kernel_command_line) + + # FIXME below to parent class? + self.vm.launch() + console = self.vm.console_socket.makefile() + console_logger = logging.getLogger('console') + while True: + msg = console.readline() + console_logger.debug(msg.strip()) + if 'Kernel command line: %s' % kernel_command_line in msg: + break + if 'Kernel panic - not syncing' in msg: + self.fail("Kernel panic reached")
Re: [Qemu-devel] [PATCH v3 3/6] tests/acceptance: Add test_mips_4kc_malta in BootLinuxConsole
Quoted 50 lines · Cleber Rosa
Quoted 6 lines · Philippe Mathieu-Daudé
Similar to the
test_x86_64_pctest, this boots a Linux kernel on a Malta board (MIPS 4Kc big-endian) and verify the serial is working.This test requires the dpkg-deb tool (apt/dnf install dpkg) to extract the kernel from the Debian package.
Debian packages are really "ar" archives, with a control.tar.gz and data.tar.gz in them. More on that later.
Quoted 37 lines
$ avocado --show=console run -p arch=mips tests/acceptance/boot_linux_console.py console: [ 0.000000] Initializing cgroup subsys cpuset console: [ 0.000000] Initializing cgroup subsys cpu console: [ 0.000000] Linux version 2.6.32-5-4kc-malta (Debian 2.6.32-48) ([email protected]) (gcc version 4.3.5 (Debian 4.3.5-4) ) #1 Sat Feb 16 12:43:42 UTC 2013 console: [ 0.000000] console: [ 0.000000] LINUX started... console: [ 0.000000] bootconsole [early0] enabled console: [ 0.000000] CPU revision is: 00019300 (MIPS 24Kc) console: [ 0.000000] FPU revision is: 00739300 console: [ 0.000000] Determined physical RAM map: console: [ 0.000000] memory: 00001000 @ 00000000 (reserved) console: [ 0.000000] memory: 000ef000 @ 00001000 (ROM data) console: [ 0.000000] memory: 005b7000 @ 000f0000 (reserved) console: [ 0.000000] memory: 03958000 @ 006a7000 (usable) console: [ 0.000000] Wasting 54496 bytes for tracking 1703 unused pages console: [ 0.000000] Initrd not found or empty - disabling initrd console: [ 0.000000] Zone PFN ranges: console: [ 0.000000] DMA 0x00000000 -> 0x00001000 console: [ 0.000000] Normal 0x00001000 -> 0x00003fff console: [ 0.000000] Movable zone start PFN for each node console: [ 0.000000] early_node_map[1] active PFN ranges console: [ 0.000000] 0: 0x00000000 -> 0x00003fff console: [ 0.000000] Built 1 zonelists in Zone order, mobility grouping on. Total pages: 16255 console: [ 0.000000] Kernel command line: console=ttyS0 printk.time=0Signed-off-by Philippe Mathieu-Daudé <[email protected]>--- tests/acceptance/boot_linux_console.py | 46 ++++++++++++++++++++++++++ 1 file changed, 46 insertions(+)tests/acceptance/boot_linux_console.py +0
-0@@ -9,6 +9,7 @@ # later. See the COPYING file in the top-level directory.
Quoted 7 lines
tests/acceptance/boot_linux_console.py line 12
Quoted 2 lines
tests/acceptance/boot_linux_console.py +1
-0import logging +import subprocessIt's definitely your call, but I like to think that avocado.utils.process provides simpler and more capable functions:
OK
Quoted 20 lines
Quoted 20 lines
tests/acceptance/boot_linux_console.py +12
-0from avocado_qemu import Test@@ -47,3 +48,48 @@ class BootLinuxConsole(Test): break if 'Kernel panic - not syncing' in msg: self.fail("Kernel panic reached") + + def test_mips_4kc_malta(self): + """ + This test requires the dpkg-deb tool (apt/dnf install dpkg) to extract + the kernel from the Debian package. + + The kernel can be rebuilt using this Debian kernel source [1] and + following the instructions on [2]. + + [1] https://kernel-team.pages.debian.net/kernel-handbook/ch-common-tasks.html#s-common-official + [2] http://snapshot.debian.org/package/linux-2.6/2.6.32-48/#linux-source-2.6.32_2.6.32-48 +
Quoted 8 lines
tests/acceptance/boot_linux_console.py class BootLinuxConsole(Test): · line 67
Quoted 5 lines
tests/acceptance/boot_linux_console.py +5
-0+ :avocado: tags=arch:mips + """ + if self.arch != 'mips': # FIXME use 'arch' tag in parent class? + self.cancel('Currently specific to the %s target arch' % self.arch) +I missed how the arch tag in the parent class (common to all tests here) would be useful for this specific test.
I probably forgot to remove it.
Quoted 8 lines
tests/acceptance/boot_linux_console.py class BootLinuxConsole(Test): · line 73
Quoted 7 lines
tests/acceptance/boot_linux_console.py +6
-0+ deb_url = ('http://snapshot.debian.org/archive/debian/20130217T032700Z/' + 'pool/main/l/linux-2.6/' + 'linux-image-2.6.32-5-4kc-malta_2.6.32-48_mips.deb') + deb_hash = 'a8cfc28ad8f45f54811fc6cf74fc43ffcfe0ba04' + deb_path = self.fetch_asset(deb_url, asset_hash=deb_hash) + subprocess.check_call(['dpkg-deb', '--extract', deb_path, self.workdir]) # FIXME move to avocado ...
Quoted 5 lines
This could become:
# from avocado.utils.process import run run("ar p %s data.tar.gz | tar zxf - -C %s ./boot/vmlinux-2.6.32-5-4kc-malta" % (deb_path, self.workdir), shell=True)
OK!
Quoted 6 lines
tests/acceptance/boot_linux_console.py class BootLinuxConsole(Test): · line 75
Quoted 3 lines
tests/acceptance/boot_linux_console.py +2
-0+ kernel_path = self.workdir + '/boot/vmlinux-2.6.32-5-4kc-malta' # FIXME ... and use from assets? +Putting produced/processed files back into the cache would be nice addition to the asset fetcher (or related tools). Not there yet, though.
OK :/
Quoted 9 lines
tests/acceptance/boot_linux_console.py class BootLinuxConsole(Test): · line 78
Quoted 4 lines
tests/acceptance/boot_linux_console.py +3
-0+ self.vm.set_arch(self.arch) + self.vm.set_machine('malta') + self.vm.set_console("") # XXX this disable isa-serial to use -serial ...See the comments on the previous patch. Basically, if a machine doesn't need an explicit console device to be added,
set_console()should do just that (not add one). The ideal API would be to callset_console()without any explicit parameter IMO.
Sure.
Quoted 3 lines
That assumes, what I believe to be true, that we don't want to setup multiple *console* devices per QEMUMachine, right?
There might be weird corner-cases but usually machines only have one type of (default) console.
Quoted 23 lines
Regards,
- Cleber.Quoted 18 lines
tests/acceptance/boot_linux_console.py +17
-0+ kernel_command_line = 'console=ttyS0 printk.time=0' + self.vm.add_args('-m', "64", + '-serial', "chardev:console", # XXX ... here. + '-kernel', kernel_path, + '-append', kernel_command_line) + + # FIXME below to parent class? + self.vm.launch() + console = self.vm.console_socket.makefile() + console_logger = logging.getLogger('console') + while True: + msg = console.readline() + console_logger.debug(msg.strip()) + if 'Kernel command line: %s' % kernel_command_line in msg: + break + if 'Kernel panic - not syncing' in msg: + self.fail("Kernel panic reached")
Re: [Qemu-devel] [PATCH v3 3/6] tests/acceptance: Add test_mips_4kc_malta in BootLinuxConsole
Quoted 90 lines · Philippe Mathieu-Daudé
Quoted 50 lines · Cleber Rosa
Quoted 6 lines · Philippe Mathieu-Daudé
Similar to the
test_x86_64_pctest, this boots a Linux kernel on a Malta board (MIPS 4Kc big-endian) and verify the serial is working.This test requires the dpkg-deb tool (apt/dnf install dpkg) to extract the kernel from the Debian package.
Debian packages are really "ar" archives, with a control.tar.gz and data.tar.gz in them. More on that later.
Quoted 37 lines
$ avocado --show=console run -p arch=mips tests/acceptance/boot_linux_console.py console: [ 0.000000] Initializing cgroup subsys cpuset console: [ 0.000000] Initializing cgroup subsys cpu console: [ 0.000000] Linux version 2.6.32-5-4kc-malta (Debian 2.6.32-48) ([email protected]) (gcc version 4.3.5 (Debian 4.3.5-4) ) #1 Sat Feb 16 12:43:42 UTC 2013 console: [ 0.000000] console: [ 0.000000] LINUX started... console: [ 0.000000] bootconsole [early0] enabled console: [ 0.000000] CPU revision is: 00019300 (MIPS 24Kc) console: [ 0.000000] FPU revision is: 00739300 console: [ 0.000000] Determined physical RAM map: console: [ 0.000000] memory: 00001000 @ 00000000 (reserved) console: [ 0.000000] memory: 000ef000 @ 00001000 (ROM data) console: [ 0.000000] memory: 005b7000 @ 000f0000 (reserved) console: [ 0.000000] memory: 03958000 @ 006a7000 (usable) console: [ 0.000000] Wasting 54496 bytes for tracking 1703 unused pages console: [ 0.000000] Initrd not found or empty - disabling initrd console: [ 0.000000] Zone PFN ranges: console: [ 0.000000] DMA 0x00000000 -> 0x00001000 console: [ 0.000000] Normal 0x00001000 -> 0x00003fff console: [ 0.000000] Movable zone start PFN for each node console: [ 0.000000] early_node_map[1] active PFN ranges console: [ 0.000000] 0: 0x00000000 -> 0x00003fff console: [ 0.000000] Built 1 zonelists in Zone order, mobility grouping on. Total pages: 16255 console: [ 0.000000] Kernel command line: console=ttyS0 printk.time=0Signed-off-by Philippe Mathieu-Daudé <[email protected]>--- tests/acceptance/boot_linux_console.py | 46 ++++++++++++++++++++++++++ 1 file changed, 46 insertions(+)tests/acceptance/boot_linux_console.py +0
-0@@ -9,6 +9,7 @@ # later. See the COPYING file in the top-level directory.Quoted 7 lines
tests/acceptance/boot_linux_console.py line 12
Quoted 2 lines
tests/acceptance/boot_linux_console.py +1
-0import logging +import subprocessIt's definitely your call, but I like to think that avocado.utils.process provides simpler and more capable functions:
OK
Quoted 20 lines
Quoted 20 lines
tests/acceptance/boot_linux_console.py +12
-0from avocado_qemu import Test@@ -47,3 +48,48 @@ class BootLinuxConsole(Test): break if 'Kernel panic - not syncing' in msg: self.fail("Kernel panic reached") + + def test_mips_4kc_malta(self): + """ + This test requires the dpkg-deb tool (apt/dnf install dpkg) to extract + the kernel from the Debian package. + + The kernel can be rebuilt using this Debian kernel source [1] and + following the instructions on [2]. + + [1] https://kernel-team.pages.debian.net/kernel-handbook/ch-common-tasks.html#s-common-official + [2] http://snapshot.debian.org/package/linux-2.6/2.6.32-48/#linux-source-2.6.32_2.6.32-48 +Quoted 8 lines
tests/acceptance/boot_linux_console.py class BootLinuxConsole(Test): · line 67
Quoted 5 lines
tests/acceptance/boot_linux_console.py +5
-0+ :avocado: tags=arch:mips + """ + if self.arch != 'mips': # FIXME use 'arch' tag in parent class? + self.cancel('Currently specific to the %s target arch' % self.arch) +I missed how the arch tag in the parent class (common to all tests here) would be useful for this specific test.
Quoted 2 lines
I probably forgot to remove it.
I think I now know what you meant. With the current approach we have:
$ avocado run -p arch=x86_64 tests/acceptance/boot_linux_console.py JOB ID : 3209c26bceffc372f245b121d6ac77a7e36e7134 JOB LOG : /home/cleber/avocado/job-results/job-2018-10-19T16.58-3209c26/job.log (1/2) tests/acceptance/boot_linux_console.py:BootLinuxConsole.test_x86_64_pc: PASS (2.05 s) (2/2) tests/acceptance/boot_linux_console.py:BootLinuxConsole.test_mips_4kc_malta: CANCEL: Currently specific to the x86_64 target arch (0.00 s) RESULTS : PASS 1 | ERROR 0 | FAIL 0 | SKIP 0 | WARN 0 | INTERRUPT 0 | CANCEL 1 JOB TIME : 2.21 s
There's a bug in the CANCEL message, because the test is "mips" specific and not specific to the arch parameter given. I believe you'd like to reuse the arch given in the "tags=", right?
- Cleber.
Quoted 67 lines
Quoted 8 lines
tests/acceptance/boot_linux_console.py class BootLinuxConsole(Test): · line 73
Quoted 7 lines
tests/acceptance/boot_linux_console.py +6
-0+ deb_url = ('http://snapshot.debian.org/archive/debian/20130217T032700Z/' + 'pool/main/l/linux-2.6/' + 'linux-image-2.6.32-5-4kc-malta_2.6.32-48_mips.deb') + deb_hash = 'a8cfc28ad8f45f54811fc6cf74fc43ffcfe0ba04' + deb_path = self.fetch_asset(deb_url, asset_hash=deb_hash) + subprocess.check_call(['dpkg-deb', '--extract', deb_path, self.workdir]) # FIXME move to avocado ...Quoted 5 lines
This could become:
# from avocado.utils.process import run run("ar p %s data.tar.gz | tar zxf - -C %s ./boot/vmlinux-2.6.32-5-4kc-malta" % (deb_path, self.workdir), shell=True)OK!
Quoted 6 lines
tests/acceptance/boot_linux_console.py class BootLinuxConsole(Test): · line 75
Quoted 3 lines
tests/acceptance/boot_linux_console.py +2
-0+ kernel_path = self.workdir + '/boot/vmlinux-2.6.32-5-4kc-malta' # FIXME ... and use from assets? +Putting produced/processed files back into the cache would be nice addition to the asset fetcher (or related tools). Not there yet, though.
OK :/
Quoted 9 lines
tests/acceptance/boot_linux_console.py class BootLinuxConsole(Test): · line 78
Quoted 4 lines
tests/acceptance/boot_linux_console.py +3
-0+ self.vm.set_arch(self.arch) + self.vm.set_machine('malta') + self.vm.set_console("") # XXX this disable isa-serial to use -serial ...See the comments on the previous patch. Basically, if a machine doesn't need an explicit console device to be added,
set_console()should do just that (not add one). The ideal API would be to callset_console()without any explicit parameter IMO.Sure.
Quoted 3 lines
That assumes, what I believe to be true, that we don't want to setup multiple *console* devices per QEMUMachine, right?
There might be weird corner-cases but usually machines only have one type of (default) console.
Quoted 23 lines
Regards,
- Cleber.Quoted 18 lines
tests/acceptance/boot_linux_console.py +17
-0+ kernel_command_line = 'console=ttyS0 printk.time=0' + self.vm.add_args('-m', "64", + '-serial', "chardev:console", # XXX ... here. + '-kernel', kernel_path, + '-append', kernel_command_line) + + # FIXME below to parent class? + self.vm.launch() + console = self.vm.console_socket.makefile() + console_logger = logging.getLogger('console') + while True: + msg = console.readline() + console_logger.debug(msg.strip()) + if 'Kernel command line: %s' % kernel_command_line in msg: + break + if 'Kernel panic - not syncing' in msg: + self.fail("Kernel panic reached")
Signature · 4 lines
Cleber Rosa [ Sr Software Engineer - Virtualization Team - Red Hat ] [ Avocado Test Framework - avocado-framework.github.io ] [ 7ABB 96EB 8B46 B94D 5E0F E9BB 657E 8D33 A5F2 09F3 ]
Re: [Qemu-devel] [PATCH v3 3/6] tests/acceptance: Add test_mips_4kc_malta in BootLinuxConsole
Quoted 112 lines · Cleber Rosa
Quoted 90 lines · Philippe Mathieu-Daudé
Quoted 50 lines · Cleber Rosa
Quoted 6 lines · Philippe Mathieu-Daudé
Similar to the
test_x86_64_pctest, this boots a Linux kernel on a Malta board (MIPS 4Kc big-endian) and verify the serial is working.This test requires the dpkg-deb tool (apt/dnf install dpkg) to extract the kernel from the Debian package.
Debian packages are really "ar" archives, with a control.tar.gz and data.tar.gz in them. More on that later.
Quoted 37 lines
$ avocado --show=console run -p arch=mips tests/acceptance/boot_linux_console.py console: [ 0.000000] Initializing cgroup subsys cpuset console: [ 0.000000] Initializing cgroup subsys cpu console: [ 0.000000] Linux version 2.6.32-5-4kc-malta (Debian 2.6.32-48) ([email protected]) (gcc version 4.3.5 (Debian 4.3.5-4) ) #1 Sat Feb 16 12:43:42 UTC 2013 console: [ 0.000000] console: [ 0.000000] LINUX started... console: [ 0.000000] bootconsole [early0] enabled console: [ 0.000000] CPU revision is: 00019300 (MIPS 24Kc) console: [ 0.000000] FPU revision is: 00739300 console: [ 0.000000] Determined physical RAM map: console: [ 0.000000] memory: 00001000 @ 00000000 (reserved) console: [ 0.000000] memory: 000ef000 @ 00001000 (ROM data) console: [ 0.000000] memory: 005b7000 @ 000f0000 (reserved) console: [ 0.000000] memory: 03958000 @ 006a7000 (usable) console: [ 0.000000] Wasting 54496 bytes for tracking 1703 unused pages console: [ 0.000000] Initrd not found or empty - disabling initrd console: [ 0.000000] Zone PFN ranges: console: [ 0.000000] DMA 0x00000000 -> 0x00001000 console: [ 0.000000] Normal 0x00001000 -> 0x00003fff console: [ 0.000000] Movable zone start PFN for each node console: [ 0.000000] early_node_map[1] active PFN ranges console: [ 0.000000] 0: 0x00000000 -> 0x00003fff console: [ 0.000000] Built 1 zonelists in Zone order, mobility grouping on. Total pages: 16255 console: [ 0.000000] Kernel command line: console=ttyS0 printk.time=0Signed-off-by Philippe Mathieu-Daudé <[email protected]>--- tests/acceptance/boot_linux_console.py | 46 ++++++++++++++++++++++++++ 1 file changed, 46 insertions(+)tests/acceptance/boot_linux_console.py +0
-0@@ -9,6 +9,7 @@ # later. See the COPYING file in the top-level directory.Quoted 7 lines
tests/acceptance/boot_linux_console.py line 12
Quoted 2 lines
tests/acceptance/boot_linux_console.py +1
-0import logging +import subprocessIt's definitely your call, but I like to think that avocado.utils.process provides simpler and more capable functions:
OK
Quoted 20 lines
Quoted 20 lines
tests/acceptance/boot_linux_console.py +12
-0from avocado_qemu import Test@@ -47,3 +48,48 @@ class BootLinuxConsole(Test): break if 'Kernel panic - not syncing' in msg: self.fail("Kernel panic reached") + + def test_mips_4kc_malta(self): + """ + This test requires the dpkg-deb tool (apt/dnf install dpkg) to extract + the kernel from the Debian package. + + The kernel can be rebuilt using this Debian kernel source [1] and + following the instructions on [2]. + + [1] https://kernel-team.pages.debian.net/kernel-handbook/ch-common-tasks.html#s-common-official + [2] http://snapshot.debian.org/package/linux-2.6/2.6.32-48/#linux-source-2.6.32_2.6.32-48 +Quoted 8 lines
tests/acceptance/boot_linux_console.py class BootLinuxConsole(Test): · line 67
Quoted 5 lines
tests/acceptance/boot_linux_console.py +5
-0+ :avocado: tags=arch:mips + """ + if self.arch != 'mips': # FIXME use 'arch' tag in parent class? + self.cancel('Currently specific to the %s target arch' % self.arch) +I missed how the arch tag in the parent class (common to all tests here) would be useful for this specific test.
Quoted 2 lines
I probably forgot to remove it.
I think I now know what you meant. With the current approach we have:
$ avocado run -p arch=x86_64 tests/acceptance/boot_linux_console.py JOB ID : 3209c26bceffc372f245b121d6ac77a7e36e7134 JOB LOG : /home/cleber/avocado/job-results/job-2018-10-19T16.58-3209c26/job.log (1/2) tests/acceptance/boot_linux_console.py:BootLinuxConsole.test_x86_64_pc: PASS (2.05 s) (2/2) tests/acceptance/boot_linux_console.py:BootLinuxConsole.test_mips_4kc_malta: CANCEL: Currently specific to the x86_64 target arch (0.00 s) RESULTS : PASS 1 | ERROR 0 | FAIL 0 | SKIP 0 | WARN 0 | INTERRUPT 0 | CANCEL 1 JOB TIME : 2.21 s
Quoted 4 lines
There's a bug in the CANCEL message, because the test is "mips" specific and not specific to the arch parameter given. I believe you'd like to reuse the arch given in the "tags=", right?
Continuing on this assumption (that it can be useful to access the tags during the test) I prototype this:
https://github.com/clebergnu/avocado/commit/7c5b04ed76bad5570f05e24ce168c8477283424d
And with that, this on top of this commit:
https://github.com/clebergnu/qemu/commit/359b8b4e10575646a2efa1bcb58ab74053233514
Basically, it allows one to run many arch specific tests at once, without specifying/restricting one arch:
$ avocado run tests/acceptance/boot_linux_console.py JOB ID : 3ade8b6c547f853e1b169cd1846f69f5221fd9f0 JOB LOG : /home/cleber/avocado/job-results/job-2018-10-19T18.30-3ade8b6/job.log (1/2) tests/acceptance/boot_linux_console.py:BootLinuxConsole.test_x86_64_pc: PASS (2.00 s) (2/2) tests/acceptance/boot_linux_console.py:BootLinuxConsole.test_mips_4kc_malta: PASS (0.53 s) RESULTS : PASS 2 | ERROR 0 | FAIL 0 | SKIP 0 | WARN 0 | INTERRUPT 0 | CANCEL 0 JOB TIME : 2.70 s
And the proper behavior when setting a arch:
$ avocado run -p arch=mips tests/acceptance/boot_linux_console.py JOB ID : 75902f6b02707c9c0d509229f092e14e8b2f3933 JOB LOG : /home/cleber/avocado/job-results/job-2018-10-19T18.50-75902f6/job.log (1/2) tests/acceptance/boot_linux_console.py:BootLinuxConsole.test_x86_64_pc: CANCEL: Currently specific to the targets: x86_64 (0.00 s) (2/2) tests/acceptance/boot_linux_console.py:BootLinuxConsole.test_mips_4kc_malta: PASS (0.54 s) RESULTS : PASS 1 | ERROR 0 | FAIL 0 | SKIP 0 | WARN 0 | INTERRUPT 0 | CANCEL 1 JOB TIME : 0.71 s
How does that look?
- Cleber.
Quoted 70 lines
- Cleber.
Quoted 67 lines
Quoted 8 lines
tests/acceptance/boot_linux_console.py class BootLinuxConsole(Test): · line 73
Quoted 7 lines
tests/acceptance/boot_linux_console.py +6
-0+ deb_url = ('http://snapshot.debian.org/archive/debian/20130217T032700Z/' + 'pool/main/l/linux-2.6/' + 'linux-image-2.6.32-5-4kc-malta_2.6.32-48_mips.deb') + deb_hash = 'a8cfc28ad8f45f54811fc6cf74fc43ffcfe0ba04' + deb_path = self.fetch_asset(deb_url, asset_hash=deb_hash) + subprocess.check_call(['dpkg-deb', '--extract', deb_path, self.workdir]) # FIXME move to avocado ...Quoted 5 lines
This could become:
# from avocado.utils.process import run run("ar p %s data.tar.gz | tar zxf - -C %s ./boot/vmlinux-2.6.32-5-4kc-malta" % (deb_path, self.workdir), shell=True)OK!
Quoted 6 lines
tests/acceptance/boot_linux_console.py class BootLinuxConsole(Test): · line 75
Quoted 3 lines
tests/acceptance/boot_linux_console.py +2
-0+ kernel_path = self.workdir + '/boot/vmlinux-2.6.32-5-4kc-malta' # FIXME ... and use from assets? +Putting produced/processed files back into the cache would be nice addition to the asset fetcher (or related tools). Not there yet, though.
OK :/
Quoted 9 lines
tests/acceptance/boot_linux_console.py class BootLinuxConsole(Test): · line 78
Quoted 4 lines
tests/acceptance/boot_linux_console.py +3
-0+ self.vm.set_arch(self.arch) + self.vm.set_machine('malta') + self.vm.set_console("") # XXX this disable isa-serial to use -serial ...See the comments on the previous patch. Basically, if a machine doesn't need an explicit console device to be added,
set_console()should do just that (not add one). The ideal API would be to callset_console()without any explicit parameter IMO.Sure.
Quoted 3 lines
That assumes, what I believe to be true, that we don't want to setup multiple *console* devices per QEMUMachine, right?
There might be weird corner-cases but usually machines only have one type of (default) console.
Quoted 23 lines
Regards,
- Cleber.Quoted 18 lines
tests/acceptance/boot_linux_console.py +17
-0+ kernel_command_line = 'console=ttyS0 printk.time=0' + self.vm.add_args('-m', "64", + '-serial', "chardev:console", # XXX ... here. + '-kernel', kernel_path, + '-append', kernel_command_line) + + # FIXME below to parent class? + self.vm.launch() + console = self.vm.console_socket.makefile() + console_logger = logging.getLogger('console') + while True: + msg = console.readline() + console_logger.debug(msg.strip()) + if 'Kernel command line: %s' % kernel_command_line in msg: + break + if 'Kernel panic - not syncing' in msg: + self.fail("Kernel panic reached")
Signature · 4 lines
Cleber Rosa [ Sr Software Engineer - Virtualization Team - Red Hat ] [ Avocado Test Framework - avocado-framework.github.io ] [ 7ABB 96EB 8B46 B94D 5E0F E9BB 657E 8D33 A5F2 09F3 ]
Re: [Qemu-devel] [PATCH v3 3/6] tests/acceptance: Add test_mips_4kc_malta in BootLinuxConsole
Quoted 162 lines · Cleber Rosa
Quoted 112 lines · Cleber Rosa
Quoted 90 lines · Philippe Mathieu-Daudé
Quoted 50 lines · Cleber Rosa
Quoted 6 lines · Philippe Mathieu-Daudé
Similar to the
test_x86_64_pctest, this boots a Linux kernel on a Malta board (MIPS 4Kc big-endian) and verify the serial is working.This test requires the dpkg-deb tool (apt/dnf install dpkg) to extract the kernel from the Debian package.
Debian packages are really "ar" archives, with a control.tar.gz and data.tar.gz in them. More on that later.
Quoted 37 lines
$ avocado --show=console run -p arch=mips tests/acceptance/boot_linux_console.py console: [ 0.000000] Initializing cgroup subsys cpuset console: [ 0.000000] Initializing cgroup subsys cpu console: [ 0.000000] Linux version 2.6.32-5-4kc-malta (Debian 2.6.32-48) ([email protected]) (gcc version 4.3.5 (Debian 4.3.5-4) ) #1 Sat Feb 16 12:43:42 UTC 2013 console: [ 0.000000] console: [ 0.000000] LINUX started... console: [ 0.000000] bootconsole [early0] enabled console: [ 0.000000] CPU revision is: 00019300 (MIPS 24Kc) console: [ 0.000000] FPU revision is: 00739300 console: [ 0.000000] Determined physical RAM map: console: [ 0.000000] memory: 00001000 @ 00000000 (reserved) console: [ 0.000000] memory: 000ef000 @ 00001000 (ROM data) console: [ 0.000000] memory: 005b7000 @ 000f0000 (reserved) console: [ 0.000000] memory: 03958000 @ 006a7000 (usable) console: [ 0.000000] Wasting 54496 bytes for tracking 1703 unused pages console: [ 0.000000] Initrd not found or empty - disabling initrd console: [ 0.000000] Zone PFN ranges: console: [ 0.000000] DMA 0x00000000 -> 0x00001000 console: [ 0.000000] Normal 0x00001000 -> 0x00003fff console: [ 0.000000] Movable zone start PFN for each node console: [ 0.000000] early_node_map[1] active PFN ranges console: [ 0.000000] 0: 0x00000000 -> 0x00003fff console: [ 0.000000] Built 1 zonelists in Zone order, mobility grouping on. Total pages: 16255 console: [ 0.000000] Kernel command line: console=ttyS0 printk.time=0Signed-off-by Philippe Mathieu-Daudé <[email protected]>--- tests/acceptance/boot_linux_console.py | 46 ++++++++++++++++++++++++++ 1 file changed, 46 insertions(+)tests/acceptance/boot_linux_console.py +0
-0@@ -9,6 +9,7 @@ # later. See the COPYING file in the top-level directory.Quoted 7 lines
tests/acceptance/boot_linux_console.py line 12
Quoted 2 lines
tests/acceptance/boot_linux_console.py +1
-0import logging +import subprocessIt's definitely your call, but I like to think that avocado.utils.process provides simpler and more capable functions:
OK
Quoted 20 lines
Quoted 20 lines
tests/acceptance/boot_linux_console.py +12
-0from avocado_qemu import Test@@ -47,3 +48,48 @@ class BootLinuxConsole(Test): break if 'Kernel panic - not syncing' in msg: self.fail("Kernel panic reached") + + def test_mips_4kc_malta(self): + """ + This test requires the dpkg-deb tool (apt/dnf install dpkg) to extract + the kernel from the Debian package. + + The kernel can be rebuilt using this Debian kernel source [1] and + following the instructions on [2]. + + [1] https://kernel-team.pages.debian.net/kernel-handbook/ch-common-tasks.html#s-common-official + [2] http://snapshot.debian.org/package/linux-2.6/2.6.32-48/#linux-source-2.6.32_2.6.32-48 +Quoted 8 lines
tests/acceptance/boot_linux_console.py class BootLinuxConsole(Test): · line 67
Quoted 5 lines
tests/acceptance/boot_linux_console.py +5
-0+ :avocado: tags=arch:mips + """ + if self.arch != 'mips': # FIXME use 'arch' tag in parent class? + self.cancel('Currently specific to the %s target arch' % self.arch) +I missed how the arch tag in the parent class (common to all tests here) would be useful for this specific test.
Quoted 2 lines
I probably forgot to remove it.
I think I now know what you meant. With the current approach we have:
$ avocado run -p arch=x86_64 tests/acceptance/boot_linux_console.py JOB ID : 3209c26bceffc372f245b121d6ac77a7e36e7134 JOB LOG : /home/cleber/avocado/job-results/job-2018-10-19T16.58-3209c26/job.log (1/2) tests/acceptance/boot_linux_console.py:BootLinuxConsole.test_x86_64_pc: PASS (2.05 s) (2/2) tests/acceptance/boot_linux_console.py:BootLinuxConsole.test_mips_4kc_malta: CANCEL: Currently specific to the x86_64 target arch (0.00 s) RESULTS : PASS 1 | ERROR 0 | FAIL 0 | SKIP 0 | WARN 0 | INTERRUPT 0 | CANCEL 1 JOB TIME : 2.21 sQuoted 4 lines
There's a bug in the CANCEL message, because the test is "mips" specific and not specific to the arch parameter given. I believe you'd like to reuse the arch given in the "tags=", right?
Continuing on this assumption (that it can be useful to access the tags during the test) I prototype this:
https://github.com/clebergnu/avocado/commit/7c5b04ed76bad5570f05e24ce168c8477283424d
And with that, this on top of this commit:
https://github.com/clebergnu/qemu/commit/359b8b4e10575646a2efa1bcb58ab74053233514
Basically, it allows one to run many arch specific tests at once, without specifying/restricting one arch:
$ avocado run tests/acceptance/boot_linux_console.py JOB ID : 3ade8b6c547f853e1b169cd1846f69f5221fd9f0 JOB LOG : /home/cleber/avocado/job-results/job-2018-10-19T18.30-3ade8b6/job.log (1/2) tests/acceptance/boot_linux_console.py:BootLinuxConsole.test_x86_64_pc: PASS (2.00 s) (2/2) tests/acceptance/boot_linux_console.py:BootLinuxConsole.test_mips_4kc_malta: PASS (0.53 s) RESULTS : PASS 2 | ERROR 0 | FAIL 0 | SKIP 0 | WARN 0 | INTERRUPT 0 | CANCEL 0 JOB TIME : 2.70 sAnd the proper behavior when setting a arch:
$ avocado run -p arch=mips tests/acceptance/boot_linux_console.py JOB ID : 75902f6b02707c9c0d509229f092e14e8b2f3933 JOB LOG : /home/cleber/avocado/job-results/job-2018-10-19T18.50-75902f6/job.log (1/2) tests/acceptance/boot_linux_console.py:BootLinuxConsole.test_x86_64_pc: CANCEL: Currently specific to the targets: x86_64 (0.00 s) (2/2) tests/acceptance/boot_linux_console.py:BootLinuxConsole.test_mips_4kc_malta: PASS (0.54 s) RESULTS : PASS 1 | ERROR 0 | FAIL 0 | SKIP 0 | WARN 0 | INTERRUPT 0 | CANCEL 1 JOB TIME : 0.71 s
Quoted 1 line
How does that look?
YES! This is _exactly_ what I wanted and how I plan to use this framework :)
Quoted 74 lines
- Cleber.
Quoted 70 lines
- Cleber.
Quoted 67 lines
Quoted 8 lines
tests/acceptance/boot_linux_console.py class BootLinuxConsole(Test): · line 73
Quoted 7 lines
tests/acceptance/boot_linux_console.py +6
-0+ deb_url = ('http://snapshot.debian.org/archive/debian/20130217T032700Z/' + 'pool/main/l/linux-2.6/' + 'linux-image-2.6.32-5-4kc-malta_2.6.32-48_mips.deb') + deb_hash = 'a8cfc28ad8f45f54811fc6cf74fc43ffcfe0ba04' + deb_path = self.fetch_asset(deb_url, asset_hash=deb_hash) + subprocess.check_call(['dpkg-deb', '--extract', deb_path, self.workdir]) # FIXME move to avocado ...Quoted 5 lines
This could become:
# from avocado.utils.process import run run("ar p %s data.tar.gz | tar zxf - -C %s ./boot/vmlinux-2.6.32-5-4kc-malta" % (deb_path, self.workdir), shell=True)OK!
Quoted 6 lines
tests/acceptance/boot_linux_console.py class BootLinuxConsole(Test): · line 75
Quoted 3 lines
tests/acceptance/boot_linux_console.py +2
-0+ kernel_path = self.workdir + '/boot/vmlinux-2.6.32-5-4kc-malta' # FIXME ... and use from assets? +Putting produced/processed files back into the cache would be nice addition to the asset fetcher (or related tools). Not there yet, though.
OK :/
Quoted 9 lines
tests/acceptance/boot_linux_console.py class BootLinuxConsole(Test): · line 78
Quoted 4 lines
tests/acceptance/boot_linux_console.py +3
-0+ self.vm.set_arch(self.arch) + self.vm.set_machine('malta') + self.vm.set_console("") # XXX this disable isa-serial to use -serial ...See the comments on the previous patch. Basically, if a machine doesn't need an explicit console device to be added,
set_console()should do just that (not add one). The ideal API would be to callset_console()without any explicit parameter IMO.Sure.
Quoted 3 lines
That assumes, what I believe to be true, that we don't want to setup multiple *console* devices per QEMUMachine, right?
There might be weird corner-cases but usually machines only have one type of (default) console.
Quoted 23 lines
Regards,
- Cleber.Quoted 18 lines
tests/acceptance/boot_linux_console.py +17
-0+ kernel_command_line = 'console=ttyS0 printk.time=0' + self.vm.add_args('-m', "64", + '-serial', "chardev:console", # XXX ... here. + '-kernel', kernel_path, + '-append', kernel_command_line) + + # FIXME below to parent class? + self.vm.launch() + console = self.vm.console_socket.makefile() + console_logger = logging.getLogger('console') + while True: + msg = console.readline() + console_logger.debug(msg.strip()) + if 'Kernel command line: %s' % kernel_command_line in msg: + break + if 'Kernel panic - not syncing' in msg: + self.fail("Kernel panic reached")
PATCH v3 4/6 tests/acceptance: Add test_mipsel_5kc_malta in BootLinuxConsole
In reply to Philippe Mathieu-DaudéSimilar to the test_x86_64_pc test, this boots a Linux kernel on a Malta board (MIPS 5Kc little-endian) and verify the serial is working.
This test requires the dpkg-deb tool (apt/dnf install dpkg) to extract the kernel from the Debian package.
$ avocado run -p arch=mips64el tests/acceptance/boot_linux_console.py JOB ID : 6450db71ca27757f53e13809625fc5107d0e6e4e JOB LOG : /home/phil/avocado/job-results/job-2018-10-13T13.34-6450db7/job.log (1/3) tests/acceptance/boot_linux_console.py:BootLinuxConsole.test_x86_64_pc: CANCEL: Currently specific to the x86_64 target arch (0.00 s) (2/3) tests/acceptance/boot_linux_console.py:BootLinuxConsole.test_mips_4kc_malta: CANCEL: Currently specific to the mips target arch (0.00 s) (3/3) tests/acceptance/boot_linux_console.py:BootLinuxConsole.test_mipsel_5kc_malta: PASS (0.78 s) RESULTS : PASS 1 | ERROR 0 | FAIL 0 | SKIP 0 | WARN 0 | INTERRUPT 0 | CANCEL 2 JOB TIME : 0.97 s
--- tests/acceptance/boot_linux_console.py | 44 ++++++++++++++++++++++++++ 1 file changed, 44 insertions(+)
tests/acceptance/boot_linux_console.py +44 -0
@@ -93,3 +93,47 @@ class BootLinuxConsole(Test): break if 'Kernel panic - not syncing' in msg: self.fail("Kernel panic reached") + + def test_mipsel_5kc_malta(self): + """ + This test requires the dpkg-deb tool (apt/dnf install dpkg) to extract + the kernel from the Debian package. + + The kernel can be rebuilt using this Debian kernel source [1] and + following the instructions on [2]. + + [1] https://kernel-team.pages.debian.net/kernel-handbook/ch-common-tasks.html#s-common-official + [2] http://snapshot.debian.org/package/linux-2.6/2.6.32-48/#linux-source-2.6.32_2.6.32-48 + + :avocado: tags=arch:mips64el + """ + if self.arch != 'mips64el': + self.cancel('Currently specific to the %s target arch' % self.arch) + + deb_url = ('http://snapshot.debian.org/archive/debian/20130217T032700Z/' + 'pool/main/l/linux-2.6/' + 'linux-image-2.6.32-5-5kc-malta_2.6.32-48_mipsel.deb') + deb_hash = '1aaec92083bf22fda31e0d27fa8d9a388e5fc3d5' + deb_path = self.fetch_asset(deb_url, asset_hash=deb_hash) + subprocess.check_call(['dpkg-deb', '--extract', deb_path, self.workdir]) + kernel_path = self.workdir + '/boot/vmlinux-2.6.32-5-5kc-malta' + + self.vm.set_arch(self.arch) + self.vm.set_machine('malta') + self.vm.set_console("") # XXX + kernel_command_line = 'console=ttyS0 printk.time=0' + self.vm.add_args('-m', "64", + '-serial', "chardev:console", + '-kernel', kernel_path, + '-append', kernel_command_line) + + self.vm.launch() + console = self.vm.console_socket.makefile() + console_logger = logging.getLogger('console') + while True: + msg = console.readline() + console_logger.debug(msg.strip()) + if 'Kernel command line: %s' % kernel_command_line in msg: + break + if 'Kernel panic - not syncing' in msg: + self.fail("Kernel panic reached")
Signature · 1 line
2.19.1
PATCH v3 5/6 tests/acceptance: Add test_sh4_r2d in BootLinuxConsole
In reply to Philippe Mathieu-DaudéSimilar to the test_x86_64_pc test, this boots a Linux kernel on a R2D board (SH4 little-endian) and verify the serial is working.
This test requires the dpkg-deb tool (apt/dnf install dpkg) to extract the kernel from the Debian package.
Note, due to a problem with the serial on this machine, this test is currently disabled.
--- tests/acceptance/boot_linux_console.py | 48 ++++++++++++++++++++++++++ 1 file changed, 48 insertions(+)
tests/acceptance/boot_linux_console.py +48 -0
@@ -11,6 +11,7 @@ import logging import subprocess +from avocado import skip from avocado_qemu import Test
@@ -137,3 +138,50 @@ class BootLinuxConsole(Test): break if 'Kernel panic - not syncing' in msg: self.fail("Kernel panic reached") + + @skip("console not working on r2d machine") + def test_sh4_r2d(self): + """ + This test requires the dpkg-deb tool (apt/dnf install dpkg) to extract + the kernel from the Debian package. + This test also requires the QEMU binary to be compiled with: + + $ configure ... --enable-trace-backends=log + + The kernel can be rebuilt using this Debian kernel source [1] and + following the instructions on [2]. + + [1] https://kernel-team.pages.debian.net/kernel-handbook/ch-common-tasks.html#s-common-official + [2] http://snapshot.debian.org/package/linux-2.6/2.6.32-30/#linux-source-2.6.32_2.6.32-30 + + :avocado: tags=arch:sh4 + """ + if self.arch != 'sh4': + self.cancel('Currently specific to the %s target arch' % self.arch) + + deb_url = ('http://snapshot.debian.org/archive/' + 'debian-ports/20110116T065852Z/pool-sh4/main/l/' + 'linux-2.6/linux-image-2.6.32-5-sh7751r_2.6.32-30_sh4.deb') + deb_hash = '8025e503319dc8ad786756e3afaa8eb868e9ef59' + deb_path = self.fetch_asset(deb_url, asset_hash=deb_hash) + subprocess.check_call(['dpkg-deb', '--extract', deb_path, self.workdir]) + kernel_path = self.workdir + '/boot/vmlinuz-2.6.32-5-sh7751r' + + self.vm.set_arch(self.arch) + self.vm.set_machine('r2d') + self.vm.set_console("") # XXX + kernel_command_line = 'console=ttyS0 printk.time=0 noiotrap' + self.vm.add_args('-serial', "chardev:console", + '-kernel', kernel_path, + '-append', kernel_command_line) + + self.vm.launch() + console = self.vm.console_socket.makefile() + console_logger = logging.getLogger('console') + while True: + msg = console.readline() + console_logger.debug(msg.strip()) + if 'Kernel command line: %s' % kernel_command_line in msg: + break + if 'Kernel panic - not syncing' in msg: + self.fail("Kernel panic reached")
Signature · 1 line
2.19.1
Re: [Qemu-devel] [PATCH v3 5/6] tests/acceptance: Add test_sh4_r2d in BootLinuxConsole
Quoted 8 lines · Philippe Mathieu-Daudé
Similar to the
test_x86_64_pctest, this boots a Linux kernel on a R2D board (SH4 little-endian) and verify the serial is working.This test requires the dpkg-deb tool (apt/dnf install dpkg) to extract the kernel from the Debian package.
Note, due to a problem with the serial on this machine, this test is currently disabled.
Reading [1] "SH7751R has both SCI and SCIF ports. ttySC1 is the second (SCIF) port." and [2] I could figure the correct kernel arguments and the -serial argument out.
[1] http://lists.busybox.net/pipermail/buildroot/2011-October/047070.html
[2] http://lists.busybox.net/pipermail/buildroot/2011-October/047070.html
With the following patch:
-- >8 --
@@ -13,5 +13,4 @@ import logging
import subprocess
-from avocado import skip
from avocado_qemu import Test
from avocado.utils.wait import wait_for
@@ -151,5 +150,4 @@ class BootLinuxConsole(Test):
self.fail("Kernel panic reached")
- @skip("console not working on r2d machine")
def test_sh4_r2d(self):
"""
@@ -182,6 +180,8 @@ class BootLinuxConsole(Test):
self.vm.set_machine('r2d')
self.vm.set_console("") # XXX
- kernel_command_line = 'console=ttyS0 printk.time=0 noiotrap'
- self.vm.add_args('-serial', "chardev:console",
+ kernel_command_line = 'console=ttySC0 printk.time=0 noiotrap'
+ self.vm.add_args('-serial', 'null',
+ '-serial', "chardev:console",
+ '-display', 'none',
'-kernel', kernel_path,
'-append', kernel_command_line)---
I finally get:
(1/4)
tests/acceptance/boot_linux_console.py:BootLinuxConsole.test_x86_64_pc:
CANCEL: Currently specific to the x86_64 target arch (0.00 s)
(2/4)
tests/acceptance/boot_linux_console.py:BootLinuxConsole.test_mips_4kc_malta:
CANCEL: Currently specific to the sh4 target arch (0.00 s)
(3/4)
tests/acceptance/boot_linux_console.py:BootLinuxConsole.test_mipsel_5kc_malta:
CANCEL: Currently specific to the sh4 target arch (0.00 s)
(4/4)
tests/acceptance/boot_linux_console.py:BootLinuxConsole.test_sh4_r2d: /
console: [ 0.000000] Initializing cgroup subsys cpuset
console: [ 0.000000] Initializing cgroup subsys cpu
console: [ 0.000000] Linux version 2.6.32-5-sh7751r (Debian
2.6.32-30) ([email protected]) (gcc version 4.3.5 (Debian 4.3.5-4) ) #1 Thu Jan 13 08:23:18 UTC 2011
console: [ 0.000000] Boot params:
console: [ 0.000000] ... MOUNT_ROOT_RDONLY - 00000000
console: [ 0.000000] ... RAMDISK_FLAGS - 00000000
console: [ 0.000000] ... ORIG_ROOT_DEV - 00000000
console: [ 0.000000] ... LOADER_TYPE - 00000000
console: [ 0.000000] ... INITRD_START - 00000000
console: [ 0.000000] ... INITRD_SIZE - 00000000
console: [ 0.000000] Booting machvec: RTS7751R2D
console: [ 0.000000] Renesas Technology Sales RTS7751R2D support.
console: [ 0.000000] FPGA version:1 (revision:0)
console: [ 0.000000] Node 0: start_pfn = 0xc000, low = 0x10000
console: [ 0.000000] Zone PFN ranges:
console: [ 0.000000] Normal 0x0000c000 -> 0x00010000
console: [ 0.000000] Movable zone start PFN for each node
console: [ 0.000000] early_node_map[1] active PFN ranges
console: [ 0.000000] 0: 0x0000c000 -> 0x00010000
console: [ 0.000000] Built 1 zonelists in Zone order, mobility
grouping on. Total pages: 16256
console: [ 0.000000] Kernel command line: console=ttySC0
printk.time=0 noiotrap
PASS (1.92 s)
Quoted 70 lines
Signed-off-by Philippe Mathieu-Daudé <[email protected]>--- tests/acceptance/boot_linux_console.py | 48 ++++++++++++++++++++++++++ 1 file changed, 48 insertions(+)tests/acceptance/boot_linux_console.py +48
-0@@ -11,6 +11,7 @@ import logging import subprocess +from avocado import skip from avocado_qemu import Test@@ -137,3 +138,50 @@ class BootLinuxConsole(Test): break if 'Kernel panic - not syncing' in msg: self.fail("Kernel panic reached") + + @skip("console not working on r2d machine") + def test_sh4_r2d(self): + """ + This test requires the dpkg-deb tool (apt/dnf install dpkg) to extract + the kernel from the Debian package. + This test also requires the QEMU binary to be compiled with: + + $ configure ... --enable-trace-backends=log + + The kernel can be rebuilt using this Debian kernel source [1] and + following the instructions on [2]. + + [1] https://kernel-team.pages.debian.net/kernel-handbook/ch-common-tasks.html#s-common-official + [2] http://snapshot.debian.org/package/linux-2.6/2.6.32-30/#linux-source-2.6.32_2.6.32-30 + + :avocado: tags=arch:sh4 + """ + if self.arch != 'sh4': + self.cancel('Currently specific to the %s target arch' % self.arch) + + deb_url = ('http://snapshot.debian.org/archive/' + 'debian-ports/20110116T065852Z/pool-sh4/main/l/' + 'linux-2.6/linux-image-2.6.32-5-sh7751r_2.6.32-30_sh4.deb') + deb_hash = '8025e503319dc8ad786756e3afaa8eb868e9ef59' + deb_path = self.fetch_asset(deb_url, asset_hash=deb_hash) + subprocess.check_call(['dpkg-deb', '--extract', deb_path, self.workdir]) + kernel_path = self.workdir + '/boot/vmlinuz-2.6.32-5-sh7751r' + + self.vm.set_arch(self.arch) + self.vm.set_machine('r2d') + self.vm.set_console("") # XXX + kernel_command_line = 'console=ttyS0 printk.time=0 noiotrap' + self.vm.add_args('-serial', "chardev:console", + '-kernel', kernel_path, + '-append', kernel_command_line) + + self.vm.launch() + console = self.vm.console_socket.makefile() + console_logger = logging.getLogger('console') + while True: + msg = console.readline() + console_logger.debug(msg.strip()) + if 'Kernel command line: %s' % kernel_command_line in msg: + break + if 'Kernel panic - not syncing' in msg: + self.fail("Kernel panic reached")
RFC PATCH v3 6/6 tests/acceptance: Add test_sh4_r2d in BootLinuxTracing
In reply to Philippe Mathieu-DaudéSimilar to the test_x86_64_pc test, this boots a Linux kernel on a R2D board (SH4 little-endian) and verify the usb is working by looking at the usb trace events. Thus this test requires the QEMU binary to be compiled with:
$ configure ... --enable-trace-backends=log
This test also requires the dpkg-deb tool (apt/dnf install dpkg) to extract the kernel from the Debian package.
$ avocado --show=app,trace run -p arch=sh4 tests/acceptance/boot_linux_console.py JOB ID : dc45be27f5d1edb8289a1ede139e107bbc55b045 JOB LOG : /home/phil/avocado/job-results/job-2018-10-13T14.46-dc45be2/job.log (1/5) tests/acceptance/boot_linux_console.py:BootLinuxConsole.test_x86_64_pc: CANCEL: Currently specific to the x86_64 target arch (0.00 s) (2/5) tests/acceptance/boot_linux_console.py:BootLinuxConsole.test_mips_4kc_malta: CANCEL: Currently specific to the sh4 target arch (0.00 s) (3/5) tests/acceptance/boot_linux_console.py:BootLinuxConsole.test_mipsel_5kc_malta: CANCEL: Currently specific to the sh4 target arch (0.00 s) (4/5) tests/acceptance/boot_linux_console.py:BootLinuxConsole.test_sh4_r2d: SKIP: console not working on r2d machine (5/5) tests/acceptance/boot_linux_console.py:BootLinuxTracing.test_sh4_r2d: / trace: [email protected]:usb_ohci_init_time usb_bit_time=1000000 usb_frame_time=83 trace: [email protected]:usb_ohci_port_attach port #0 trace: [email protected]:usb_ohci_reset sysbus-ohci trace: [email protected]:usb_ohci_stop sysbus-ohci: USB Suspended trace: [email protected]:usb_ohci_stop sysbus-ohci: USB Suspended trace: [email protected]:usb_ohci_port_detach port #0 trace: [email protected]:usb_ohci_port_attach port #0 trace: [email protected]:usb_ohci_reset sysbus-ohci trace: [email protected]:usb_ohci_stop sysbus-ohci: USB Suspended trace: [email protected]:usb_ohci_set_ctl sysbus-ohci: new state 0x80 trace: [email protected]:usb_ohci_start sysbus-ohci: USB Operational trace: [email protected]:usb_ohci_hub_power_up powered up all ports PASS (2.43 s) RESULTS : PASS 1 | ERROR 0 | FAIL 0 | SKIP 0 | WARN 0 | INTERRUPT 0 | CANCEL 3 JOB TIME : 2.67 s
--- tests/acceptance/boot_linux_console.py | 64 ++++++++++++++++++++++++++ 1 file changed, 64 insertions(+)
tests/acceptance/boot_linux_console.py +64 -0
@@ -8,11 +8,22 @@ # 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 os import logging import subprocess from avocado import skip from avocado_qemu import Test +from avocado.utils.wait import wait_for + + +def read_stream_for_string(stream, expected_string, logger=None): + msg = stream.readline() + if len(msg) == 0: + return False + if logger: + logger.debug(msg.strip()) + return expected_string in msg class BootLinuxConsole(Test):
@@ -185,3 +196,56 @@ class BootLinuxConsole(Test): break if 'Kernel panic - not syncing' in msg: self.fail("Kernel panic reached") + +class BootLinuxTracing(Test): + """ + Boots a Linux kernel and checks that via the Tracing framework that + a specific trace events occured, demostrating the kernel is operational. + + :avocado: enable + """ + + timeout = 60 + + def test_sh4_r2d(self): + """ + This test requires the dpkg-deb tool (apt/dnf install dpkg) to extract + the kernel from the Debian package. + This test also requires the QEMU binary to be compiled with: + + $ configure ... --enable-trace-backends=log + + The kernel can be rebuilt using this Debian kernel source [1] and + following the instructions on [2]. + + [1] https://kernel-team.pages.debian.net/kernel-handbook/ch-common-tasks.html#s-common-official + [2] http://snapshot.debian.org/package/linux-2.6/2.6.32-30/#linux-source-2.6.32_2.6.32-30 + + :avocado: tags=arch:sh4 + """ + if self.arch != 'sh4': + self.cancel('Currently specific to the %s target arch' % self.arch) + + deb_url = ('http://snapshot.debian.org/archive/' + 'debian-ports/20110116T065852Z/pool-sh4/main/l/' + 'linux-2.6/linux-image-2.6.32-5-sh7751r_2.6.32-30_sh4.deb') + deb_hash = '8025e503319dc8ad786756e3afaa8eb868e9ef59' + deb_path = self.fetch_asset(deb_url, asset_hash=deb_hash) + subprocess.check_call(['dpkg-deb', '--extract', deb_path, self.workdir]) + kernel_path = self.workdir + '/boot/vmlinuz-2.6.32-5-sh7751r' + trace_path = os.path.join(self.workdir, 'trace.log') + trace_logger = logging.getLogger('trace') + + self.vm.set_arch(self.arch) + self.vm.set_machine('r2d') + kernel_command_line = 'noiotrap' + self.vm.add_args('-trace', "enable=usb_ohci_*,file=" + trace_path, + '-kernel', kernel_path, + '-append', kernel_command_line) + + self.vm.launch() + if not wait_for(read_stream_for_string, timeout=15, step=0, + args=(open(trace_path), + 'usb_ohci_hub_power_up powered up all ports', + trace_logger)): + self.fail("Machine failed to boot")
Signature · 1 line
2.19.1
Re: [Qemu-devel] [RFC PATCH v3 6/6] tests/acceptance: Add test_sh4_r2d in BootLinuxTracing
Quoted 25 lines · Philippe Mathieu-Daudé
Similar to the
test_x86_64_pctest, this boots a Linux kernel on a R2D board (SH4 little-endian) and verify the usb is working by looking at the usb trace events. Thus this test requires the QEMU binary to be compiled with:$ configure ... --enable-trace-backends=logThis test also requires the dpkg-deb tool (apt/dnf install dpkg) to extract the kernel from the Debian package.
$ avocado --show=app,trace run -p arch=sh4 tests/acceptance/boot_linux_console.py JOB ID : dc45be27f5d1edb8289a1ede139e107bbc55b045 JOB LOG : /home/phil/avocado/job-results/job-2018-10-13T14.46-dc45be2/job.log (1/5) tests/acceptance/boot_linux_console.py:BootLinuxConsole.test_x86_64_pc: CANCEL: Currently specific to the x86_64 target arch (0.00 s) (2/5) tests/acceptance/boot_linux_console.py:BootLinuxConsole.test_mips_4kc_malta: CANCEL: Currently specific to the sh4 target arch (0.00 s) (3/5) tests/acceptance/boot_linux_console.py:BootLinuxConsole.test_mipsel_5kc_malta: CANCEL: Currently specific to the sh4 target arch (0.00 s) (4/5) tests/acceptance/boot_linux_console.py:BootLinuxConsole.test_sh4_r2d: SKIP: console not working on r2d machine (5/5) tests/acceptance/boot_linux_console.py:BootLinuxTracing.test_sh4_r2d: / trace: [email protected]:usb_ohci_init_time usb_bit_time=1000000 usb_frame_time=83 trace: [email protected]:usb_ohci_port_attach port #0 trace: [email protected]:usb_ohci_reset sysbus-ohci trace: [email protected]:usb_ohci_stop sysbus-ohci: USB Suspended trace: [email protected]:usb_ohci_stop sysbus-ohci: USB Suspended trace: [email protected]:usb_ohci_port_detach port #0 trace: [email protected]:usb_ohci_port_attach port #0
Quoted 9 lines
trace: [email protected]:usb_ohci_reset sysbus-ohci trace: [email protected]:usb_ohci_stop sysbus-ohci: USB Suspended trace: [email protected]:usb_ohci_set_ctl sysbus-ohci: new state 0x80 trace: [email protected]:usb_ohci_start sysbus-ohci: USB Operational trace: [email protected]:usb_ohci_hub_power_up powered up all ports PASS (2.43 s) RESULTS : PASS 1 | ERROR 0 | FAIL 0 | SKIP 0 | WARN 0 | INTERRUPT 0 | CANCEL 3 JOB TIME : 2.67 s
And with similar changes, on this point of this series:
$ avocado run tests/acceptance/boot_linux_console.py JOB ID : 857fef1b8c0ce59a79d452f27e996ed2743404b1 JOB LOG : /home/cleber/avocado/job-results/job-2018-10-19T19.58-857fef1/job.log (1/5) tests/acceptance/boot_linux_console.py:BootLinuxConsole.test_x86_64_pc: PASS (2.04 s) (2/5) tests/acceptance/boot_linux_console.py:BootLinuxConsole.test_mips_4kc_malta: PASS (0.57 s) (3/5) tests/acceptance/boot_linux_console.py:BootLinuxConsole.test_mipsel_5kc_malta: PASS (0.59 s) (4/5) tests/acceptance/boot_linux_console.py:BootLinuxConsole.test_sh4_r2d: SKIP: console not working on r2d machine (5/5) tests/acceptance/boot_linux_console.py:BootLinuxTracing.test_sh4_r2d: PASS (1.01 s) RESULTS : PASS 4 | ERROR 0 | FAIL 0 | SKIP 1 | WARN 0 | INTERRUPT 0 | CANCEL 0 JOB TIME : 4.57 s
- Cleber.
Quoted 90 lines
Signed-off-by Philippe Mathieu-Daudé <[email protected]>--- tests/acceptance/boot_linux_console.py | 64 ++++++++++++++++++++++++++ 1 file changed, 64 insertions(+)tests/acceptance/boot_linux_console.py +64
-0@@ -8,11 +8,22 @@ # 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 os import logging import subprocess from avocado import skip from avocado_qemu import Test +from avocado.utils.wait import wait_for + + +def read_stream_for_string(stream, expected_string, logger=None): + msg = stream.readline() + if len(msg) == 0: + return False + if logger: + logger.debug(msg.strip()) + return expected_string in msg class BootLinuxConsole(Test):@@ -185,3 +196,56 @@ class BootLinuxConsole(Test): break if 'Kernel panic - not syncing' in msg: self.fail("Kernel panic reached") + +class BootLinuxTracing(Test): + """ + Boots a Linux kernel and checks that via the Tracing framework that + a specific trace events occured, demostrating the kernel is operational. + + :avocado: enable + """ + + timeout = 60 + + def test_sh4_r2d(self): + """ + This test requires the dpkg-deb tool (apt/dnf install dpkg) to extract + the kernel from the Debian package. + This test also requires the QEMU binary to be compiled with: + + $ configure ... --enable-trace-backends=log + + The kernel can be rebuilt using this Debian kernel source [1] and + following the instructions on [2]. + + [1] https://kernel-team.pages.debian.net/kernel-handbook/ch-common-tasks.html#s-common-official + [2] http://snapshot.debian.org/package/linux-2.6/2.6.32-30/#linux-source-2.6.32_2.6.32-30 + + :avocado: tags=arch:sh4 + """ + if self.arch != 'sh4': + self.cancel('Currently specific to the %s target arch' % self.arch) + + deb_url = ('http://snapshot.debian.org/archive/' + 'debian-ports/20110116T065852Z/pool-sh4/main/l/' + 'linux-2.6/linux-image-2.6.32-5-sh7751r_2.6.32-30_sh4.deb') + deb_hash = '8025e503319dc8ad786756e3afaa8eb868e9ef59' + deb_path = self.fetch_asset(deb_url, asset_hash=deb_hash) + subprocess.check_call(['dpkg-deb', '--extract', deb_path, self.workdir]) + kernel_path = self.workdir + '/boot/vmlinuz-2.6.32-5-sh7751r' + trace_path = os.path.join(self.workdir, 'trace.log') + trace_logger = logging.getLogger('trace') + + self.vm.set_arch(self.arch) + self.vm.set_machine('r2d') + kernel_command_line = 'noiotrap' + self.vm.add_args('-trace', "enable=usb_ohci_*,file=" + trace_path, + '-kernel', kernel_path, + '-append', kernel_command_line) + + self.vm.launch() + if not wait_for(read_stream_for_string, timeout=15, step=0, + args=(open(trace_path), + 'usb_ohci_hub_power_up powered up all ports', + trace_logger)): + self.fail("Machine failed to boot")
Signature · 4 lines
Cleber Rosa [ Sr Software Engineer - Virtualization Team - Red Hat ] [ Avocado Test Framework - avocado-framework.github.io ] [ 7ABB 96EB 8B46 B94D 5E0F E9BB 657E 8D33 A5F2 09F3 ]
Quoted 8 lines · Philippe Mathieu-Daudé
Hi,
Another neanderthal approach to add multi-arch acceptance tests using Avocado.
I couldn't figure how to use the R2D serial, the kernel boots using the sm501 display correctly, but I'm too console-oriented to write UI tests...
Magnus or Zoltan, any hint on this?
IIRC you have to use the second UART, see:
https://wiki.qemu.org/Documentation/Platforms/SH4
Thomas
Ping for review before I send v3?
v3:
- fix patch 4 "Add test_sh4_r2d in BootLinuxConsole"
- drop patch 5? "Add test_sh4_r2d in BootLinuxTracing"
Quoted 6 lines · Philippe Mathieu-Daudé
Another neanderthal approach to add multi-arch acceptance tests using Avocado.
I couldn't figure how to use the R2D serial, the kernel boots using the sm501 display correctly, but I'm too console-oriented to write UI tests...
Magnus or Zoltan, any hint on this?
Fixed (see reply to patch #5)
Quoted 19 lines
Thanks
Phil.
Since v2 (http://lists.gnu.org/archive/html/qemu-devel/2018-06/msg06370.html):
- use Debian packaged kernels, add link to the sources and a comment about how to rebuild these images (Alex)
- use self.arch from Cleber's series
- add mips64el kernel console test
- add sh4 test using the tracing frameworkSince v1 (http://lists.gnu.org/archive/html/qemu-devel/2018-04/msg03076.html):
- we can now run other archs (Cleber)Based-on: [email protected] "Acceptance Tests: basic architecture support" from Cleber Rosa
https://lists.gnu.org/archive/html/qemu-devel/2018-10/msg01821.html
Quoted 8 lines
Philippe Mathieu-Daudé (6):
tests/acceptance: Rename the generic BootLinuxConsole test astest_x86_64_pctests/acceptance: Add a kludge to not use the default console tests/acceptance: Add
test_mips_4kc_maltain BootLinuxConsole tests/acceptance: Addtest_mipsel_5kc_maltain BootLinuxConsole tests/acceptance: Addtest_sh4_r2din BootLinuxConsole tests/acceptance: Addtest_sh4_r2din BootLinuxTracing
Thanks,
Phil.