2018-05-30 20:41:56 +02:00
|
|
|
# Functional test that boots a Linux kernel and checks the console
|
|
|
|
#
|
|
|
|
# Copyright (c) 2018 Red Hat, Inc.
|
|
|
|
#
|
|
|
|
# Author:
|
|
|
|
# Cleber Rosa <crosa@redhat.com>
|
|
|
|
#
|
|
|
|
# This work is licensed under the terms of the GNU GPL, version 2 or
|
|
|
|
# later. See the COPYING file in the top-level directory.
|
|
|
|
|
2019-03-12 18:18:17 +01:00
|
|
|
import os
|
BootLinuxConsoleTest: Test nanoMIPS kernels on the I7200 CPU
Similar to the x86_64/pc test, it boots a Linux kernel on a Malta
machine and verify the serial is working.
Use the documentation added in commit f7d257cb4a17 to test
nanoMIPS kernels and the I7200 CPU.
This test can be run using:
$ avocado --show=console run -t arch:mipsel tests/acceptance/boot_linux_console.py
console: [ 0.000000] Linux version 4.15.18-00432-gb2eb9a8b (emubuild@mipscs563) (gcc version 6.3.0 (Codescape GNU Tools 2018.04-02 for nanoMIPS Linux)) #1 SMP Wed Jun 27 11:10:08 PDT 2018
console: [ 0.000000] GCRs appear to have been moved (expected them at 0x1fbf8000)!
console: [ 0.000000] GCRs appear to have been moved (expected them at 0x1fbf8000)!
console: [ 0.000000] CPU0 revision is: 00010000 (MIPS GENERIC QEMU)
console: [ 0.000000] MIPS: machine is mti,malta
console: [ 0.000000] Determined physical RAM map:
console: [ 0.000000] memory: 08000000 @ 00000000 (usable)
console: [ 0.000000] earlycon: ns16550a0 at I/O port 0x3f8 (options '38400n8')
console: [ 0.000000] bootconsole [ns16550a0] enabled
console: [ 0.000000] User-defined physical RAM map:
console: [ 0.000000] memory: 10000000 @ 00000000 (usable)
console: [ 0.000000] Initrd not found or empty - disabling initrd
console: [ 0.000000] MIPS CPS SMP unable to proceed without a CM
console: [ 0.000000] Primary instruction cache 32kB, VIPT, 4-way, linesize 32 bytes.
console: [ 0.000000] Primary data cache 32kB, 4-way, VIPT, cache aliases, linesize 32 bytes
console: [ 0.000000] This processor doesn't support highmem. -262144k highmem ignored
console: [ 0.000000] Zone ranges:
console: [ 0.000000] Normal [mem 0x0000000000000000-0x000000000fffffff]
console: [ 0.000000] HighMem empty
console: [ 0.000000] Movable zone start for each node
console: [ 0.000000] Early memory node ranges
console: [ 0.000000] node 0: [mem 0x0000000000000000-0x000000000fffffff]
console: [ 0.000000] Initmem setup node 0 [mem 0x0000000000000000-0x000000000fffffff]
console: [ 0.000000] random: get_random_bytes called from start_kernel+0x60/0x2f0 with crng_init=0
console: [ 0.000000] percpu: Embedded 16 pages/cpu @(ptrval) s36620 r8192 d20724 u65536
console: [ 0.000000] Built 1 zonelists, mobility grouping on. Total pages: 64960
console: [ 0.000000] Kernel command line: printk.time=0 mem=256m@@0x0 console=ttyS0 earlycon
Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Message-Id: <20190520231910.12184-3-f4bug@amsat.org>
Acked-by: Aleksandar Markovic <amarkovic@wavecomp.com>
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
2019-05-21 01:19:08 +02:00
|
|
|
import lzma
|
2019-05-21 01:19:09 +02:00
|
|
|
import gzip
|
BootLinuxConsoleTest: Test nanoMIPS kernels on the I7200 CPU
Similar to the x86_64/pc test, it boots a Linux kernel on a Malta
machine and verify the serial is working.
Use the documentation added in commit f7d257cb4a17 to test
nanoMIPS kernels and the I7200 CPU.
This test can be run using:
$ avocado --show=console run -t arch:mipsel tests/acceptance/boot_linux_console.py
console: [ 0.000000] Linux version 4.15.18-00432-gb2eb9a8b (emubuild@mipscs563) (gcc version 6.3.0 (Codescape GNU Tools 2018.04-02 for nanoMIPS Linux)) #1 SMP Wed Jun 27 11:10:08 PDT 2018
console: [ 0.000000] GCRs appear to have been moved (expected them at 0x1fbf8000)!
console: [ 0.000000] GCRs appear to have been moved (expected them at 0x1fbf8000)!
console: [ 0.000000] CPU0 revision is: 00010000 (MIPS GENERIC QEMU)
console: [ 0.000000] MIPS: machine is mti,malta
console: [ 0.000000] Determined physical RAM map:
console: [ 0.000000] memory: 08000000 @ 00000000 (usable)
console: [ 0.000000] earlycon: ns16550a0 at I/O port 0x3f8 (options '38400n8')
console: [ 0.000000] bootconsole [ns16550a0] enabled
console: [ 0.000000] User-defined physical RAM map:
console: [ 0.000000] memory: 10000000 @ 00000000 (usable)
console: [ 0.000000] Initrd not found or empty - disabling initrd
console: [ 0.000000] MIPS CPS SMP unable to proceed without a CM
console: [ 0.000000] Primary instruction cache 32kB, VIPT, 4-way, linesize 32 bytes.
console: [ 0.000000] Primary data cache 32kB, 4-way, VIPT, cache aliases, linesize 32 bytes
console: [ 0.000000] This processor doesn't support highmem. -262144k highmem ignored
console: [ 0.000000] Zone ranges:
console: [ 0.000000] Normal [mem 0x0000000000000000-0x000000000fffffff]
console: [ 0.000000] HighMem empty
console: [ 0.000000] Movable zone start for each node
console: [ 0.000000] Early memory node ranges
console: [ 0.000000] node 0: [mem 0x0000000000000000-0x000000000fffffff]
console: [ 0.000000] Initmem setup node 0 [mem 0x0000000000000000-0x000000000fffffff]
console: [ 0.000000] random: get_random_bytes called from start_kernel+0x60/0x2f0 with crng_init=0
console: [ 0.000000] percpu: Embedded 16 pages/cpu @(ptrval) s36620 r8192 d20724 u65536
console: [ 0.000000] Built 1 zonelists, mobility grouping on. Total pages: 64960
console: [ 0.000000] Kernel command line: printk.time=0 mem=256m@@0x0 console=ttyS0 earlycon
Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Message-Id: <20190520231910.12184-3-f4bug@amsat.org>
Acked-by: Aleksandar Markovic <amarkovic@wavecomp.com>
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
2019-05-21 01:19:08 +02:00
|
|
|
import shutil
|
2018-05-30 20:41:56 +02:00
|
|
|
|
2019-10-29 00:04:04 +01:00
|
|
|
from avocado import skipUnless
|
2018-05-30 20:41:56 +02:00
|
|
|
from avocado_qemu import Test
|
2019-10-29 00:04:04 +01:00
|
|
|
from avocado_qemu import exec_command_and_wait_for_pattern
|
tests/boot_linux_console: Test booting NetBSD via U-Boot on OrangePi PC
This test boots U-Boot then NetBSD (stored on a SD card) on
a OrangePi PC board.
As it requires ~1.3GB of storage, it is disabled by default.
U-Boot is built by the Debian project [1], and the SD card image
is provided by the NetBSD organization [2].
Once the compressed SD card image is downloaded (304MB) and
extracted, this test is fast:
$ AVOCADO_ALLOW_LARGE_STORAGE=yes \
avocado --show=app,console run -t machine:orangepi-pc \
tests/acceptance/boot_linux_console.py
console: U-Boot SPL 2020.01+dfsg-1 (Jan 08 2020 - 08:19:44 +0000)
console: DRAM: 1024 MiB
console: U-Boot 2020.01+dfsg-1 (Jan 08 2020 - 08:19:44 +0000) Allwinner Technology
console: CPU: Allwinner H3 (SUN8I 0000)
console: scanning bus usb@1c1b000 for devices... 1 USB Device(s) found
console: scanning bus usb@1c1d000 for devices... 1 USB Device(s) found
console: scanning usb for storage devices... 0 Storage Device(s) found
console: Hit any key to stop autoboot: 0
console: => setenv bootargs root=ld0a
console: => setenv kernel netbsd-GENERIC.ub
console: => setenv fdtfile dtb/sun8i-h3-orangepi-pc.dtb
console: => boot
console: ## Booting kernel from Legacy Image at 42000000 ...
console: Image Name: NetBSD/earmv7hf 9.0_RC1
console: Image Type: ARM Linux Kernel Image (no loading done) (uncompressed)
console: XIP Kernel Image (no loading done)
console: Loading Device Tree to 49ff6000, end 49fffe01 ... OK
console: Starting kernel ...
console: [ 1.0000000] NetBSD/evbarm (fdt) booting ...
console: [ 1.0000000] NetBSD 9.0 (GENERIC) #0: Fri Feb 14 00:06:28 UTC 2020
console: [ 1.0000000] mkrepro@mkrepro.NetBSD.org:/usr/src/sys/arch/evbarm/compile/GENERIC
console: [ 1.0000000] total memory = 1024 MB
console: [ 1.0000000] avail memory = 1003 MB
console: [ 1.0000000] armfdt0 (root)
console: [ 1.0000000] simplebus0 at armfdt0: Xunlong Orange Pi PC
console: [ 1.0000000] cpu0 at cpus0: Cortex-A7 r0p5 (Cortex V7A core)
console: [ 1.0000000] cpu0: DC enabled IC enabled WB enabled LABT branch prediction enabled
console: [ 1.0000000] cpu0: 32KB/64B 2-way L1 VIPT Instruction cache
console: [ 1.0000000] cpu0: 32KB/64B 2-way write-back-locking-C L1 PIPT Data cache
console: [ 1.0000000] cpu0: 2304KB/64B 16-way write-through L2 PIPT Unified cache
console: [ 1.0000000] vfp0 at cpu0: NEON MPE (VFP 3.0+), rounding, NaN propagation, denormals
...
console: [ 2.3812082] sdmmc0: SD card status: 4-bit, C0
console: [ 2.3812082] ld0 at sdmmc0: <0xaa:0x5859:QEMU!:0x01:0xdeadbeef:0x062>
console: [ 2.4012856] ld0: 1226 MB, 622 cyl, 64 head, 63 sec, 512 bytes/sect x 2511872 sectors
console: [ 2.5321222] ld0: 4-bit width, High-Speed/SDR25, 50.000 MHz
console: [ 3.1068718] WARNING: 4 errors while detecting hardware; check system log.
console: [ 3.1179868] boot device: ld0
console: [ 3.1470623] root on ld0a dumps on ld0b
console: [ 3.2464436] root file system type: ffs
console: [ 3.2897123] kern.module.path=/stand/evbarm/9.0/modules
console: Mon Feb 17 20:33:35 UTC 2020
console: Starting root file system check:
PASS (35.96 s)
RESULTS : PASS 1 | ERROR 0 | FAIL 0 | SKIP 0 | WARN 0 | INTERRUPT 0 | CANCEL 0
JOB TIME : 36.09 s
Note, this test only took ~65 seconds to run on Travis-CI, see: [3].
This test is based on a description from Niek Linnenbank from [4].
[1] https://wiki.debian.org/InstallingDebianOn/Allwinner#Creating_a_bootable_SD_Card_with_u-boot
[2] https://wiki.netbsd.org/ports/evbarm/allwinner/
[3] https://travis-ci.org/philmd/qemu/jobs/638823612#L3778
[4] https://www.mail-archive.com/qemu-devel@nongnu.org/msg669347.html
Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Signed-off-by: Niek Linnenbank <nieklinnenbank@gmail.com>
Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
Tested-by: Alex Bennée <alex.bennee@linaro.org>
Message-id: 20200311221854.30370-18-nieklinnenbank@gmail.com
[NL: changed test to use NetBSD 9.0 final release and -global allwinner-rtc.base-year]
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2020-03-11 23:18:53 +01:00
|
|
|
from avocado_qemu import interrupt_interactive_console_until_pattern
|
2019-10-29 00:04:04 +01:00
|
|
|
from avocado_qemu import wait_for_console_pattern
|
2019-03-12 18:18:17 +01:00
|
|
|
from avocado.utils import process
|
|
|
|
from avocado.utils import archive
|
2020-03-11 23:18:52 +01:00
|
|
|
from avocado.utils.path import find_command, CmdNotFoundError
|
2018-05-30 20:41:56 +02:00
|
|
|
|
2020-03-11 23:18:52 +01:00
|
|
|
P7ZIP_AVAILABLE = True
|
|
|
|
try:
|
|
|
|
find_command('7z')
|
|
|
|
except CmdNotFoundError:
|
|
|
|
P7ZIP_AVAILABLE = False
|
2018-05-30 20:41:56 +02:00
|
|
|
|
2020-05-29 09:04:44 +02:00
|
|
|
class LinuxKernelTest(Test):
|
2019-03-12 18:18:13 +01:00
|
|
|
KERNEL_COMMON_COMMAND_LINE = 'printk.time=0 '
|
|
|
|
|
2020-05-29 09:04:44 +02:00
|
|
|
def wait_for_console_pattern(self, success_message, vm=None):
|
2019-10-29 00:04:04 +01:00
|
|
|
wait_for_console_pattern(self, success_message,
|
2020-05-29 09:04:44 +02:00
|
|
|
failure_message='Kernel panic - not syncing',
|
|
|
|
vm=vm)
|
2019-05-21 01:19:09 +02:00
|
|
|
|
2019-03-12 18:18:17 +01:00
|
|
|
def extract_from_deb(self, deb, path):
|
|
|
|
"""
|
|
|
|
Extracts a file from a deb package into the test workdir
|
|
|
|
|
|
|
|
:param deb: path to the deb archive
|
2020-01-27 17:36:31 +01:00
|
|
|
:param path: path within the deb archive of the file to be extracted
|
2019-03-12 18:18:17 +01:00
|
|
|
:returns: path of the extracted file
|
|
|
|
"""
|
|
|
|
cwd = os.getcwd()
|
|
|
|
os.chdir(self.workdir)
|
2019-03-13 00:45:40 +01:00
|
|
|
file_path = process.run("ar t %s" % deb).stdout_text.split()[2]
|
|
|
|
process.run("ar x %s %s" % (deb, file_path))
|
|
|
|
archive.extract(file_path, self.workdir)
|
2019-03-12 18:18:17 +01:00
|
|
|
os.chdir(cwd)
|
2020-02-05 15:56:05 +01:00
|
|
|
# Return complete path to extracted file. Because callers to
|
|
|
|
# extract_from_deb() specify 'path' with a leading slash, it is
|
|
|
|
# necessary to use os.path.relpath() as otherwise os.path.join()
|
|
|
|
# interprets it as an absolute path and drops the self.workdir part.
|
|
|
|
return os.path.normpath(os.path.join(self.workdir,
|
|
|
|
os.path.relpath(path, '/')))
|
2019-03-12 18:18:17 +01:00
|
|
|
|
2020-02-05 15:56:03 +01:00
|
|
|
def extract_from_rpm(self, rpm, path):
|
|
|
|
"""
|
|
|
|
Extracts a file from an RPM package into the test workdir.
|
|
|
|
|
|
|
|
:param rpm: path to the rpm archive
|
|
|
|
:param path: path within the rpm archive of the file to be extracted
|
|
|
|
needs to be a relative path (starting with './') because
|
|
|
|
cpio(1), which is used to extract the file, expects that.
|
|
|
|
:returns: path of the extracted file
|
|
|
|
"""
|
|
|
|
cwd = os.getcwd()
|
|
|
|
os.chdir(self.workdir)
|
|
|
|
process.run("rpm2cpio %s | cpio -id %s" % (rpm, path), shell=True)
|
|
|
|
os.chdir(cwd)
|
|
|
|
return os.path.normpath(os.path.join(self.workdir, path))
|
|
|
|
|
2020-05-29 09:04:44 +02:00
|
|
|
class BootLinuxConsole(LinuxKernelTest):
|
|
|
|
"""
|
|
|
|
Boots a Linux kernel and checks that the console is operational and the
|
|
|
|
kernel command line is properly passed from QEMU to the kernel
|
|
|
|
"""
|
|
|
|
timeout = 90
|
|
|
|
|
2019-03-12 18:18:11 +01:00
|
|
|
def test_x86_64_pc(self):
|
|
|
|
"""
|
|
|
|
:avocado: tags=arch:x86_64
|
|
|
|
:avocado: tags=machine:pc
|
|
|
|
"""
|
2019-09-04 02:52:18 +02:00
|
|
|
kernel_url = ('https://archives.fedoraproject.org/pub/archive/fedora'
|
|
|
|
'/linux/releases/29/Everything/x86_64/os/images/pxeboot'
|
|
|
|
'/vmlinuz')
|
2019-03-12 18:18:12 +01:00
|
|
|
kernel_hash = '23bebd2680757891cf7adedb033532163a792495'
|
2018-05-30 20:41:56 +02:00
|
|
|
kernel_path = self.fetch_asset(kernel_url, asset_hash=kernel_hash)
|
|
|
|
|
|
|
|
self.vm.set_console()
|
2019-03-12 18:18:13 +01:00
|
|
|
kernel_command_line = self.KERNEL_COMMON_COMMAND_LINE + 'console=ttyS0'
|
2018-05-30 20:41:56 +02:00
|
|
|
self.vm.add_args('-kernel', kernel_path,
|
|
|
|
'-append', kernel_command_line)
|
|
|
|
self.vm.launch()
|
2019-03-12 18:18:15 +01:00
|
|
|
console_pattern = 'Kernel command line: %s' % kernel_command_line
|
|
|
|
self.wait_for_console_pattern(console_pattern)
|
2019-03-12 18:18:17 +01:00
|
|
|
|
|
|
|
def test_mips_malta(self):
|
|
|
|
"""
|
|
|
|
:avocado: tags=arch:mips
|
|
|
|
:avocado: tags=machine:malta
|
|
|
|
:avocado: tags=endian:big
|
|
|
|
"""
|
|
|
|
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)
|
|
|
|
kernel_path = self.extract_from_deb(deb_path,
|
|
|
|
'/boot/vmlinux-2.6.32-5-4kc-malta')
|
|
|
|
|
|
|
|
self.vm.set_console()
|
|
|
|
kernel_command_line = self.KERNEL_COMMON_COMMAND_LINE + 'console=ttyS0'
|
|
|
|
self.vm.add_args('-kernel', kernel_path,
|
|
|
|
'-append', kernel_command_line)
|
|
|
|
self.vm.launch()
|
|
|
|
console_pattern = 'Kernel command line: %s' % kernel_command_line
|
|
|
|
self.wait_for_console_pattern(console_pattern)
|
2019-03-12 18:18:18 +01:00
|
|
|
|
|
|
|
def test_mips64el_malta(self):
|
|
|
|
"""
|
|
|
|
This test requires the ar tool to extract "data.tar.gz" from
|
|
|
|
the Debian package.
|
|
|
|
|
|
|
|
The kernel can be rebuilt using this Debian kernel source [1] and
|
|
|
|
following the instructions on [2].
|
|
|
|
|
|
|
|
[1] http://snapshot.debian.org/package/linux-2.6/2.6.32-48/
|
|
|
|
#linux-source-2.6.32_2.6.32-48
|
|
|
|
[2] https://kernel-team.pages.debian.net/kernel-handbook/
|
|
|
|
ch-common-tasks.html#s-common-official
|
|
|
|
|
|
|
|
:avocado: tags=arch:mips64el
|
|
|
|
:avocado: tags=machine:malta
|
|
|
|
"""
|
|
|
|
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)
|
|
|
|
kernel_path = self.extract_from_deb(deb_path,
|
|
|
|
'/boot/vmlinux-2.6.32-5-5kc-malta')
|
|
|
|
|
|
|
|
self.vm.set_console()
|
|
|
|
kernel_command_line = self.KERNEL_COMMON_COMMAND_LINE + 'console=ttyS0'
|
|
|
|
self.vm.add_args('-kernel', kernel_path,
|
|
|
|
'-append', kernel_command_line)
|
|
|
|
self.vm.launch()
|
|
|
|
console_pattern = 'Kernel command line: %s' % kernel_command_line
|
|
|
|
self.wait_for_console_pattern(console_pattern)
|
2019-03-12 18:18:21 +01:00
|
|
|
|
2019-05-21 01:19:09 +02:00
|
|
|
def test_mips_malta_cpio(self):
|
|
|
|
"""
|
|
|
|
:avocado: tags=arch:mips
|
|
|
|
:avocado: tags=machine:malta
|
|
|
|
:avocado: tags=endian:big
|
|
|
|
"""
|
|
|
|
deb_url = ('http://snapshot.debian.org/archive/debian/'
|
|
|
|
'20160601T041800Z/pool/main/l/linux/'
|
|
|
|
'linux-image-4.5.0-2-4kc-malta_4.5.5-1_mips.deb')
|
|
|
|
deb_hash = 'a3c84f3e88b54e06107d65a410d1d1e8e0f340f8'
|
|
|
|
deb_path = self.fetch_asset(deb_url, asset_hash=deb_hash)
|
|
|
|
kernel_path = self.extract_from_deb(deb_path,
|
|
|
|
'/boot/vmlinux-4.5.0-2-4kc-malta')
|
|
|
|
initrd_url = ('https://github.com/groeck/linux-build-test/raw/'
|
|
|
|
'8584a59ed9e5eb5ee7ca91f6d74bbb06619205b8/rootfs/'
|
|
|
|
'mips/rootfs.cpio.gz')
|
|
|
|
initrd_hash = 'bf806e17009360a866bf537f6de66590de349a99'
|
|
|
|
initrd_path_gz = self.fetch_asset(initrd_url, asset_hash=initrd_hash)
|
|
|
|
initrd_path = self.workdir + "rootfs.cpio"
|
2019-10-29 00:04:04 +01:00
|
|
|
archive.gzip_uncompress(initrd_path_gz, initrd_path)
|
2019-05-21 01:19:09 +02:00
|
|
|
|
|
|
|
self.vm.set_console()
|
|
|
|
kernel_command_line = (self.KERNEL_COMMON_COMMAND_LINE
|
|
|
|
+ 'console=ttyS0 console=tty '
|
|
|
|
+ 'rdinit=/sbin/init noreboot')
|
|
|
|
self.vm.add_args('-kernel', kernel_path,
|
|
|
|
'-initrd', initrd_path,
|
|
|
|
'-append', kernel_command_line,
|
|
|
|
'-no-reboot')
|
|
|
|
self.vm.launch()
|
|
|
|
self.wait_for_console_pattern('Boot successful.')
|
|
|
|
|
2019-10-29 00:04:04 +01:00
|
|
|
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')
|
2019-05-21 01:19:09 +02:00
|
|
|
|
2019-10-29 00:04:04 +01:00
|
|
|
@skipUnless(os.getenv('AVOCADO_ALLOW_UNTRUSTED_CODE'), 'untrusted code')
|
|
|
|
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_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')
|
2019-05-21 01:19:09 +02:00
|
|
|
|
BootLinuxConsoleTest: Test nanoMIPS kernels on the I7200 CPU
Similar to the x86_64/pc test, it boots a Linux kernel on a Malta
machine and verify the serial is working.
Use the documentation added in commit f7d257cb4a17 to test
nanoMIPS kernels and the I7200 CPU.
This test can be run using:
$ avocado --show=console run -t arch:mipsel tests/acceptance/boot_linux_console.py
console: [ 0.000000] Linux version 4.15.18-00432-gb2eb9a8b (emubuild@mipscs563) (gcc version 6.3.0 (Codescape GNU Tools 2018.04-02 for nanoMIPS Linux)) #1 SMP Wed Jun 27 11:10:08 PDT 2018
console: [ 0.000000] GCRs appear to have been moved (expected them at 0x1fbf8000)!
console: [ 0.000000] GCRs appear to have been moved (expected them at 0x1fbf8000)!
console: [ 0.000000] CPU0 revision is: 00010000 (MIPS GENERIC QEMU)
console: [ 0.000000] MIPS: machine is mti,malta
console: [ 0.000000] Determined physical RAM map:
console: [ 0.000000] memory: 08000000 @ 00000000 (usable)
console: [ 0.000000] earlycon: ns16550a0 at I/O port 0x3f8 (options '38400n8')
console: [ 0.000000] bootconsole [ns16550a0] enabled
console: [ 0.000000] User-defined physical RAM map:
console: [ 0.000000] memory: 10000000 @ 00000000 (usable)
console: [ 0.000000] Initrd not found or empty - disabling initrd
console: [ 0.000000] MIPS CPS SMP unable to proceed without a CM
console: [ 0.000000] Primary instruction cache 32kB, VIPT, 4-way, linesize 32 bytes.
console: [ 0.000000] Primary data cache 32kB, 4-way, VIPT, cache aliases, linesize 32 bytes
console: [ 0.000000] This processor doesn't support highmem. -262144k highmem ignored
console: [ 0.000000] Zone ranges:
console: [ 0.000000] Normal [mem 0x0000000000000000-0x000000000fffffff]
console: [ 0.000000] HighMem empty
console: [ 0.000000] Movable zone start for each node
console: [ 0.000000] Early memory node ranges
console: [ 0.000000] node 0: [mem 0x0000000000000000-0x000000000fffffff]
console: [ 0.000000] Initmem setup node 0 [mem 0x0000000000000000-0x000000000fffffff]
console: [ 0.000000] random: get_random_bytes called from start_kernel+0x60/0x2f0 with crng_init=0
console: [ 0.000000] percpu: Embedded 16 pages/cpu @(ptrval) s36620 r8192 d20724 u65536
console: [ 0.000000] Built 1 zonelists, mobility grouping on. Total pages: 64960
console: [ 0.000000] Kernel command line: printk.time=0 mem=256m@@0x0 console=ttyS0 earlycon
Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Message-Id: <20190520231910.12184-3-f4bug@amsat.org>
Acked-by: Aleksandar Markovic <amarkovic@wavecomp.com>
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
2019-05-21 01:19:08 +02:00
|
|
|
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"
|
|
|
|
with lzma.open(kernel_path_xz, 'rb') as f_in:
|
|
|
|
with open(kernel_path, 'wb') as f_out:
|
|
|
|
shutil.copyfileobj(f_in, f_out)
|
|
|
|
|
|
|
|
self.vm.set_console()
|
|
|
|
kernel_command_line = (self.KERNEL_COMMON_COMMAND_LINE
|
|
|
|
+ 'mem=256m@@0x0 '
|
|
|
|
+ 'console=ttyS0')
|
|
|
|
self.vm.add_args('-no-reboot',
|
|
|
|
'-cpu', 'I7200',
|
|
|
|
'-kernel', kernel_path,
|
|
|
|
'-append', kernel_command_line)
|
|
|
|
self.vm.launch()
|
|
|
|
console_pattern = 'Kernel command line: %s' % kernel_command_line
|
|
|
|
self.wait_for_console_pattern(console_pattern)
|
|
|
|
|
|
|
|
def test_mips_malta32el_nanomips_4k(self):
|
|
|
|
"""
|
|
|
|
:avocado: tags=arch:mipsel
|
|
|
|
:avocado: tags=machine:malta
|
|
|
|
:avocado: tags=endian:little
|
|
|
|
"""
|
|
|
|
kernel_url = ('https://mipsdistros.mips.com/LinuxDistro/nanomips/'
|
|
|
|
'kernels/v4.15.18-432-gb2eb9a8b07a1-20180627102142/'
|
|
|
|
'generic_nano32r6el_page4k.xz')
|
|
|
|
kernel_hash = '477456aafd2a0f1ddc9482727f20fe9575565dd6'
|
|
|
|
self.do_test_mips_malta32el_nanomips(kernel_url, kernel_hash)
|
|
|
|
|
|
|
|
def test_mips_malta32el_nanomips_16k_up(self):
|
|
|
|
"""
|
|
|
|
:avocado: tags=arch:mipsel
|
|
|
|
:avocado: tags=machine:malta
|
|
|
|
:avocado: tags=endian:little
|
|
|
|
"""
|
|
|
|
kernel_url = ('https://mipsdistros.mips.com/LinuxDistro/nanomips/'
|
|
|
|
'kernels/v4.15.18-432-gb2eb9a8b07a1-20180627102142/'
|
|
|
|
'generic_nano32r6el_page16k_up.xz')
|
|
|
|
kernel_hash = 'e882868f944c71c816e832e2303b7874d044a7bc'
|
|
|
|
self.do_test_mips_malta32el_nanomips(kernel_url, kernel_hash)
|
|
|
|
|
|
|
|
def test_mips_malta32el_nanomips_64k_dbg(self):
|
|
|
|
"""
|
|
|
|
:avocado: tags=arch:mipsel
|
|
|
|
:avocado: tags=machine:malta
|
|
|
|
:avocado: tags=endian:little
|
|
|
|
"""
|
|
|
|
kernel_url = ('https://mipsdistros.mips.com/LinuxDistro/nanomips/'
|
|
|
|
'kernels/v4.15.18-432-gb2eb9a8b07a1-20180627102142/'
|
|
|
|
'generic_nano32r6el_page64k_dbg.xz')
|
|
|
|
kernel_hash = '18d1c68f2e23429e266ca39ba5349ccd0aeb7180'
|
|
|
|
self.do_test_mips_malta32el_nanomips(kernel_url, kernel_hash)
|
|
|
|
|
2019-03-12 18:18:21 +01:00
|
|
|
def test_aarch64_virt(self):
|
|
|
|
"""
|
|
|
|
:avocado: tags=arch:aarch64
|
|
|
|
:avocado: tags=machine:virt
|
|
|
|
"""
|
2019-09-04 02:52:18 +02:00
|
|
|
kernel_url = ('https://archives.fedoraproject.org/pub/archive/fedora'
|
|
|
|
'/linux/releases/29/Everything/aarch64/os/images/pxeboot'
|
|
|
|
'/vmlinuz')
|
2019-03-12 18:18:21 +01:00
|
|
|
kernel_hash = '8c73e469fc6ea06a58dc83a628fc695b693b8493'
|
|
|
|
kernel_path = self.fetch_asset(kernel_url, asset_hash=kernel_hash)
|
|
|
|
|
|
|
|
self.vm.set_console()
|
|
|
|
kernel_command_line = (self.KERNEL_COMMON_COMMAND_LINE +
|
|
|
|
'console=ttyAMA0')
|
|
|
|
self.vm.add_args('-cpu', 'cortex-a53',
|
|
|
|
'-kernel', kernel_path,
|
|
|
|
'-append', kernel_command_line)
|
|
|
|
self.vm.launch()
|
|
|
|
console_pattern = 'Kernel command line: %s' % kernel_command_line
|
|
|
|
self.wait_for_console_pattern(console_pattern)
|
2019-03-12 18:18:22 +01:00
|
|
|
|
2020-05-25 16:12:37 +02:00
|
|
|
def test_aarch64_xlnx_versal_virt(self):
|
|
|
|
"""
|
|
|
|
:avocado: tags=arch:aarch64
|
|
|
|
:avocado: tags=machine:xlnx-versal-virt
|
|
|
|
:avocado: tags=device:pl011
|
|
|
|
:avocado: tags=device:arm_gicv3
|
|
|
|
"""
|
|
|
|
kernel_url = ('http://ports.ubuntu.com/ubuntu-ports/dists/'
|
|
|
|
'bionic-updates/main/installer-arm64/current/images/'
|
|
|
|
'netboot/ubuntu-installer/arm64/linux')
|
|
|
|
kernel_hash = '5bfc54cf7ed8157d93f6e5b0241e727b6dc22c50'
|
|
|
|
kernel_path = self.fetch_asset(kernel_url, asset_hash=kernel_hash)
|
|
|
|
|
|
|
|
initrd_url = ('http://ports.ubuntu.com/ubuntu-ports/dists/'
|
|
|
|
'bionic-updates/main/installer-arm64/current/images/'
|
|
|
|
'netboot/ubuntu-installer/arm64/initrd.gz')
|
|
|
|
initrd_hash = 'd385d3e88d53e2004c5d43cbe668b458a094f772'
|
|
|
|
initrd_path = self.fetch_asset(initrd_url, asset_hash=initrd_hash)
|
|
|
|
|
|
|
|
self.vm.set_console()
|
|
|
|
self.vm.add_args('-m', '2G',
|
|
|
|
'-kernel', kernel_path,
|
|
|
|
'-initrd', initrd_path)
|
|
|
|
self.vm.launch()
|
|
|
|
self.wait_for_console_pattern('Checked W+X mappings: passed')
|
|
|
|
|
2019-03-12 18:18:22 +01:00
|
|
|
def test_arm_virt(self):
|
|
|
|
"""
|
|
|
|
:avocado: tags=arch:arm
|
|
|
|
:avocado: tags=machine:virt
|
|
|
|
"""
|
2019-09-04 02:52:18 +02:00
|
|
|
kernel_url = ('https://archives.fedoraproject.org/pub/archive/fedora'
|
|
|
|
'/linux/releases/29/Everything/armhfp/os/images/pxeboot'
|
|
|
|
'/vmlinuz')
|
2019-03-12 18:18:22 +01:00
|
|
|
kernel_hash = 'e9826d741b4fb04cadba8d4824d1ed3b7fb8b4d4'
|
|
|
|
kernel_path = self.fetch_asset(kernel_url, asset_hash=kernel_hash)
|
|
|
|
|
|
|
|
self.vm.set_console()
|
|
|
|
kernel_command_line = (self.KERNEL_COMMON_COMMAND_LINE +
|
|
|
|
'console=ttyAMA0')
|
|
|
|
self.vm.add_args('-kernel', kernel_path,
|
|
|
|
'-append', kernel_command_line)
|
|
|
|
self.vm.launch()
|
|
|
|
console_pattern = 'Kernel command line: %s' % kernel_command_line
|
|
|
|
self.wait_for_console_pattern(console_pattern)
|
2019-03-12 18:18:23 +01:00
|
|
|
|
2019-05-21 00:06:35 +02:00
|
|
|
def test_arm_emcraft_sf2(self):
|
|
|
|
"""
|
|
|
|
:avocado: tags=arch:arm
|
2019-11-04 16:13:18 +01:00
|
|
|
:avocado: tags=machine:emcraft-sf2
|
2019-05-21 00:06:35 +02:00
|
|
|
:avocado: tags=endian:little
|
2020-01-21 00:51:59 +01:00
|
|
|
:avocado: tags=u-boot
|
2019-05-21 00:06:35 +02:00
|
|
|
"""
|
|
|
|
uboot_url = ('https://raw.githubusercontent.com/'
|
|
|
|
'Subbaraya-Sundeep/qemu-test-binaries/'
|
2020-04-16 16:54:51 +02:00
|
|
|
'fe371d32e50ca682391e1e70ab98c2942aeffb01/u-boot')
|
|
|
|
uboot_hash = 'cbb8cbab970f594bf6523b9855be209c08374ae2'
|
2019-05-21 00:06:35 +02:00
|
|
|
uboot_path = self.fetch_asset(uboot_url, asset_hash=uboot_hash)
|
|
|
|
spi_url = ('https://raw.githubusercontent.com/'
|
|
|
|
'Subbaraya-Sundeep/qemu-test-binaries/'
|
2020-04-16 16:54:51 +02:00
|
|
|
'fe371d32e50ca682391e1e70ab98c2942aeffb01/spi.bin')
|
|
|
|
spi_hash = '65523a1835949b6f4553be96dec1b6a38fb05501'
|
2019-05-21 00:06:35 +02:00
|
|
|
spi_path = self.fetch_asset(spi_url, asset_hash=spi_hash)
|
|
|
|
|
|
|
|
self.vm.set_console()
|
|
|
|
kernel_command_line = self.KERNEL_COMMON_COMMAND_LINE
|
|
|
|
self.vm.add_args('-kernel', uboot_path,
|
|
|
|
'-append', kernel_command_line,
|
|
|
|
'-drive', 'file=' + spi_path + ',if=mtd,format=raw',
|
|
|
|
'-no-reboot')
|
|
|
|
self.vm.launch()
|
2020-04-16 16:54:51 +02:00
|
|
|
self.wait_for_console_pattern('Enter \'help\' for a list')
|
|
|
|
|
|
|
|
exec_command_and_wait_for_pattern(self, 'ifconfig eth0 10.0.2.15',
|
|
|
|
'eth0: link becomes ready')
|
|
|
|
exec_command_and_wait_for_pattern(self, 'ping -c 3 10.0.2.2',
|
|
|
|
'3 packets transmitted, 3 packets received, 0% packet loss')
|
2019-05-21 00:06:35 +02:00
|
|
|
|
2019-10-29 00:04:04 +01:00
|
|
|
def do_test_arm_raspi2(self, uart_id):
|
|
|
|
"""
|
|
|
|
The kernel can be rebuilt using the kernel source referenced
|
|
|
|
and following the instructions on the on:
|
|
|
|
https://www.raspberrypi.org/documentation/linux/kernel/building.md
|
|
|
|
"""
|
|
|
|
serial_kernel_cmdline = {
|
|
|
|
0: 'earlycon=pl011,0x3f201000 console=ttyAMA0',
|
|
|
|
}
|
|
|
|
deb_url = ('http://archive.raspberrypi.org/debian/'
|
|
|
|
'pool/main/r/raspberrypi-firmware/'
|
|
|
|
'raspberrypi-kernel_1.20190215-1_armhf.deb')
|
|
|
|
deb_hash = 'cd284220b32128c5084037553db3c482426f3972'
|
|
|
|
deb_path = self.fetch_asset(deb_url, asset_hash=deb_hash)
|
|
|
|
kernel_path = self.extract_from_deb(deb_path, '/boot/kernel7.img')
|
|
|
|
dtb_path = self.extract_from_deb(deb_path, '/boot/bcm2709-rpi-2-b.dtb')
|
|
|
|
|
|
|
|
self.vm.set_console()
|
|
|
|
kernel_command_line = (self.KERNEL_COMMON_COMMAND_LINE +
|
2020-05-21 01:53:49 +02:00
|
|
|
serial_kernel_cmdline[uart_id] +
|
|
|
|
' root=/dev/mmcblk0p2 rootwait ' +
|
|
|
|
'dwc_otg.fiq_fsm_enable=0')
|
2019-10-29 00:04:04 +01:00
|
|
|
self.vm.add_args('-kernel', kernel_path,
|
|
|
|
'-dtb', dtb_path,
|
2020-05-21 01:53:49 +02:00
|
|
|
'-append', kernel_command_line,
|
|
|
|
'-device', 'usb-kbd')
|
2019-10-29 00:04:04 +01:00
|
|
|
self.vm.launch()
|
|
|
|
console_pattern = 'Kernel command line: %s' % kernel_command_line
|
|
|
|
self.wait_for_console_pattern(console_pattern)
|
2020-05-21 01:53:49 +02:00
|
|
|
console_pattern = 'Product: QEMU USB Keyboard'
|
|
|
|
self.wait_for_console_pattern(console_pattern)
|
2019-10-29 00:04:04 +01:00
|
|
|
|
|
|
|
def test_arm_raspi2_uart0(self):
|
|
|
|
"""
|
|
|
|
:avocado: tags=arch:arm
|
|
|
|
:avocado: tags=machine:raspi2
|
|
|
|
:avocado: tags=device:pl011
|
|
|
|
"""
|
|
|
|
self.do_test_arm_raspi2(0)
|
|
|
|
|
tests/boot_linux_console: Add initrd test for the Exynos4210
This test boots a Linux kernel on a smdkc210 board and verify
the serial output is working.
The cpio image used comes from the linux-build-test project:
https://github.com/groeck/linux-build-test
If ARM is a target being built, "make check-acceptance" will
automatically include this test by the use of the "arch:arm" tags.
This test can be run using:
$ IGNORE_AVOCADO_CONSOLE_BUG=yes \
avocado --show=app,console run -t machine:smdkc210 \
tests/acceptance/boot_linux_console.py
console: Booting Linux on physical CPU 0x900
console: Linux version 4.19.0-6-armmp (debian-kernel@lists.debian.org) (gcc version 8.3.0 (Debian 8.3.0-6)) #1 SMP Debian 4.19.67-2+deb10u1 (2019-09-20)
console: CPU: ARMv7 Processor [410fc090] revision 0 (ARMv7), cr=10c5387d
console: CPU: PIPT / VIPT nonaliasing data cache, VIPT nonaliasing instruction cache
console: OF: fdt: Machine model: Samsung smdkv310 evaluation board based on Exynos4210
[...]
console: Samsung CPU ID: 0x43210211
console: random: get_random_bytes called from start_kernel+0xa0/0x504 with crng_init=0
console: percpu: Embedded 17 pages/cpu s39756 r8192 d21684 u69632
console: Built 1 zonelists, mobility grouping on. Total pages: 249152
console: Kernel command line: printk.time=0 console=ttySAC0,115200n8 earlyprintk random.trust_cpu=off cryptomgr.notests cpuidle.off=1 panic=-1 noreboot
[...]
console: L2C: platform modifies aux control register: 0x02020000 -> 0x3e420001
console: L2C: platform provided aux values permit register corruption.
console: L2C: DT/platform modifies aux control register: 0x02020000 -> 0x3e420001
console: L2C-310 erratum 769419 enabled
console: L2C-310 enabling early BRESP for Cortex-A9
console: L2C-310: enabling full line of zeros but not enabled in Cortex-A9
console: L2C-310 ID prefetch enabled, offset 1 lines
console: L2C-310 dynamic clock gating disabled, standby mode disabled
console: L2C-310 cache controller enabled, 8 ways, 128 kB
console: L2C-310: CACHE_ID 0x410000c8, AUX_CTRL 0x7e420001
console: Exynos4210 clocks: sclk_apll = 12000000, sclk_mpll = 12000000
console: sclk_epll = 12000000, sclk_vpll = 12000000, arm_clk = 12000000
[...]
console: s3c-i2c 13860000.i2c: slave address 0x00
console: s3c-i2c 13860000.i2c: bus frequency set to 93 KHz
console: s3c-i2c 13860000.i2c: i2c-0: S3C I2C adapter
[...]
console: dma-pl330 12680000.pdma: Loaded driver for PL330 DMAC-241330
console: dma-pl330 12680000.pdma: DBUFF-256x8bytes Num_Chans-8 Num_Peri-32 Num_Events-16
console: dma-pl330 12690000.pdma: Loaded driver for PL330 DMAC-241330
console: dma-pl330 12690000.pdma: DBUFF-256x8bytes Num_Chans-8 Num_Peri-32 Num_Events-16
console: dma-pl330 12850000.mdma: Loaded driver for PL330 DMAC-241330
console: dma-pl330 12850000.mdma: DBUFF-256x8bytes Num_Chans-8 Num_Peri-1 Num_Events-16
console: dma-pl330 12850000.mdma: PM domain LCD0 will not be powered off
console: Serial: 8250/16550 driver, 4 ports, IRQ sharing disabled
console: Serial: AMBA driver
console: 13800000.serial: ttySAC0 at MMIO 0x13800000 (irq = 40, base_baud = 0) is a S3C6400/10
console: console [ttySAC0] enabled
console: 13810000.serial: ttySAC1 at MMIO 0x13810000 (irq = 41, base_baud = 0) is a S3C6400/10
console: 13820000.serial: ttySAC2 at MMIO 0x13820000 (irq = 42, base_baud = 0) is a S3C6400/10
console: 13830000.serial: ttySAC3 at MMIO 0x13830000 (irq = 43, base_baud = 0) is a S3C6400/10
[...]
console: Freeing unused kernel memory: 2048K
console: Run /init as init process
console: mount: mounting devtmpfs on /dev failed: Device or resource busy
console: Starting logging: OK
console: Initializing random number generator... random: dd: uninitialized urandom read (512 bytes read)
console: done.
console: Starting network: OK
console: Found console ttySAC0
console: Linux version 4.19.0-6-armmp (debian-kernel@lists.debian.org) (gcc version 8.3.0 (Debian 8.3.0-6)) #1 SMP Debian 4.19.67-2+deb10u1 (2019-09-20)
console: Boot successful.
PASS (37.98 s)
Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Message-Id: <20191028073441.6448-25-philmd@redhat.com>
Reviewed-by: Cleber Rosa <crosa@redhat.com>
Tested-by: Cleber Rosa <crosa@redhat.com>
[Cleber: removed conditional to skip test]
Signed-off-by: Cleber Rosa <crosa@redhat.com>
2019-10-29 00:04:04 +01:00
|
|
|
def test_arm_exynos4210_initrd(self):
|
|
|
|
"""
|
|
|
|
:avocado: tags=arch:arm
|
|
|
|
:avocado: tags=machine:smdkc210
|
|
|
|
"""
|
|
|
|
deb_url = ('https://snapshot.debian.org/archive/debian/'
|
|
|
|
'20190928T224601Z/pool/main/l/linux/'
|
|
|
|
'linux-image-4.19.0-6-armmp_4.19.67-2+deb10u1_armhf.deb')
|
|
|
|
deb_hash = 'fa9df4a0d38936cb50084838f2cb933f570d7d82'
|
|
|
|
deb_path = self.fetch_asset(deb_url, asset_hash=deb_hash)
|
|
|
|
kernel_path = self.extract_from_deb(deb_path,
|
|
|
|
'/boot/vmlinuz-4.19.0-6-armmp')
|
|
|
|
dtb_path = '/usr/lib/linux-image-4.19.0-6-armmp/exynos4210-smdkv310.dtb'
|
|
|
|
dtb_path = self.extract_from_deb(deb_path, dtb_path)
|
|
|
|
|
|
|
|
initrd_url = ('https://github.com/groeck/linux-build-test/raw/'
|
|
|
|
'2eb0a73b5d5a28df3170c546ddaaa9757e1e0848/rootfs/'
|
|
|
|
'arm/rootfs-armv5.cpio.gz')
|
|
|
|
initrd_hash = '2b50f1873e113523967806f4da2afe385462ff9b'
|
|
|
|
initrd_path_gz = self.fetch_asset(initrd_url, asset_hash=initrd_hash)
|
|
|
|
initrd_path = os.path.join(self.workdir, 'rootfs.cpio')
|
|
|
|
archive.gzip_uncompress(initrd_path_gz, initrd_path)
|
|
|
|
|
|
|
|
self.vm.set_console()
|
|
|
|
kernel_command_line = (self.KERNEL_COMMON_COMMAND_LINE +
|
|
|
|
'earlycon=exynos4210,0x13800000 earlyprintk ' +
|
|
|
|
'console=ttySAC0,115200n8 ' +
|
|
|
|
'random.trust_cpu=off cryptomgr.notests ' +
|
|
|
|
'cpuidle.off=1 panic=-1 noreboot')
|
|
|
|
|
|
|
|
self.vm.add_args('-kernel', kernel_path,
|
|
|
|
'-dtb', dtb_path,
|
|
|
|
'-initrd', initrd_path,
|
|
|
|
'-append', kernel_command_line,
|
|
|
|
'-no-reboot')
|
|
|
|
self.vm.launch()
|
|
|
|
|
|
|
|
self.wait_for_console_pattern('Boot successful.')
|
|
|
|
# TODO user command, for now the uart is stuck
|
|
|
|
|
2020-01-17 15:09:29 +01:00
|
|
|
def test_arm_cubieboard_initrd(self):
|
|
|
|
"""
|
|
|
|
:avocado: tags=arch:arm
|
|
|
|
:avocado: tags=machine:cubieboard
|
|
|
|
"""
|
|
|
|
deb_url = ('https://apt.armbian.com/pool/main/l/'
|
|
|
|
'linux-4.20.7-sunxi/linux-image-dev-sunxi_5.75_armhf.deb')
|
|
|
|
deb_hash = '1334c29c44d984ffa05ed10de8c3361f33d78315'
|
|
|
|
deb_path = self.fetch_asset(deb_url, asset_hash=deb_hash)
|
|
|
|
kernel_path = self.extract_from_deb(deb_path,
|
|
|
|
'/boot/vmlinuz-4.20.7-sunxi')
|
|
|
|
dtb_path = '/usr/lib/linux-image-dev-sunxi/sun4i-a10-cubieboard.dtb'
|
|
|
|
dtb_path = self.extract_from_deb(deb_path, dtb_path)
|
|
|
|
initrd_url = ('https://github.com/groeck/linux-build-test/raw/'
|
|
|
|
'2eb0a73b5d5a28df3170c546ddaaa9757e1e0848/rootfs/'
|
|
|
|
'arm/rootfs-armv5.cpio.gz')
|
|
|
|
initrd_hash = '2b50f1873e113523967806f4da2afe385462ff9b'
|
|
|
|
initrd_path_gz = self.fetch_asset(initrd_url, asset_hash=initrd_hash)
|
|
|
|
initrd_path = os.path.join(self.workdir, 'rootfs.cpio')
|
|
|
|
archive.gzip_uncompress(initrd_path_gz, initrd_path)
|
|
|
|
|
|
|
|
self.vm.set_console()
|
|
|
|
kernel_command_line = (self.KERNEL_COMMON_COMMAND_LINE +
|
|
|
|
'console=ttyS0,115200 '
|
|
|
|
'usbcore.nousb '
|
|
|
|
'panic=-1 noreboot')
|
|
|
|
self.vm.add_args('-kernel', kernel_path,
|
|
|
|
'-dtb', dtb_path,
|
|
|
|
'-initrd', initrd_path,
|
|
|
|
'-append', kernel_command_line,
|
|
|
|
'-no-reboot')
|
|
|
|
self.vm.launch()
|
|
|
|
self.wait_for_console_pattern('Boot successful.')
|
|
|
|
|
|
|
|
exec_command_and_wait_for_pattern(self, 'cat /proc/cpuinfo',
|
|
|
|
'Allwinner sun4i/sun5i')
|
|
|
|
exec_command_and_wait_for_pattern(self, 'cat /proc/iomem',
|
|
|
|
'system-control@1c00000')
|
|
|
|
exec_command_and_wait_for_pattern(self, 'reboot',
|
|
|
|
'reboot: Restarting system')
|
|
|
|
|
2020-01-17 15:09:30 +01:00
|
|
|
def test_arm_cubieboard_sata(self):
|
|
|
|
"""
|
|
|
|
:avocado: tags=arch:arm
|
|
|
|
:avocado: tags=machine:cubieboard
|
|
|
|
"""
|
|
|
|
deb_url = ('https://apt.armbian.com/pool/main/l/'
|
|
|
|
'linux-4.20.7-sunxi/linux-image-dev-sunxi_5.75_armhf.deb')
|
|
|
|
deb_hash = '1334c29c44d984ffa05ed10de8c3361f33d78315'
|
|
|
|
deb_path = self.fetch_asset(deb_url, asset_hash=deb_hash)
|
|
|
|
kernel_path = self.extract_from_deb(deb_path,
|
|
|
|
'/boot/vmlinuz-4.20.7-sunxi')
|
|
|
|
dtb_path = '/usr/lib/linux-image-dev-sunxi/sun4i-a10-cubieboard.dtb'
|
|
|
|
dtb_path = self.extract_from_deb(deb_path, dtb_path)
|
|
|
|
rootfs_url = ('https://github.com/groeck/linux-build-test/raw/'
|
|
|
|
'2eb0a73b5d5a28df3170c546ddaaa9757e1e0848/rootfs/'
|
|
|
|
'arm/rootfs-armv5.ext2.gz')
|
|
|
|
rootfs_hash = '093e89d2b4d982234bf528bc9fb2f2f17a9d1f93'
|
|
|
|
rootfs_path_gz = self.fetch_asset(rootfs_url, asset_hash=rootfs_hash)
|
|
|
|
rootfs_path = os.path.join(self.workdir, 'rootfs.cpio')
|
|
|
|
archive.gzip_uncompress(rootfs_path_gz, rootfs_path)
|
|
|
|
|
|
|
|
self.vm.set_console()
|
|
|
|
kernel_command_line = (self.KERNEL_COMMON_COMMAND_LINE +
|
|
|
|
'console=ttyS0,115200 '
|
|
|
|
'usbcore.nousb '
|
|
|
|
'root=/dev/sda ro '
|
|
|
|
'panic=-1 noreboot')
|
|
|
|
self.vm.add_args('-kernel', kernel_path,
|
|
|
|
'-dtb', dtb_path,
|
|
|
|
'-drive', 'if=none,format=raw,id=disk0,file='
|
|
|
|
+ rootfs_path,
|
|
|
|
'-device', 'ide-hd,bus=ide.0,drive=disk0',
|
|
|
|
'-append', kernel_command_line,
|
|
|
|
'-no-reboot')
|
|
|
|
self.vm.launch()
|
|
|
|
self.wait_for_console_pattern('Boot successful.')
|
|
|
|
|
|
|
|
exec_command_and_wait_for_pattern(self, 'cat /proc/cpuinfo',
|
|
|
|
'Allwinner sun4i/sun5i')
|
|
|
|
exec_command_and_wait_for_pattern(self, 'cat /proc/partitions',
|
|
|
|
'sda')
|
|
|
|
exec_command_and_wait_for_pattern(self, 'reboot',
|
|
|
|
'reboot: Restarting system')
|
|
|
|
|
2020-03-11 23:18:49 +01:00
|
|
|
def test_arm_orangepi(self):
|
|
|
|
"""
|
|
|
|
:avocado: tags=arch:arm
|
|
|
|
:avocado: tags=machine:orangepi-pc
|
|
|
|
"""
|
|
|
|
deb_url = ('https://apt.armbian.com/pool/main/l/'
|
|
|
|
'linux-4.20.7-sunxi/linux-image-dev-sunxi_5.75_armhf.deb')
|
|
|
|
deb_hash = '1334c29c44d984ffa05ed10de8c3361f33d78315'
|
|
|
|
deb_path = self.fetch_asset(deb_url, asset_hash=deb_hash)
|
|
|
|
kernel_path = self.extract_from_deb(deb_path,
|
|
|
|
'/boot/vmlinuz-4.20.7-sunxi')
|
|
|
|
dtb_path = '/usr/lib/linux-image-dev-sunxi/sun8i-h3-orangepi-pc.dtb'
|
|
|
|
dtb_path = self.extract_from_deb(deb_path, dtb_path)
|
|
|
|
|
|
|
|
self.vm.set_console()
|
|
|
|
kernel_command_line = (self.KERNEL_COMMON_COMMAND_LINE +
|
|
|
|
'console=ttyS0,115200n8 '
|
|
|
|
'earlycon=uart,mmio32,0x1c28000')
|
|
|
|
self.vm.add_args('-kernel', kernel_path,
|
|
|
|
'-dtb', dtb_path,
|
|
|
|
'-append', kernel_command_line)
|
|
|
|
self.vm.launch()
|
|
|
|
console_pattern = 'Kernel command line: %s' % kernel_command_line
|
|
|
|
self.wait_for_console_pattern(console_pattern)
|
|
|
|
|
2020-03-11 23:18:50 +01:00
|
|
|
def test_arm_orangepi_initrd(self):
|
|
|
|
"""
|
|
|
|
:avocado: tags=arch:arm
|
|
|
|
:avocado: tags=machine:orangepi-pc
|
|
|
|
"""
|
|
|
|
deb_url = ('https://apt.armbian.com/pool/main/l/'
|
|
|
|
'linux-4.20.7-sunxi/linux-image-dev-sunxi_5.75_armhf.deb')
|
|
|
|
deb_hash = '1334c29c44d984ffa05ed10de8c3361f33d78315'
|
|
|
|
deb_path = self.fetch_asset(deb_url, asset_hash=deb_hash)
|
|
|
|
kernel_path = self.extract_from_deb(deb_path,
|
|
|
|
'/boot/vmlinuz-4.20.7-sunxi')
|
|
|
|
dtb_path = '/usr/lib/linux-image-dev-sunxi/sun8i-h3-orangepi-pc.dtb'
|
|
|
|
dtb_path = self.extract_from_deb(deb_path, dtb_path)
|
|
|
|
initrd_url = ('https://github.com/groeck/linux-build-test/raw/'
|
|
|
|
'2eb0a73b5d5a28df3170c546ddaaa9757e1e0848/rootfs/'
|
|
|
|
'arm/rootfs-armv7a.cpio.gz')
|
|
|
|
initrd_hash = '604b2e45cdf35045846b8bbfbf2129b1891bdc9c'
|
|
|
|
initrd_path_gz = self.fetch_asset(initrd_url, asset_hash=initrd_hash)
|
|
|
|
initrd_path = os.path.join(self.workdir, 'rootfs.cpio')
|
|
|
|
archive.gzip_uncompress(initrd_path_gz, initrd_path)
|
|
|
|
|
|
|
|
self.vm.set_console()
|
|
|
|
kernel_command_line = (self.KERNEL_COMMON_COMMAND_LINE +
|
|
|
|
'console=ttyS0,115200 '
|
|
|
|
'panic=-1 noreboot')
|
|
|
|
self.vm.add_args('-kernel', kernel_path,
|
|
|
|
'-dtb', dtb_path,
|
|
|
|
'-initrd', initrd_path,
|
|
|
|
'-append', kernel_command_line,
|
|
|
|
'-no-reboot')
|
|
|
|
self.vm.launch()
|
|
|
|
self.wait_for_console_pattern('Boot successful.')
|
|
|
|
|
|
|
|
exec_command_and_wait_for_pattern(self, 'cat /proc/cpuinfo',
|
|
|
|
'Allwinner sun8i Family')
|
|
|
|
exec_command_and_wait_for_pattern(self, 'cat /proc/iomem',
|
|
|
|
'system-control@1c00000')
|
|
|
|
exec_command_and_wait_for_pattern(self, 'reboot',
|
|
|
|
'reboot: Restarting system')
|
tests/boot_linux_console: Add a SD card test for the OrangePi PC board
The kernel image and DeviceTree blob are built by the Armbian
project (based on Debian):
https://www.armbian.com/orange-pi-pc/
The SD image is from the kernelci.org project:
https://kernelci.org/faq/#the-code
If ARM is a target being built, "make check-acceptance" will
automatically include this test by the use of the "arch:arm" tags.
Alternatively, this test can be run using:
$ avocado --show=console run -t machine:orangepi-pc tests/acceptance/boot_linux_console.py
console: Uncompressing Linux... done, booting the kernel.
console: Booting Linux on physical CPU 0x0
console: Linux version 4.20.7-sunxi (root@armbian.com) (gcc version 7.2.1 20171011 (Linaro GCC 7.2-2017.11)) #5.75 SMP Fri Feb 8 09:02:10 CET 2019
console: CPU: ARMv7 Processor [410fc075] revision 5 (ARMv7), cr=50c5387d
[...]
console: sunxi-wdt 1c20ca0.watchdog: Watchdog enabled (timeout=16 sec, nowayout=0)
console: sunxi-mmc 1c0f000.mmc: Linked as a consumer to regulator.2
console: sunxi-mmc 1c0f000.mmc: Got CD GPIO
console: ledtrig-cpu: registered to indicate activity on CPUs
console: hidraw: raw HID events driver (C) Jiri Kosina
console: usbcore: registered new interface driver usbhid
console: usbhid: USB HID core driver
console: Initializing XFRM netlink socket
console: sunxi-mmc 1c0f000.mmc: initialized, max. request size: 16384 KB
console: NET: Registered protocol family 10
console: mmc0: host does not support reading read-only switch, assuming write-enable
console: mmc0: Problem switching card into high-speed mode!
console: mmc0: new SD card at address 4567
console: mmcblk0: mmc0:4567 QEMU! 60.0 MiB
[...]
console: EXT4-fs (mmcblk0): mounting ext2 file system using the ext4 subsystem
console: EXT4-fs (mmcblk0): mounted filesystem without journal. Opts: (null)
console: VFS: Mounted root (ext2 filesystem) on device 179:0.
console: Run /sbin/init as init process
console: EXT4-fs (mmcblk0): re-mounted. Opts: block_validity,barrier,user_xattr,acl
console: Starting syslogd: OK
console: Starting klogd: OK
console: Populating /dev using udev: udevd[203]: starting version 3.2.7
console: /bin/sh: can't access tty; job control turned off
console: cat /proc/partitions
console: / # cat /proc/partitions
console: major minor #blocks name
console: 1 0 4096 ram0
console: 1 1 4096 ram1
console: 1 2 4096 ram2
console: 1 3 4096 ram3
console: 179 0 61440 mmcblk0
console: reboot
console: / # reboot
console: umount: devtmpfs busy - remounted read-only
console: EXT4-fs (mmcblk0): re-mounted. Opts: (null)
console: The system is going down NOW!
console: Sent SIGTERM to all processes
console: Sent SIGKILL to all processes
console: Requesting system reboot
console: reboot: Restarting system
JOB TIME : 68.64 s
Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Signed-off-by: Niek Linnenbank <nieklinnenbank@gmail.com>
Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
Tested-by: Alex Bennée <alex.bennee@linaro.org>
Message-id: 20200311221854.30370-16-nieklinnenbank@gmail.com
[NL: rename in commit message Raspbian to Armbian, remove vm.set_machine()]
[NL: extend test with ethernet device checks]
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2020-03-11 23:18:51 +01:00
|
|
|
|
|
|
|
def test_arm_orangepi_sd(self):
|
|
|
|
"""
|
|
|
|
:avocado: tags=arch:arm
|
|
|
|
:avocado: tags=machine:orangepi-pc
|
|
|
|
"""
|
|
|
|
deb_url = ('https://apt.armbian.com/pool/main/l/'
|
|
|
|
'linux-4.20.7-sunxi/linux-image-dev-sunxi_5.75_armhf.deb')
|
|
|
|
deb_hash = '1334c29c44d984ffa05ed10de8c3361f33d78315'
|
|
|
|
deb_path = self.fetch_asset(deb_url, asset_hash=deb_hash)
|
|
|
|
kernel_path = self.extract_from_deb(deb_path,
|
|
|
|
'/boot/vmlinuz-4.20.7-sunxi')
|
|
|
|
dtb_path = '/usr/lib/linux-image-dev-sunxi/sun8i-h3-orangepi-pc.dtb'
|
|
|
|
dtb_path = self.extract_from_deb(deb_path, dtb_path)
|
|
|
|
rootfs_url = ('http://storage.kernelci.org/images/rootfs/buildroot/'
|
|
|
|
'kci-2019.02/armel/base/rootfs.ext2.xz')
|
|
|
|
rootfs_hash = '692510cb625efda31640d1de0a8d60e26040f061'
|
|
|
|
rootfs_path_xz = self.fetch_asset(rootfs_url, asset_hash=rootfs_hash)
|
|
|
|
rootfs_path = os.path.join(self.workdir, 'rootfs.cpio')
|
|
|
|
archive.lzma_uncompress(rootfs_path_xz, rootfs_path)
|
|
|
|
|
|
|
|
self.vm.set_console()
|
|
|
|
kernel_command_line = (self.KERNEL_COMMON_COMMAND_LINE +
|
|
|
|
'console=ttyS0,115200 '
|
|
|
|
'root=/dev/mmcblk0 rootwait rw '
|
|
|
|
'panic=-1 noreboot')
|
|
|
|
self.vm.add_args('-kernel', kernel_path,
|
|
|
|
'-dtb', dtb_path,
|
|
|
|
'-drive', 'file=' + rootfs_path + ',if=sd,format=raw',
|
|
|
|
'-append', kernel_command_line,
|
|
|
|
'-no-reboot')
|
|
|
|
self.vm.launch()
|
|
|
|
shell_ready = "/bin/sh: can't access tty; job control turned off"
|
|
|
|
self.wait_for_console_pattern(shell_ready)
|
|
|
|
|
|
|
|
exec_command_and_wait_for_pattern(self, 'cat /proc/cpuinfo',
|
|
|
|
'Allwinner sun8i Family')
|
|
|
|
exec_command_and_wait_for_pattern(self, 'cat /proc/partitions',
|
|
|
|
'mmcblk0')
|
|
|
|
exec_command_and_wait_for_pattern(self, 'ifconfig eth0 up',
|
|
|
|
'eth0: Link is Up')
|
|
|
|
exec_command_and_wait_for_pattern(self, 'udhcpc eth0',
|
|
|
|
'udhcpc: lease of 10.0.2.15 obtained')
|
|
|
|
exec_command_and_wait_for_pattern(self, 'ping -c 3 10.0.2.2',
|
|
|
|
'3 packets transmitted, 3 packets received, 0% packet loss')
|
|
|
|
exec_command_and_wait_for_pattern(self, 'reboot',
|
|
|
|
'reboot: Restarting system')
|
2020-03-11 23:18:50 +01:00
|
|
|
|
2020-03-11 23:18:52 +01:00
|
|
|
@skipUnless(os.getenv('AVOCADO_ALLOW_LARGE_STORAGE'), 'storage limited')
|
|
|
|
@skipUnless(P7ZIP_AVAILABLE, '7z not installed')
|
|
|
|
def test_arm_orangepi_bionic(self):
|
|
|
|
"""
|
|
|
|
:avocado: tags=arch:arm
|
|
|
|
:avocado: tags=machine:orangepi-pc
|
|
|
|
"""
|
|
|
|
|
|
|
|
# This test download a 196MB compressed image and expand it to 932MB...
|
|
|
|
image_url = ('https://dl.armbian.com/orangepipc/archive/'
|
|
|
|
'Armbian_19.11.3_Orangepipc_bionic_current_5.3.9.7z')
|
|
|
|
image_hash = '196a8ffb72b0123d92cea4a070894813d305c71e'
|
|
|
|
image_path_7z = self.fetch_asset(image_url, asset_hash=image_hash)
|
|
|
|
image_name = 'Armbian_19.11.3_Orangepipc_bionic_current_5.3.9.img'
|
|
|
|
image_path = os.path.join(self.workdir, image_name)
|
|
|
|
process.run("7z e -o%s %s" % (self.workdir, image_path_7z))
|
|
|
|
|
|
|
|
self.vm.set_console()
|
|
|
|
self.vm.add_args('-drive', 'file=' + image_path + ',if=sd,format=raw',
|
|
|
|
'-nic', 'user',
|
|
|
|
'-no-reboot')
|
|
|
|
self.vm.launch()
|
|
|
|
|
|
|
|
kernel_command_line = (self.KERNEL_COMMON_COMMAND_LINE +
|
|
|
|
'console=ttyS0,115200 '
|
|
|
|
'loglevel=7 '
|
|
|
|
'nosmp '
|
|
|
|
'systemd.default_timeout_start_sec=9000 '
|
|
|
|
'systemd.mask=armbian-zram-config.service '
|
|
|
|
'systemd.mask=armbian-ramlog.service')
|
|
|
|
|
|
|
|
self.wait_for_console_pattern('U-Boot SPL')
|
|
|
|
self.wait_for_console_pattern('Autoboot in ')
|
|
|
|
exec_command_and_wait_for_pattern(self, ' ', '=>')
|
|
|
|
exec_command_and_wait_for_pattern(self, "setenv extraargs '" +
|
|
|
|
kernel_command_line + "'", '=>')
|
|
|
|
exec_command_and_wait_for_pattern(self, 'boot', 'Starting kernel ...');
|
|
|
|
|
|
|
|
self.wait_for_console_pattern('systemd[1]: Set hostname ' +
|
|
|
|
'to <orangepipc>')
|
|
|
|
self.wait_for_console_pattern('Starting Load Kernel Modules...')
|
|
|
|
|
tests/boot_linux_console: Test booting NetBSD via U-Boot on OrangePi PC
This test boots U-Boot then NetBSD (stored on a SD card) on
a OrangePi PC board.
As it requires ~1.3GB of storage, it is disabled by default.
U-Boot is built by the Debian project [1], and the SD card image
is provided by the NetBSD organization [2].
Once the compressed SD card image is downloaded (304MB) and
extracted, this test is fast:
$ AVOCADO_ALLOW_LARGE_STORAGE=yes \
avocado --show=app,console run -t machine:orangepi-pc \
tests/acceptance/boot_linux_console.py
console: U-Boot SPL 2020.01+dfsg-1 (Jan 08 2020 - 08:19:44 +0000)
console: DRAM: 1024 MiB
console: U-Boot 2020.01+dfsg-1 (Jan 08 2020 - 08:19:44 +0000) Allwinner Technology
console: CPU: Allwinner H3 (SUN8I 0000)
console: scanning bus usb@1c1b000 for devices... 1 USB Device(s) found
console: scanning bus usb@1c1d000 for devices... 1 USB Device(s) found
console: scanning usb for storage devices... 0 Storage Device(s) found
console: Hit any key to stop autoboot: 0
console: => setenv bootargs root=ld0a
console: => setenv kernel netbsd-GENERIC.ub
console: => setenv fdtfile dtb/sun8i-h3-orangepi-pc.dtb
console: => boot
console: ## Booting kernel from Legacy Image at 42000000 ...
console: Image Name: NetBSD/earmv7hf 9.0_RC1
console: Image Type: ARM Linux Kernel Image (no loading done) (uncompressed)
console: XIP Kernel Image (no loading done)
console: Loading Device Tree to 49ff6000, end 49fffe01 ... OK
console: Starting kernel ...
console: [ 1.0000000] NetBSD/evbarm (fdt) booting ...
console: [ 1.0000000] NetBSD 9.0 (GENERIC) #0: Fri Feb 14 00:06:28 UTC 2020
console: [ 1.0000000] mkrepro@mkrepro.NetBSD.org:/usr/src/sys/arch/evbarm/compile/GENERIC
console: [ 1.0000000] total memory = 1024 MB
console: [ 1.0000000] avail memory = 1003 MB
console: [ 1.0000000] armfdt0 (root)
console: [ 1.0000000] simplebus0 at armfdt0: Xunlong Orange Pi PC
console: [ 1.0000000] cpu0 at cpus0: Cortex-A7 r0p5 (Cortex V7A core)
console: [ 1.0000000] cpu0: DC enabled IC enabled WB enabled LABT branch prediction enabled
console: [ 1.0000000] cpu0: 32KB/64B 2-way L1 VIPT Instruction cache
console: [ 1.0000000] cpu0: 32KB/64B 2-way write-back-locking-C L1 PIPT Data cache
console: [ 1.0000000] cpu0: 2304KB/64B 16-way write-through L2 PIPT Unified cache
console: [ 1.0000000] vfp0 at cpu0: NEON MPE (VFP 3.0+), rounding, NaN propagation, denormals
...
console: [ 2.3812082] sdmmc0: SD card status: 4-bit, C0
console: [ 2.3812082] ld0 at sdmmc0: <0xaa:0x5859:QEMU!:0x01:0xdeadbeef:0x062>
console: [ 2.4012856] ld0: 1226 MB, 622 cyl, 64 head, 63 sec, 512 bytes/sect x 2511872 sectors
console: [ 2.5321222] ld0: 4-bit width, High-Speed/SDR25, 50.000 MHz
console: [ 3.1068718] WARNING: 4 errors while detecting hardware; check system log.
console: [ 3.1179868] boot device: ld0
console: [ 3.1470623] root on ld0a dumps on ld0b
console: [ 3.2464436] root file system type: ffs
console: [ 3.2897123] kern.module.path=/stand/evbarm/9.0/modules
console: Mon Feb 17 20:33:35 UTC 2020
console: Starting root file system check:
PASS (35.96 s)
RESULTS : PASS 1 | ERROR 0 | FAIL 0 | SKIP 0 | WARN 0 | INTERRUPT 0 | CANCEL 0
JOB TIME : 36.09 s
Note, this test only took ~65 seconds to run on Travis-CI, see: [3].
This test is based on a description from Niek Linnenbank from [4].
[1] https://wiki.debian.org/InstallingDebianOn/Allwinner#Creating_a_bootable_SD_Card_with_u-boot
[2] https://wiki.netbsd.org/ports/evbarm/allwinner/
[3] https://travis-ci.org/philmd/qemu/jobs/638823612#L3778
[4] https://www.mail-archive.com/qemu-devel@nongnu.org/msg669347.html
Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Signed-off-by: Niek Linnenbank <nieklinnenbank@gmail.com>
Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
Tested-by: Alex Bennée <alex.bennee@linaro.org>
Message-id: 20200311221854.30370-18-nieklinnenbank@gmail.com
[NL: changed test to use NetBSD 9.0 final release and -global allwinner-rtc.base-year]
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2020-03-11 23:18:53 +01:00
|
|
|
@skipUnless(os.getenv('AVOCADO_ALLOW_LARGE_STORAGE'), 'storage limited')
|
|
|
|
def test_arm_orangepi_uboot_netbsd9(self):
|
|
|
|
"""
|
|
|
|
:avocado: tags=arch:arm
|
|
|
|
:avocado: tags=machine:orangepi-pc
|
|
|
|
"""
|
|
|
|
# This test download a 304MB compressed image and expand it to 1.3GB...
|
|
|
|
deb_url = ('http://snapshot.debian.org/archive/debian/'
|
|
|
|
'20200108T145233Z/pool/main/u/u-boot/'
|
|
|
|
'u-boot-sunxi_2020.01%2Bdfsg-1_armhf.deb')
|
|
|
|
deb_hash = 'f67f404a80753ca3d1258f13e38f2b060e13db99'
|
|
|
|
deb_path = self.fetch_asset(deb_url, asset_hash=deb_hash)
|
|
|
|
# We use the common OrangePi PC 'plus' build of U-Boot for our secondary
|
|
|
|
# program loader (SPL). We will then set the path to the more specific
|
|
|
|
# OrangePi "PC" device tree blob with 'setenv fdtfile' in U-Boot prompt,
|
|
|
|
# before to boot NetBSD.
|
|
|
|
uboot_path = '/usr/lib/u-boot/orangepi_plus/u-boot-sunxi-with-spl.bin'
|
|
|
|
uboot_path = self.extract_from_deb(deb_path, uboot_path)
|
|
|
|
image_url = ('https://cdn.netbsd.org/pub/NetBSD/NetBSD-9.0/'
|
|
|
|
'evbarm-earmv7hf/binary/gzimg/armv7.img.gz')
|
|
|
|
image_hash = '2babb29d36d8360adcb39c09e31060945259917a'
|
|
|
|
image_path_gz = self.fetch_asset(image_url, asset_hash=image_hash)
|
|
|
|
image_path = os.path.join(self.workdir, 'armv7.img')
|
|
|
|
image_drive_args = 'if=sd,format=raw,snapshot=on,file=' + image_path
|
|
|
|
archive.gzip_uncompress(image_path_gz, image_path)
|
|
|
|
|
|
|
|
# dd if=u-boot-sunxi-with-spl.bin of=armv7.img bs=1K seek=8 conv=notrunc
|
|
|
|
with open(uboot_path, 'rb') as f_in:
|
|
|
|
with open(image_path, 'r+b') as f_out:
|
|
|
|
f_out.seek(8 * 1024)
|
|
|
|
shutil.copyfileobj(f_in, f_out)
|
|
|
|
|
|
|
|
# Extend image, to avoid that NetBSD thinks the partition
|
|
|
|
# inside the image is larger than device size itself
|
|
|
|
f_out.seek(0, 2)
|
|
|
|
f_out.seek(64 * 1024 * 1024, 1)
|
|
|
|
f_out.write(bytearray([0x00]))
|
|
|
|
|
|
|
|
self.vm.set_console()
|
|
|
|
self.vm.add_args('-nic', 'user',
|
|
|
|
'-drive', image_drive_args,
|
|
|
|
'-global', 'allwinner-rtc.base-year=2000',
|
|
|
|
'-no-reboot')
|
|
|
|
self.vm.launch()
|
|
|
|
wait_for_console_pattern(self, 'U-Boot 2020.01+dfsg-1')
|
|
|
|
interrupt_interactive_console_until_pattern(self,
|
|
|
|
'Hit any key to stop autoboot:',
|
|
|
|
'switch to partitions #0, OK')
|
|
|
|
|
|
|
|
exec_command_and_wait_for_pattern(self, '', '=>')
|
|
|
|
cmd = 'setenv bootargs root=ld0a'
|
|
|
|
exec_command_and_wait_for_pattern(self, cmd, '=>')
|
|
|
|
cmd = 'setenv kernel netbsd-GENERIC.ub'
|
|
|
|
exec_command_and_wait_for_pattern(self, cmd, '=>')
|
|
|
|
cmd = 'setenv fdtfile dtb/sun8i-h3-orangepi-pc.dtb'
|
|
|
|
exec_command_and_wait_for_pattern(self, cmd, '=>')
|
|
|
|
cmd = ("setenv bootcmd 'fatload mmc 0:1 ${kernel_addr_r} ${kernel}; "
|
|
|
|
"fatload mmc 0:1 ${fdt_addr_r} ${fdtfile}; "
|
|
|
|
"fdt addr ${fdt_addr_r}; "
|
|
|
|
"bootm ${kernel_addr_r} - ${fdt_addr_r}'")
|
|
|
|
exec_command_and_wait_for_pattern(self, cmd, '=>')
|
|
|
|
|
|
|
|
exec_command_and_wait_for_pattern(self, 'boot',
|
|
|
|
'Booting kernel from Legacy Image')
|
|
|
|
wait_for_console_pattern(self, 'Starting kernel ...')
|
|
|
|
wait_for_console_pattern(self, 'NetBSD 9.0 (GENERIC)')
|
|
|
|
# Wait for user-space
|
|
|
|
wait_for_console_pattern(self, 'Starting root file system check')
|
|
|
|
|
2019-03-12 18:18:23 +01:00
|
|
|
def test_s390x_s390_ccw_virtio(self):
|
|
|
|
"""
|
|
|
|
:avocado: tags=arch:s390x
|
2019-11-04 16:13:18 +01:00
|
|
|
:avocado: tags=machine:s390-ccw-virtio
|
2019-03-12 18:18:23 +01:00
|
|
|
"""
|
2019-09-04 02:52:18 +02:00
|
|
|
kernel_url = ('https://archives.fedoraproject.org/pub/archive'
|
|
|
|
'/fedora-secondary/releases/29/Everything/s390x/os/images'
|
|
|
|
'/kernel.img')
|
2019-03-12 18:18:23 +01:00
|
|
|
kernel_hash = 'e8e8439103ef8053418ef062644ffd46a7919313'
|
|
|
|
kernel_path = self.fetch_asset(kernel_url, asset_hash=kernel_hash)
|
|
|
|
|
|
|
|
self.vm.set_console()
|
|
|
|
kernel_command_line = self.KERNEL_COMMON_COMMAND_LINE + 'console=sclp0'
|
|
|
|
self.vm.add_args('-nodefaults',
|
|
|
|
'-kernel', kernel_path,
|
|
|
|
'-append', kernel_command_line)
|
|
|
|
self.vm.launch()
|
|
|
|
console_pattern = 'Kernel command line: %s' % kernel_command_line
|
|
|
|
self.wait_for_console_pattern(console_pattern)
|
2019-03-12 18:18:24 +01:00
|
|
|
|
|
|
|
def test_alpha_clipper(self):
|
|
|
|
"""
|
|
|
|
:avocado: tags=arch:alpha
|
|
|
|
:avocado: tags=machine:clipper
|
|
|
|
"""
|
|
|
|
kernel_url = ('http://archive.debian.org/debian/dists/lenny/main/'
|
|
|
|
'installer-alpha/current/images/cdrom/vmlinuz')
|
|
|
|
kernel_hash = '3a943149335529e2ed3e74d0d787b85fb5671ba3'
|
|
|
|
kernel_path = self.fetch_asset(kernel_url, asset_hash=kernel_hash)
|
|
|
|
|
|
|
|
uncompressed_kernel = archive.uncompress(kernel_path, self.workdir)
|
|
|
|
|
|
|
|
self.vm.set_console()
|
|
|
|
kernel_command_line = self.KERNEL_COMMON_COMMAND_LINE + 'console=ttyS0'
|
2020-01-29 22:23:42 +01:00
|
|
|
self.vm.add_args('-nodefaults',
|
2019-03-12 18:18:24 +01:00
|
|
|
'-kernel', uncompressed_kernel,
|
|
|
|
'-append', kernel_command_line)
|
|
|
|
self.vm.launch()
|
|
|
|
console_pattern = 'Kernel command line: %s' % kernel_command_line
|
|
|
|
self.wait_for_console_pattern(console_pattern)
|
2019-06-07 17:22:19 +02:00
|
|
|
|
|
|
|
def test_ppc64_pseries(self):
|
|
|
|
"""
|
|
|
|
:avocado: tags=arch:ppc64
|
|
|
|
:avocado: tags=machine:pseries
|
|
|
|
"""
|
2019-09-04 02:52:18 +02:00
|
|
|
kernel_url = ('https://archives.fedoraproject.org/pub/archive'
|
|
|
|
'/fedora-secondary/releases/29/Everything/ppc64le/os'
|
|
|
|
'/ppc/ppc64/vmlinuz')
|
2019-06-07 17:22:19 +02:00
|
|
|
kernel_hash = '3fe04abfc852b66653b8c3c897a59a689270bc77'
|
|
|
|
kernel_path = self.fetch_asset(kernel_url, asset_hash=kernel_hash)
|
|
|
|
|
|
|
|
self.vm.set_console()
|
|
|
|
kernel_command_line = self.KERNEL_COMMON_COMMAND_LINE + 'console=hvc0'
|
|
|
|
self.vm.add_args('-kernel', kernel_path,
|
|
|
|
'-append', kernel_command_line)
|
|
|
|
self.vm.launch()
|
|
|
|
console_pattern = 'Kernel command line: %s' % kernel_command_line
|
|
|
|
self.wait_for_console_pattern(console_pattern)
|
2019-10-26 18:45:46 +02:00
|
|
|
|
|
|
|
def test_m68k_q800(self):
|
|
|
|
"""
|
|
|
|
:avocado: tags=arch:m68k
|
|
|
|
:avocado: tags=machine:q800
|
|
|
|
"""
|
2019-11-26 23:38:09 +01:00
|
|
|
deb_url = ('https://snapshot.debian.org/archive/debian-ports'
|
|
|
|
'/20191021T083923Z/pool-m68k/main'
|
2019-10-30 00:23:20 +01:00
|
|
|
'/l/linux/kernel-image-5.3.0-1-m68k-di_5.3.7-1_m68k.udeb')
|
|
|
|
deb_hash = '044954bb9be4160a3ce81f8bc1b5e856b75cccd1'
|
2019-11-26 23:38:10 +01:00
|
|
|
deb_path = self.fetch_asset(deb_url, asset_hash=deb_hash)
|
2019-10-26 18:45:46 +02:00
|
|
|
kernel_path = self.extract_from_deb(deb_path,
|
2019-10-30 00:23:20 +01:00
|
|
|
'/boot/vmlinux-5.3.0-1-m68k')
|
2019-10-26 18:45:46 +02:00
|
|
|
|
|
|
|
self.vm.set_console()
|
|
|
|
kernel_command_line = (self.KERNEL_COMMON_COMMAND_LINE +
|
|
|
|
'console=ttyS0 vga=off')
|
|
|
|
self.vm.add_args('-kernel', kernel_path,
|
|
|
|
'-append', kernel_command_line)
|
|
|
|
self.vm.launch()
|
|
|
|
console_pattern = 'Kernel command line: %s' % kernel_command_line
|
|
|
|
self.wait_for_console_pattern(console_pattern)
|
|
|
|
console_pattern = 'No filesystem could mount root'
|
|
|
|
self.wait_for_console_pattern(console_pattern)
|
2020-01-24 18:03:25 +01:00
|
|
|
|
2020-02-11 09:59:41 +01:00
|
|
|
def do_test_advcal_2018(self, day, tar_hash, kernel_name, console=0):
|
2020-01-24 18:03:25 +01:00
|
|
|
tar_url = ('https://www.qemu-advent-calendar.org'
|
|
|
|
'/2018/download/day' + day + '.tar.xz')
|
|
|
|
file_path = self.fetch_asset(tar_url, asset_hash=tar_hash)
|
|
|
|
archive.extract(file_path, self.workdir)
|
2020-02-11 09:59:41 +01:00
|
|
|
self.vm.set_console(console_index=console)
|
2020-01-24 18:03:25 +01:00
|
|
|
self.vm.add_args('-kernel',
|
|
|
|
self.workdir + '/day' + day + '/' + kernel_name)
|
|
|
|
self.vm.launch()
|
|
|
|
self.wait_for_console_pattern('QEMU advent calendar')
|
|
|
|
|
|
|
|
def test_arm_vexpressa9(self):
|
|
|
|
"""
|
|
|
|
:avocado: tags=arch:arm
|
|
|
|
:avocado: tags=machine:vexpress-a9
|
|
|
|
"""
|
|
|
|
tar_hash = '32b7677ce8b6f1471fb0059865f451169934245b'
|
|
|
|
self.vm.add_args('-dtb', self.workdir + '/day16/vexpress-v2p-ca9.dtb')
|
|
|
|
self.do_test_advcal_2018('16', tar_hash, 'winter.zImage')
|
|
|
|
|
|
|
|
def test_m68k_mcf5208evb(self):
|
|
|
|
"""
|
|
|
|
:avocado: tags=arch:m68k
|
|
|
|
:avocado: tags=machine:mcf5208evb
|
|
|
|
"""
|
|
|
|
tar_hash = 'ac688fd00561a2b6ce1359f9ff6aa2b98c9a570c'
|
|
|
|
self.do_test_advcal_2018('07', tar_hash, 'sanity-clause.elf')
|
|
|
|
|
|
|
|
def test_microblaze_s3adsp1800(self):
|
|
|
|
"""
|
|
|
|
:avocado: tags=arch:microblaze
|
|
|
|
:avocado: tags=machine:petalogix-s3adsp1800
|
|
|
|
"""
|
|
|
|
tar_hash = '08bf3e3bfb6b6c7ce1e54ab65d54e189f2caf13f'
|
|
|
|
self.do_test_advcal_2018('17', tar_hash, 'ballerina.bin')
|
|
|
|
|
|
|
|
def test_or1k_sim(self):
|
|
|
|
"""
|
|
|
|
:avocado: tags=arch:or1k
|
|
|
|
:avocado: tags=machine:or1k-sim
|
|
|
|
"""
|
|
|
|
tar_hash = '20334cdaf386108c530ff0badaecc955693027dd'
|
|
|
|
self.do_test_advcal_2018('20', tar_hash, 'vmlinux')
|
|
|
|
|
|
|
|
def test_nios2_10m50(self):
|
|
|
|
"""
|
|
|
|
:avocado: tags=arch:nios2
|
|
|
|
:avocado: tags=machine:10m50-ghrd
|
|
|
|
"""
|
|
|
|
tar_hash = 'e4251141726c412ac0407c5a6bceefbbff018918'
|
|
|
|
self.do_test_advcal_2018('14', tar_hash, 'vmlinux.elf')
|
|
|
|
|
|
|
|
def test_ppc64_e500(self):
|
|
|
|
"""
|
|
|
|
:avocado: tags=arch:ppc64
|
|
|
|
:avocado: tags=machine:ppce500
|
|
|
|
"""
|
|
|
|
tar_hash = '6951d86d644b302898da2fd701739c9406527fe1'
|
|
|
|
self.vm.add_args('-cpu', 'e5500')
|
|
|
|
self.do_test_advcal_2018('19', tar_hash, 'uImage')
|
|
|
|
|
|
|
|
def test_ppc_g3beige(self):
|
|
|
|
"""
|
|
|
|
:avocado: tags=arch:ppc
|
|
|
|
:avocado: tags=machine:g3beige
|
|
|
|
"""
|
|
|
|
tar_hash = 'e0b872a5eb8fdc5bed19bd43ffe863900ebcedfc'
|
|
|
|
self.vm.add_args('-M', 'graphics=off')
|
|
|
|
self.do_test_advcal_2018('15', tar_hash, 'invaders.elf')
|
|
|
|
|
|
|
|
def test_ppc_mac99(self):
|
|
|
|
"""
|
|
|
|
:avocado: tags=arch:ppc
|
|
|
|
:avocado: tags=machine:mac99
|
|
|
|
"""
|
|
|
|
tar_hash = 'e0b872a5eb8fdc5bed19bd43ffe863900ebcedfc'
|
|
|
|
self.vm.add_args('-M', 'graphics=off')
|
|
|
|
self.do_test_advcal_2018('15', tar_hash, 'invaders.elf')
|
|
|
|
|
2020-02-11 09:59:41 +01:00
|
|
|
def test_sh4_r2d(self):
|
|
|
|
"""
|
|
|
|
:avocado: tags=arch:sh4
|
|
|
|
:avocado: tags=machine:r2d
|
|
|
|
"""
|
|
|
|
tar_hash = 'fe06a4fd8ccbf2e27928d64472939d47829d4c7e'
|
|
|
|
self.vm.add_args('-append', 'console=ttySC1')
|
|
|
|
self.do_test_advcal_2018('09', tar_hash, 'zImage', console=1)
|
|
|
|
|
2020-01-24 18:03:25 +01:00
|
|
|
def test_sparc_ss20(self):
|
|
|
|
"""
|
|
|
|
:avocado: tags=arch:sparc
|
|
|
|
:avocado: tags=machine:SS-20
|
|
|
|
"""
|
|
|
|
tar_hash = 'b18550d5d61c7615d989a06edace051017726a9f'
|
|
|
|
self.do_test_advcal_2018('11', tar_hash, 'zImage.elf')
|
|
|
|
|
|
|
|
def test_xtensa_lx60(self):
|
|
|
|
"""
|
|
|
|
:avocado: tags=arch:xtensa
|
|
|
|
:avocado: tags=machine:lx60
|
|
|
|
"""
|
|
|
|
tar_hash = '49e88d9933742f0164b60839886c9739cb7a0d34'
|
|
|
|
self.vm.add_args('-cpu', 'dc233c')
|
|
|
|
self.do_test_advcal_2018('02', tar_hash, 'santas-sleigh-ride.elf')
|