tests/boot_linux_console: add a test for riscv64 + virt
PATCH 1/1 tests/boot_linux_console: add a test for riscv64 + virt
Similar to the mips + malta test, it boots a Linux kernel on a virt board and verify the serial is working. Also, it relies on the serial device set by the machine itself.
If riscv64 is a target being built, "make check-acceptance" will automatically include this test by the use of the "arch:riscv64" tags.
Alternatively, this test can be run using:
$ avocado run -t arch:riscv64 tests/acceptance
--- tests/acceptance/boot_linux_console.py | 40 ++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+)
tests/acceptance/boot_linux_console.py +40 -0
@@ -354,3 +354,43 @@ class BootLinuxConsole(Test): self.vm.launch() console_pattern = 'Kernel command line: %s' % kernel_command_line self.wait_for_console_pattern(console_pattern) + + def test_riscv64_virt(self): + """ + :avocado: tags=arch:riscv64 + :avocado: tags=machine:virt + """ + + kernel_url = ('https://github.com/chihminchao/test-binary/raw/' + '0b7787305d9e40815c05a805266cc74ff356239e/qemu/riscv64/' + 'bbl_w_kernel.gz') + kernel_hash = 'c7f6cc7967975ad42dc61ee0535db01c9cbd0968' + kernel_path_gz = self.fetch_asset(kernel_url, asset_hash=kernel_hash) + kernel_path = self.workdir + "bbl_w_kernel" + + with gzip.open(kernel_path_gz, 'rb') as f_in: + with open(kernel_path, 'wb') as f_out: + shutil.copyfileobj(f_in, f_out) + + initrd_url = ('https://github.com/groeck/linux-build-test/raw/' + '8584a59ed9e5eb5ee7ca91f6d74bbb06619205b8/rootfs/' + 'riscv64/rootfs.cpio.gz') + initrd_hash = 'f4867d263754961b6f626cdcdc0cb334c47e3b49' + initrd_path = self.fetch_asset(initrd_url, asset_hash=initrd_hash) + + self.vm.set_machine('virt') + self.vm.set_console() + kernel_command_line = (self.KERNEL_COMMON_COMMAND_LINE + + 'console=ttyS0 noreboot') + self.vm.add_args('-kernel', kernel_path, + '-initrd', initrd_path, + '-append', kernel_command_line) + self.vm.launch() + self.wait_for_console_pattern('Boot successful.') + + self.exec_command_and_wait_for_pattern('cat /proc/cpuinfo', + 'isa') + self.exec_command_and_wait_for_pattern('uname -a', + 'sifive') + self.exec_command_and_wait_for_pattern('reboot', + 'reboot: Restarting system')
Signature · 1 line
2.7.4
Quoted 5 lines · Chih-Min Chao
Similar to the mips + malta test, it boots a Linux kernel on a virt board and verify the serial is working. Also, it relies on the serial device set by the machine itself.
Quoted 8 lines
If riscv64 is a target being built, "make check-acceptance" will automatically include this test by the use of the "arch:riscv64" tags.
Alternatively, this test can be run using:
$ avocado run -t arch:riscv64 tests/acceptanceSigned-off-by Chih-Min Chao <[email protected]>
Awesome! Thanks for the test case. This will help a lot with RISC-V regressions in QEMU.
Quoted 10 lines
--- tests/acceptance/boot_linux_console.py | 40 ++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+)tests/acceptance/boot_linux_console.py +0
-0@@ -354,3 +354,43 @@ class BootLinuxConsole(Test): self.vm.launch()
tests/acceptance/boot_linux_console.py class BootLinuxConsole(Test): · line 364
Quoted 10 lines
tests/acceptance/boot_linux_console.py +8
-0console_pattern = 'Kernel command line: %s' % kernel_command_line self.wait_for_console_pattern(console_pattern) + + def test_riscv64_virt(self): + """ + :avocado: tags=arch:riscv64 + :avocado: tags=machine:virt + """ + + kernel_url = ('https://github.com/chihminchao/test-binary/raw/'
These images need to be built with a standard build flow. Having them built from SiFive's custom scripts will make debugging problems in the future impossible. I'm also a little worried here about GPL violations, I'm not sure if it's enough to just point to a script SHA to meet GPL source disclosure. I know companies have huge headaches meeting GPL requirements so this seems too easy.
tests/acceptance/boot_linux_console.py class BootLinuxConsole(Test): · line 366
Quoted 2 lines
tests/acceptance/boot_linux_console.py +2
-0+ '0b7787305d9e40815c05a805266cc74ff356239e/qemu/riscv64/' + 'bbl_w_kernel.gz')
Don't use BBL, most people use OpenSBI now which is what we should be testing with.
tests/acceptance/boot_linux_console.py class BootLinuxConsole(Test): · line 377
Quoted 11 lines
tests/acceptance/boot_linux_console.py +11
-0+ kernel_hash = 'c7f6cc7967975ad42dc61ee0535db01c9cbd0968' + kernel_path_gz = self.fetch_asset(kernel_url, asset_hash=kernel_hash) + kernel_path = self.workdir + "bbl_w_kernel" + + with gzip.open(kernel_path_gz, 'rb') as f_in: + with open(kernel_path, 'wb') as f_out: + shutil.copyfileobj(f_in, f_out) + + initrd_url = ('https://github.com/groeck/linux-build-test/raw/' + '8584a59ed9e5eb5ee7ca91f6d74bbb06619205b8/rootfs/' + 'riscv64/rootfs.cpio.gz')
Same comment about build tools.
Alistair
Quoted 23 lines
tests/acceptance/boot_linux_console.py +19
-1+ initrd_hash = 'f4867d263754961b6f626cdcdc0cb334c47e3b49' + initrd_path = self.fetch_asset(initrd_url, asset_hash=initrd_hash) + + self.vm.set_machine('virt') + self.vm.set_console() + kernel_command_line = (self.KERNEL_COMMON_COMMAND_LINE + + 'console=ttyS0 noreboot') + self.vm.add_args('-kernel', kernel_path, + '-initrd', initrd_path, + '-append', kernel_command_line) + self.vm.launch() + self.wait_for_console_pattern('Boot successful.') + + self.exec_command_and_wait_for_pattern('cat /proc/cpuinfo', + 'isa') + self.exec_command_and_wait_for_pattern('uname -a', + 'sifive') + self.exec_command_and_wait_for_pattern('reboot', + 'reboot: Restarting system') --2.7.4
Quoted 33 lines · Alistair Francis
Quoted 5 lines · Chih-Min Chao
Similar to the mips + malta test, it boots a Linux kernel on a virt board and verify the serial is working. Also, it relies on the serial device set by the machine itself.
Quoted 8 lines
If riscv64 is a target being built, "make check-acceptance" will automatically include this test by the use of the "arch:riscv64" tags.
Alternatively, this test can be run using:
$ avocado run -t arch:riscv64 tests/acceptanceSigned-off-by Chih-Min Chao <[email protected]>Awesome! Thanks for the test case. This will help a lot with RISC-V regressions in QEMU.
Quoted 2 lines
--- tests/acceptance/boot_linux_console.py | 40++++++++++++++++++++++++++++++++++
Review
Quoted 3 lines
1 file changed, 40 insertions(+)(quoted diff) +0
-0
b/tests/acceptance/boot_linux_console.pytests/acceptance/boot_linux_console.py class BootLinuxConsole(Test): · line 355
Quoted 6 lines
index 3215950..bbc6b06 100644
tests/acceptance/boot_linux_console.py +0
-0@@ -354,3 +354,43 @@ class BootLinuxConsole(Test): self.vm.launch() console_pattern = 'Kernel command line: %s' %
kernel_command_line
Quoted 17 lines
tests/acceptance/boot_linux_console.py class BootLinuxConsole(Test): · line 364
Quoted 9 lines
tests/acceptance/boot_linux_console.py +8
-0self.wait_for_console_pattern(console_pattern) + + def test_riscv64_virt(self): + """ + :avocado: tags=arch:riscv64 + :avocado: tags=machine:virt + """ + + kernel_url = ('https://github.com/chihminchao/test-binary/raw/'These images need to be built with a standard build flow. Having them built from SiFive's custom scripts will make debugging problems in the future impossible. I'm also a little worried here about GPL violations, I'm not sure if it's enough to just point to a script SHA to meet GPL source disclosure. I know companies have huge headaches meeting GPL requirements so this seems too easy.
I am not very familiar with this kind of binary and source license
conflict.
Is it ok if I write a simple script with BSD license to build kernel
and image from sifive's linux/buildroot repo and commit the script to my test-binary repo ?
Quoted 8 lines
tests/acceptance/boot_linux_console.py class BootLinuxConsole(Test): · line 365
Quoted 2 lines
tests/acceptance/boot_linux_console.py +1
-0+'0b7787305d9e40815c05a805266cc74ff356239e/qemu/riscv64/'
tests/acceptance/boot_linux_console.py class BootLinuxConsole(Test): · line 366
Quoted 1 line
tests/acceptance/boot_linux_console.py +1
-0+ 'bbl_w_kernel.gz')Don't use BBL, most people use OpenSBI now which is what we should be testing with.
I will try to move to OpenSBI in next version. My environment is based
freedom-u-sdk and It still relays on BBL. So ..:P
Quoted 47 lines
tests/acceptance/boot_linux_console.py class BootLinuxConsole(Test): · line 368
Quoted 3 lines
tests/acceptance/boot_linux_console.py +2
-0+ kernel_hash = 'c7f6cc7967975ad42dc61ee0535db01c9cbd0968' + kernel_path_gz = self.fetch_asset(kernel_url,asset_hash=kernel_hash)
tests/acceptance/boot_linux_console.py class BootLinuxConsole(Test): · line 377
Quoted 9 lines
tests/acceptance/boot_linux_console.py +9
-0+ kernel_path = self.workdir + "bbl_w_kernel" + + with gzip.open(kernel_path_gz, 'rb') as f_in: + with open(kernel_path, 'wb') as f_out: + shutil.copyfileobj(f_in, f_out) + + initrd_url = ('https://github.com/groeck/linux-build-test/raw/' + '8584a59ed9e5eb5ee7ca91f6d74bbb06619205b8/rootfs/' + 'riscv64/rootfs.cpio.gz')Same comment about build tools.
Alistair
Got it
tests/acceptance/boot_linux_console.py class BootLinuxConsole(Test): · line 379
Quoted 2 lines
tests/acceptance/boot_linux_console.py +2
-0+ initrd_hash = 'f4867d263754961b6f626cdcdc0cb334c47e3b49' + initrd_path = self.fetch_asset(initrd_url,asset_hash=initrd_hash)
Quoted 7 lines
tests/acceptance/boot_linux_console.py +7
-0+ + self.vm.set_machine('virt') + self.vm.set_console() + kernel_command_line = (self.KERNEL_COMMON_COMMAND_LINE + + 'console=ttyS0 noreboot') + self.vm.add_args('-kernel', kernel_path, + '-initrd', initrd_path,tests/acceptance/boot_linux_console.py class BootLinuxConsole(Test):
Quoted 10 lines
tests/acceptance/boot_linux_console.py +10
-0+ '-append', kernel_command_line) + self.vm.launch() + self.wait_for_console_pattern('Boot successful.') + + self.exec_command_and_wait_for_pattern('cat /proc/cpuinfo', + 'isa') + self.exec_command_and_wait_for_pattern('uname -a', + 'sifive') + self.exec_command_and_wait_for_pattern('reboot', + 'reboot: Restartingsystem')
Quoted 4 lines
--
2.7.4
Quoted 51 lines · Chih-Min Chao
Quoted 38 lines · Alistair Francis
Quoted 5 lines · Chih-Min Chao
Similar to the mips + malta test, it boots a Linux kernel on a virt board and verify the serial is working. Also, it relies on the serial device set by the machine itself.
Quoted 8 lines
If riscv64 is a target being built, "make check-acceptance" will automatically include this test by the use of the "arch:riscv64" tags.
Alternatively, this test can be run using:
$ avocado run -t arch:riscv64 tests/acceptanceSigned-off-by Chih-Min Chao <[email protected]>Awesome! Thanks for the test case. This will help a lot with RISC-V regressions in QEMU.
Quoted 19 lines
--- tests/acceptance/boot_linux_console.py | 40 ++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+)tests/acceptance/boot_linux_console.py +7
-0@@ -354,3 +354,43 @@ class BootLinuxConsole(Test): self.vm.launch() console_pattern = 'Kernel command line: %s' % kernel_command_line self.wait_for_console_pattern(console_pattern) + + def test_riscv64_virt(self): + """ + :avocado: tags=arch:riscv64 + :avocado: tags=machine:virt + """ +Quoted 8 lines
tests/acceptance/boot_linux_console.py class BootLinuxConsole(Test): · line 364
Quoted 1 line
tests/acceptance/boot_linux_console.py +1
-0+ kernel_url = ('https://github.com/chihminchao/test-binary/raw/'These images need to be built with a standard build flow. Having them built from SiFive's custom scripts will make debugging problems in the future impossible. I'm also a little worried here about GPL violations, I'm not sure if it's enough to just point to a script SHA to meet GPL source disclosure. I know companies have huge headaches meeting GPL requirements so this seems too easy.
Quoted 1 line
I am not very familiar with this kind of binary and source license conflict.
Thinking about it more you probably are ok with a SHA to a build tool. I guess companies do all the extra work and vetting just to be extra sure. So how much you do I guess is up to you ad SiFive.
Quoted 1 line
Is it ok if I write a simple script with BSD license to build kernel and image from sifive's linux/buildroot repo and commit the script to my test-binary repo ?
No, it must be built from an upstream repo. Others need to be able to reproduce this in the future. You can just use upstream buildroot and include a config. Ideally as well use a projects release instead of some random SHA.
Quoted 9 lines
Quoted 7 lines
tests/acceptance/boot_linux_console.py class BootLinuxConsole(Test): · line 366
Quoted 4 lines
tests/acceptance/boot_linux_console.py +2
-0+ '0b7787305d9e40815c05a805266cc74ff356239e/qemu/riscv64/' + 'bbl_w_kernel.gz')Don't use BBL, most people use OpenSBI now which is what we should be testing with.
I will try to move to OpenSBI in next version. My environment is based freedom-u-sdk and It still relays on BBL. So ..:P
Swap to an upstream distro, I think they all support OpenSBI now. Buildroot and OE/Yocto both give you development environments and Fedora and Debian work as well.
Alistair
Quoted 44 lines
Quoted 17 lines
tests/acceptance/boot_linux_console.py class BootLinuxConsole(Test): · line 377
Quoted 13 lines
tests/acceptance/boot_linux_console.py +11
-0+ kernel_hash = 'c7f6cc7967975ad42dc61ee0535db01c9cbd0968' + kernel_path_gz = self.fetch_asset(kernel_url, asset_hash=kernel_hash) + kernel_path = self.workdir + "bbl_w_kernel" + + with gzip.open(kernel_path_gz, 'rb') as f_in: + with open(kernel_path, 'wb') as f_out: + shutil.copyfileobj(f_in, f_out) + + initrd_url = ('https://github.com/groeck/linux-build-test/raw/' + '8584a59ed9e5eb5ee7ca91f6d74bbb06619205b8/rootfs/' + 'riscv64/rootfs.cpio.gz')Same comment about build tools.
Quoted 2 lines
Alistair
Got it
Quoted 24 lines
Quoted 24 lines
tests/acceptance/boot_linux_console.py +19
-1+ initrd_hash = 'f4867d263754961b6f626cdcdc0cb334c47e3b49' + initrd_path = self.fetch_asset(initrd_url, asset_hash=initrd_hash) + + self.vm.set_machine('virt') + self.vm.set_console() + kernel_command_line = (self.KERNEL_COMMON_COMMAND_LINE + + 'console=ttyS0 noreboot') + self.vm.add_args('-kernel', kernel_path, + '-initrd', initrd_path, + '-append', kernel_command_line) + self.vm.launch() + self.wait_for_console_pattern('Boot successful.') + + self.exec_command_and_wait_for_pattern('cat /proc/cpuinfo', + 'isa') + self.exec_command_and_wait_for_pattern('uname -a', + 'sifive') + self.exec_command_and_wait_for_pattern('reboot', + 'reboot: Restarting system') --2.7.4
Quoted 31 lines · Chih-Min Chao
Similar to the mips + malta test, it boots a Linux kernel on a virt board and verify the serial is working. Also, it relies on the serial device set by the machine itself.
If riscv64 is a target being built, "make check-acceptance" will automatically include this test by the use of the "arch:riscv64" tags.
Alternatively, this test can be run using:
$ avocado run -t arch:riscv64 tests/acceptanceSigned-off-by Chih-Min Chao <[email protected]>--- tests/acceptance/boot_linux_console.py | 40 ++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+)tests/acceptance/boot_linux_console.py +7
-0@@ -354,3 +354,43 @@ class BootLinuxConsole(Test): self.vm.launch() console_pattern = 'Kernel command line: %s' % kernel_command_line self.wait_for_console_pattern(console_pattern) + + def test_riscv64_virt(self): + """ + :avocado: tags=arch:riscv64 + :avocado: tags=machine:virt + """ +
tests/acceptance/boot_linux_console.py class BootLinuxConsole(Test): · line 373
Quoted 10 lines
tests/acceptance/boot_linux_console.py +10
-0+ kernel_url = ('https://github.com/chihminchao/test-binary/raw/' + '0b7787305d9e40815c05a805266cc74ff356239e/qemu/riscv64/' + 'bbl_w_kernel.gz') + kernel_hash = 'c7f6cc7967975ad42dc61ee0535db01c9cbd0968' + kernel_path_gz = self.fetch_asset(kernel_url, asset_hash=kernel_hash) + kernel_path = self.workdir + "bbl_w_kernel" + + with gzip.open(kernel_path_gz, 'rb') as f_in: + with open(kernel_path, 'wb') as f_out: + shutil.copyfileobj(f_in, f_out)
There are currently two patterns for extracting a gzipped file in this test. So, this is not a must, but maybe you'd prefer:
---
tests/acceptance/boot_linux_console.py +3 -7
@@ -365,12 +365,8 @@ class BootLinuxConsole(Test): '0b7787305d9e40815c05a805266cc74ff356239e/qemu/riscv64/' 'bbl_w_kernel.gz') kernel_hash = 'c7f6cc7967975ad42dc61ee0535db01c9cbd0968' - kernel_path_gz = self.fetch_asset(kernel_url, asset_hash=kernel_hash) - kernel_path = self.workdir + "bbl_w_kernel" - - with gzip.open(kernel_path_gz, 'rb') as f_in: - with open(kernel_path, 'wb') as f_out: - shutil.copyfileobj(f_in, f_out) + kernel_path = self.fetch_asset(kernel_url, asset_hash=kernel_hash) + uncompressed_kernel = archive.uncompress(kernel_path, self.workdir) initrd_url = ('https://github.com/groeck/linux-build-test/raw/' '8584a59ed9e5eb5ee7ca91f6d74bbb06619205b8/rootfs/'
@@ -382,7 +378,7 @@ class BootLinuxConsole(Test): self.vm.set_console() kernel_command_line = (self.KERNEL_COMMON_COMMAND_LINE + 'console=ttyS0 noreboot') - self.vm.add_args('-kernel', kernel_path, + self.vm.add_args('-kernel', uncompressed_kernel, '-initrd', initrd_path, '-append', kernel_command_line) self.vm.launch()
---
Quoted 27 lines
tests/acceptance/boot_linux_console.py +23
-0+ + initrd_url = ('https://github.com/groeck/linux-build-test/raw/' + '8584a59ed9e5eb5ee7ca91f6d74bbb06619205b8/rootfs/' + 'riscv64/rootfs.cpio.gz') + initrd_hash = 'f4867d263754961b6f626cdcdc0cb334c47e3b49' + initrd_path = self.fetch_asset(initrd_url, asset_hash=initrd_hash) + + self.vm.set_machine('virt') + self.vm.set_console() + kernel_command_line = (self.KERNEL_COMMON_COMMAND_LINE + + 'console=ttyS0 noreboot') + self.vm.add_args('-kernel', kernel_path, + '-initrd', initrd_path, + '-append', kernel_command_line) + self.vm.launch() + self.wait_for_console_pattern('Boot successful.') + + self.exec_command_and_wait_for_pattern('cat /proc/cpuinfo', + 'isa') + self.exec_command_and_wait_for_pattern('uname -a', + 'sifive') + self.exec_command_and_wait_for_pattern('reboot', + 'reboot: Restarting system')Signature · 1 line
2.7.4
It'd be nice to also add riscv64 to the target list in .travis.yaml "acceptance tests" job.
Regards and many thanks for this contribution!
- Cleber.
Quoted 42 lines · Cleber Rosa
Quoted 7 lines · Chih-Min Chao
Similar to the mips + malta test, it boots a Linux kernel on a virt board and verify the serial is working. Also, it relies on the serial device set by the machine itself.
If riscv64 is a target being built, "make check-acceptance" will automatically include this test by the use of the "arch:riscv64" tags.
Quoted 7 lines
Alternatively, this test can be run using:
$ avocado run -t arch:riscv64 tests/acceptanceSigned-off-by Chih-Min Chao <[email protected]>--- tests/acceptance/boot_linux_console.py | 40++++++++++++++++++++++++++++++++++
Review
Quoted 3 lines
1 file changed, 40 insertions(+)(quoted diff) +0
-0
b/tests/acceptance/boot_linux_console.pytests/acceptance/boot_linux_console.py class BootLinuxConsole(Test): · line 355
Quoted 6 lines
index 3215950..bbc6b06 100644
tests/acceptance/boot_linux_console.py +0
-0@@ -354,3 +354,43 @@ class BootLinuxConsole(Test): self.vm.launch() console_pattern = 'Kernel command line: %s' %
kernel_command_linetests/acceptance/boot_linux_console.py class BootLinuxConsole(Test): · line 365
Quoted 10 lines
tests/acceptance/boot_linux_console.py +9
-0self.wait_for_console_pattern(console_pattern) + + def test_riscv64_virt(self): + """ + :avocado: tags=arch:riscv64 + :avocado: tags=machine:virt + """ + + kernel_url = ('https://github.com/chihminchao/test-binary/raw/' +'0b7787305d9e40815c05a805266cc74ff356239e/qemu/riscv64/'
tests/acceptance/boot_linux_console.py class BootLinuxConsole(Test): · line 368
Quoted 3 lines
tests/acceptance/boot_linux_console.py +3
-0+ 'bbl_w_kernel.gz') + kernel_hash = 'c7f6cc7967975ad42dc61ee0535db01c9cbd0968' + kernel_path_gz = self.fetch_asset(kernel_url,asset_hash=kernel_hash)
Quoted 9 lines
tests/acceptance/boot_linux_console.py class BootLinuxConsole(Test): · line 373
Quoted 5 lines
tests/acceptance/boot_linux_console.py +5
-0+ kernel_path = self.workdir + "bbl_w_kernel" + + with gzip.open(kernel_path_gz, 'rb') as f_in: + with open(kernel_path, 'wb') as f_out: + shutil.copyfileobj(f_in, f_out)There are currently two patterns for extracting a gzipped file in this test. So, this is not a must, but maybe you'd prefer:
The suggestion is good and avocado is an awesome testing framework.
---
Quoted 70 lines
tests/acceptance/boot_linux_console.py +2
-6@@ -365,12 +365,8 @@ class BootLinuxConsole(Test): '0b7787305d9e40815c05a805266cc74ff356239e/qemu/riscv64/' 'bbl_w_kernel.gz') kernel_hash = 'c7f6cc7967975ad42dc61ee0535db01c9cbd0968' - kernel_path_gz = self.fetch_asset(kernel_url, asset_hash=kernel_hash) - kernel_path = self.workdir + "bbl_w_kernel" - - with gzip.open(kernel_path_gz, 'rb') as f_in: - with open(kernel_path, 'wb') as f_out: - shutil.copyfileobj(f_in, f_out) + kernel_path = self.fetch_asset(kernel_url, asset_hash=kernel_hash) + uncompressed_kernel = archive.uncompress(kernel_path, self.workdir)
initrd_url= ('https://github.com/groeck/linux-build-test/raw/'
'8584a59ed9e5eb5ee7ca91f6d74bbb06619205b8/rootfs/'tests/acceptance/boot_linux_console.py +1
-2@@ -382,7 +378,7 @@ class BootLinuxConsole(Test): self.vm.set_console() kernel_command_line = (self.KERNEL_COMMON_COMMAND_LINE + 'console=ttyS0 noreboot') - self.vm.add_args('-kernel', kernel_path, + self.vm.add_args('-kernel', uncompressed_kernel, '-initrd', initrd_path, '-append', kernel_command_line) self.vm.launch() ---tests/acceptance/boot_linux_console.py class BootLinuxConsole(Test): · line 379
Quoted 7 lines
tests/acceptance/boot_linux_console.py +6
-0+ + initrd_url = ('https://github.com/groeck/linux-build-test/raw/' + '8584a59ed9e5eb5ee7ca91f6d74bbb06619205b8/rootfs/' + 'riscv64/rootfs.cpio.gz') + initrd_hash = 'f4867d263754961b6f626cdcdc0cb334c47e3b49' + initrd_path = self.fetch_asset(initrd_url,asset_hash=initrd_hash)
Quoted 7 lines
tests/acceptance/boot_linux_console.py +7
-0+ + self.vm.set_machine('virt') + self.vm.set_console() + kernel_command_line = (self.KERNEL_COMMON_COMMAND_LINE + + 'console=ttyS0 noreboot') + self.vm.add_args('-kernel', kernel_path, + '-initrd', initrd_path,tests/acceptance/boot_linux_console.py class BootLinuxConsole(Test): · line 396
Quoted 10 lines
tests/acceptance/boot_linux_console.py +10
-0+ '-append', kernel_command_line) + self.vm.launch() + self.wait_for_console_pattern('Boot successful.') + + self.exec_command_and_wait_for_pattern('cat /proc/cpuinfo', + 'isa') + self.exec_command_and_wait_for_pattern('uname -a', + 'sifive') + self.exec_command_and_wait_for_pattern('reboot', + 'reboot: Restartingsystem')
Quoted 4 lines
--
2.7.4It'd be nice to also add riscv64 to the target list in
.travis.yaml"acceptance tests" job.Regards and many thanks for this contribution!
- Cleber.
Hi Chih-Min,
Quoted 3 lines · Chih-Min Chao
Similar to the mips + malta test, it boots a Linux kernel on a virt board and verify the serial is working. Also, it relies on the serial device set by the machine itself.
Good idea!
Quoted 21 lines
If riscv64 is a target being built, "make check-acceptance" will automatically include this test by the use of the "arch:riscv64" tags.
Alternatively, this test can be run using:
$ avocado run -t arch:riscv64 tests/acceptanceSigned-off-by Chih-Min Chao <[email protected]>--- tests/acceptance/boot_linux_console.py | 40 ++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+)tests/acceptance/boot_linux_console.py +0
-0@@ -354,3 +354,43 @@ class BootLinuxConsole(Test): self.vm.launch() console_pattern = 'Kernel command line: %s' % kernel_command_line self.wait_for_console_pattern(console_pattern)
tests/acceptance/boot_linux_console.py class BootLinuxConsole(Test): · line 366
Quoted 10 lines
tests/acceptance/boot_linux_console.py +10
-0+ + def test_riscv64_virt(self): + """ + :avocado: tags=arch:riscv64 + :avocado: tags=machine:virt + """ + + kernel_url = ('https://github.com/chihminchao/test-binary/raw/' + '0b7787305d9e40815c05a805266cc74ff356239e/qemu/riscv64/' + 'bbl_w_kernel.gz')
I recommend you to extract fw_jump.elf from [1] and vmlinux-4.19.0-5-riscv64 from [2] with the extract_from_deb() helper.
[1] https://packages.debian.org/sid/all/opensbi
[2] https://packages.debian.org/sid/linux-image-4.19.0-5-riscv64
Quoted 11 lines
tests/acceptance/boot_linux_console.py +11
-0+ kernel_hash = 'c7f6cc7967975ad42dc61ee0535db01c9cbd0968' + kernel_path_gz = self.fetch_asset(kernel_url, asset_hash=kernel_hash) + kernel_path = self.workdir + "bbl_w_kernel" + + with gzip.open(kernel_path_gz, 'rb') as f_in: + with open(kernel_path, 'wb') as f_out: + shutil.copyfileobj(f_in, f_out) + + initrd_url = ('https://github.com/groeck/linux-build-test/raw/' + '8584a59ed9e5eb5ee7ca91f6d74bbb06619205b8/rootfs/' + 'riscv64/rootfs.cpio.gz')
tests/acceptance/boot_linux_console.py class BootLinuxConsole(Test): · line 387
Quoted 10 lines
tests/acceptance/boot_linux_console.py +10
-0+ initrd_hash = 'f4867d263754961b6f626cdcdc0cb334c47e3b49' + initrd_path = self.fetch_asset(initrd_url, asset_hash=initrd_hash) + + self.vm.set_machine('virt') + self.vm.set_console() + kernel_command_line = (self.KERNEL_COMMON_COMMAND_LINE + + 'console=ttyS0 noreboot') + self.vm.add_args('-kernel', kernel_path, + '-initrd', initrd_path, + '-append', kernel_command_line)
You might want to use '-no-reboot' here too.
tests/acceptance/boot_linux_console.py class BootLinuxConsole(Test): · line 396
Quoted 9 lines
tests/acceptance/boot_linux_console.py +9
-0+ self.vm.launch() + self.wait_for_console_pattern('Boot successful.') + + self.exec_command_and_wait_for_pattern('cat /proc/cpuinfo', + 'isa') + self.exec_command_and_wait_for_pattern('uname -a', + 'sifive') + self.exec_command_and_wait_for_pattern('reboot', + 'reboot: Restarting system')
Regards,
Phil.
Quoted 45 lines · Philippe Mathieu-Daudé
Hi Chih-Min,
Quoted 3 lines · Chih-Min Chao
Similar to the mips + malta test, it boots a Linux kernel on a virt board and verify the serial is working. Also, it relies on the serial device set by the machine itself.
Good idea!
Quoted 21 lines
If riscv64 is a target being built, "make check-acceptance" will automatically include this test by the use of the "arch:riscv64" tags.
Alternatively, this test can be run using:
$ avocado run -t arch:riscv64 tests/acceptanceSigned-off-by Chih-Min Chao <[email protected]>--- tests/acceptance/boot_linux_console.py | 40 ++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+)tests/acceptance/boot_linux_console.py +0
-0@@ -354,3 +354,43 @@ class BootLinuxConsole(Test): self.vm.launch() console_pattern = 'Kernel command line: %s' % kernel_command_line self.wait_for_console_pattern(console_pattern)tests/acceptance/boot_linux_console.py class BootLinuxConsole(Test): · line 366
Quoted 10 lines
tests/acceptance/boot_linux_console.py +10
-0+ + def test_riscv64_virt(self): + """ + :avocado: tags=arch:riscv64 + :avocado: tags=machine:virt + """ + + kernel_url = ('https://github.com/chihminchao/test-binary/raw/' + '0b7787305d9e40815c05a805266cc74ff356239e/qemu/riscv64/' + 'bbl_w_kernel.gz')I recommend you to extract fw_jump.elf from [1] and vmlinux-4.19.0-5-riscv64 from [2] with the
extract_from_deb()helper.
Quoted 2 lines
[1] https://packages.debian.org/sid/all/opensbi
[2] https://packages.debian.org/sid/linux-image-4.19.0-5-riscv64
This will works as well if you don't want to bother building the images yourself. Ideally we could use a newer kernel then 4.19 but for an acceptance test it probably doesn't matter much.
This way Debain has done all the licence work for you as well :)
Alistair
Quoted 39 lines
Quoted 12 lines
tests/acceptance/boot_linux_console.py +11
-0+ kernel_hash = 'c7f6cc7967975ad42dc61ee0535db01c9cbd0968' + kernel_path_gz = self.fetch_asset(kernel_url, asset_hash=kernel_hash) + kernel_path = self.workdir + "bbl_w_kernel" + + with gzip.open(kernel_path_gz, 'rb') as f_in: + with open(kernel_path, 'wb') as f_out: + shutil.copyfileobj(f_in, f_out) + + initrd_url = ('https://github.com/groeck/linux-build-test/raw/' + '8584a59ed9e5eb5ee7ca91f6d74bbb06619205b8/rootfs/' + 'riscv64/rootfs.cpio.gz')tests/acceptance/boot_linux_console.py class BootLinuxConsole(Test): · line 387
Quoted 10 lines
tests/acceptance/boot_linux_console.py +10
-0+ initrd_hash = 'f4867d263754961b6f626cdcdc0cb334c47e3b49' + initrd_path = self.fetch_asset(initrd_url, asset_hash=initrd_hash) + + self.vm.set_machine('virt') + self.vm.set_console() + kernel_command_line = (self.KERNEL_COMMON_COMMAND_LINE + + 'console=ttyS0 noreboot') + self.vm.add_args('-kernel', kernel_path, + '-initrd', initrd_path, + '-append', kernel_command_line)You might want to use '-no-reboot' here too.
tests/acceptance/boot_linux_console.py class BootLinuxConsole(Test): · line 396
Quoted 9 lines
tests/acceptance/boot_linux_console.py +9
-0+ self.vm.launch() + self.wait_for_console_pattern('Boot successful.') + + self.exec_command_and_wait_for_pattern('cat /proc/cpuinfo', + 'isa') + self.exec_command_and_wait_for_pattern('uname -a', + 'sifive') + self.exec_command_and_wait_for_pattern('reboot', + 'reboot: Restarting system')Regards,
Phil.
Quoted 47 lines · Alistair Francis
Quoted 45 lines · Philippe Mathieu-Daudé
Hi Chih-Min,
Quoted 3 lines · Chih-Min Chao
Similar to the mips + malta test, it boots a Linux kernel on a virt board and verify the serial is working. Also, it relies on the serial device set by the machine itself.
Good idea!
Quoted 21 lines
If riscv64 is a target being built, "make check-acceptance" will automatically include this test by the use of the "arch:riscv64" tags.
Alternatively, this test can be run using:
$ avocado run -t arch:riscv64 tests/acceptanceSigned-off-by Chih-Min Chao <[email protected]>--- tests/acceptance/boot_linux_console.py | 40 ++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+)tests/acceptance/boot_linux_console.py +0
-0@@ -354,3 +354,43 @@ class BootLinuxConsole(Test): self.vm.launch() console_pattern = 'Kernel command line: %s' % kernel_command_line self.wait_for_console_pattern(console_pattern)tests/acceptance/boot_linux_console.py class BootLinuxConsole(Test): · line 366
Quoted 10 lines
tests/acceptance/boot_linux_console.py +10
-0+ + def test_riscv64_virt(self): + """ + :avocado: tags=arch:riscv64 + :avocado: tags=machine:virt + """ + + kernel_url = ('https://github.com/chihminchao/test-binary/raw/' + '0b7787305d9e40815c05a805266cc74ff356239e/qemu/riscv64/' + 'bbl_w_kernel.gz')I recommend you to extract fw_jump.elf from [1] and vmlinux-4.19.0-5-riscv64 from [2] with the
extract_from_deb()helper.
Quoted 6 lines
Quoted 2 lines
[1] https://packages.debian.org/sid/all/opensbi
[2] https://packages.debian.org/sid/linux-image-4.19.0-5-riscv64This will works as well if you don't want to bother building the images yourself. Ideally we could use a newer kernel then 4.19 but for an acceptance test it probably doesn't matter much.
This one is available in 'experimental', in case you want to test it too, but I'd rather use some stable channel for testing:
https://packages.debian.org/experimental/linux-image-5.0.0-trunk-riscv64
Quoted 1 line
This way Debain has done all the licence work for you as well :)
And all the building work ;)
Quoted 42 lines
Alistair
Quoted 39 lines
Quoted 12 lines
tests/acceptance/boot_linux_console.py +11
-0+ kernel_hash = 'c7f6cc7967975ad42dc61ee0535db01c9cbd0968' + kernel_path_gz = self.fetch_asset(kernel_url, asset_hash=kernel_hash) + kernel_path = self.workdir + "bbl_w_kernel" + + with gzip.open(kernel_path_gz, 'rb') as f_in: + with open(kernel_path, 'wb') as f_out: + shutil.copyfileobj(f_in, f_out) + + initrd_url = ('https://github.com/groeck/linux-build-test/raw/' + '8584a59ed9e5eb5ee7ca91f6d74bbb06619205b8/rootfs/' + 'riscv64/rootfs.cpio.gz')tests/acceptance/boot_linux_console.py class BootLinuxConsole(Test): · line 387
Quoted 10 lines
tests/acceptance/boot_linux_console.py +10
-0+ initrd_hash = 'f4867d263754961b6f626cdcdc0cb334c47e3b49' + initrd_path = self.fetch_asset(initrd_url, asset_hash=initrd_hash) + + self.vm.set_machine('virt') + self.vm.set_console() + kernel_command_line = (self.KERNEL_COMMON_COMMAND_LINE + + 'console=ttyS0 noreboot') + self.vm.add_args('-kernel', kernel_path, + '-initrd', initrd_path, + '-append', kernel_command_line)You might want to use '-no-reboot' here too.
tests/acceptance/boot_linux_console.py class BootLinuxConsole(Test): · line 396
Quoted 9 lines
tests/acceptance/boot_linux_console.py +9
-0+ self.vm.launch() + self.wait_for_console_pattern('Boot successful.') + + self.exec_command_and_wait_for_pattern('cat /proc/cpuinfo', + 'isa') + self.exec_command_and_wait_for_pattern('uname -a', + 'sifive') + self.exec_command_and_wait_for_pattern('reboot', + 'reboot: Restarting system')Regards,
Phil.