diff mbox series

[1/2] tests/functional: Add a functional test for the collie board

Message ID 20241017163247.711244-2-peter.maydell@linaro.org
State Superseded
Headers show
Series arm: Add collie and sx functional tests | expand

Commit Message

Peter Maydell Oct. 17, 2024, 4:32 p.m. UTC
Add a functional test for the collie board that uses the kernel and
rootfs provided by Guenter Roeck in the linux-test-downloads repo:
 https://github.com/groeck/linux-test-downloads/

This just boots Linux with a userspace that immediately reboots
the board, so we wait for the reboot log line.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
---
 MAINTAINERS                         |  1 +
 tests/functional/meson.build        |  1 +
 tests/functional/test_arm_collie.py | 31 +++++++++++++++++++++++++++++
 3 files changed, 33 insertions(+)
 create mode 100755 tests/functional/test_arm_collie.py

Comments

Thomas Huth Oct. 17, 2024, 5:15 p.m. UTC | #1
On 17/10/2024 18.32, Peter Maydell wrote:
> Add a functional test for the collie board that uses the kernel and
> rootfs provided by Guenter Roeck in the linux-test-downloads repo:
>   https://github.com/groeck/linux-test-downloads/
> 
> This just boots Linux with a userspace that immediately reboots
> the board, so we wait for the reboot log line.
> 
> Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
> ---
>   MAINTAINERS                         |  1 +
>   tests/functional/meson.build        |  1 +
>   tests/functional/test_arm_collie.py | 31 +++++++++++++++++++++++++++++
>   3 files changed, 33 insertions(+)
>   create mode 100755 tests/functional/test_arm_collie.py
> 
> diff --git a/MAINTAINERS b/MAINTAINERS
> index c21d6a2f9e1..10b3360ed40 100644
> --- a/MAINTAINERS
> +++ b/MAINTAINERS
> @@ -929,6 +929,7 @@ F: hw/arm/strongarm*
>   F: hw/gpio/zaurus.c
>   F: include/hw/arm/sharpsl.h
>   F: docs/system/arm/collie.rst
> +F: tests/functional/test_arm_collie.py
>   
>   Stellaris
>   M: Peter Maydell <peter.maydell@linaro.org>
> diff --git a/tests/functional/meson.build b/tests/functional/meson.build
> index c90c02517a0..0450805a9c4 100644
> --- a/tests/functional/meson.build
> +++ b/tests/functional/meson.build
> @@ -51,6 +51,7 @@ tests_alpha_system_thorough = [
>   
>   tests_arm_system_thorough = [
>     'arm_canona1100',
> +  'arm_collie',
>     'arm_integratorcp',
>     'arm_raspi2',
>     'arm_vexpress',
> diff --git a/tests/functional/test_arm_collie.py b/tests/functional/test_arm_collie.py
> new file mode 100755
> index 00000000000..7e144a0a8fb
> --- /dev/null
> +++ b/tests/functional/test_arm_collie.py
> @@ -0,0 +1,31 @@
> +#!/usr/bin/env python3
> +#
> +# Functional test that boots a Linux kernel on a collie machine
> +# and checks the console
> +#
> +# SPDX-License-Identifier: GPL-2.0-or-later
> +
> +from qemu_test import LinuxKernelTest, Asset
> +from qemu_test.utils import archive_extract
> +
> +class CollieTest(LinuxKernelTest):
> +
> +    ASSET_ZIMAGE = Asset(
> +        'https://github.com/groeck/linux-test-downloads/raw/225223f2ad7d637b34426810bf6c3b727b76a718/collie/zImage',
> +        '10ace8abf9e0875ef8a83b8829cc3b5b50bc6d7bc3ca29f19f49f5673a43c13b')
> +
> +    ASSET_ROOTFS = Asset(
> +        'https://github.com/groeck/linux-test-downloads/raw/225223f2ad7d637b34426810bf6c3b727b76a718/collie/rootfs-sa110.cpio',
> +        '89ccaaa5c6b33331887047e1618ffe81b0f55909173944347d5d2426f3bcc1f2')
> +
> +    def test_arm_collie(self):
> +        self.set_machine('collie')
> +        zimage_path = self.ASSET_ZIMAGE.fetch()
> +        rootfs_path = self.ASSET_ROOTFS.fetch()
> +        self.vm.add_args('-append', 'rdinit=/sbin/init console=ttySA1')
> +        self.launch_kernel(zimage_path,
> +                           initrd=rootfs_path,
> +                           wait_for='reboot: Restarting system')
> +
> +if __name__ == '__main__':
> +    LinuxKernelTest.main()

Reviewed-by: Thomas Huth <thuth@redhat.com>
Philippe Mathieu-Daudé Oct. 22, 2024, 4:11 a.m. UTC | #2
On 17/10/24 13:32, Peter Maydell wrote:
> Add a functional test for the collie board that uses the kernel and
> rootfs provided by Guenter Roeck in the linux-test-downloads repo:
>   https://github.com/groeck/linux-test-downloads/
> 
> This just boots Linux with a userspace that immediately reboots
> the board, so we wait for the reboot log line.
> 
> Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
> ---
>   MAINTAINERS                         |  1 +
>   tests/functional/meson.build        |  1 +
>   tests/functional/test_arm_collie.py | 31 +++++++++++++++++++++++++++++
>   3 files changed, 33 insertions(+)
>   create mode 100755 tests/functional/test_arm_collie.py


> +class CollieTest(LinuxKernelTest):
> +
> +    ASSET_ZIMAGE = Asset(
> +        'https://github.com/groeck/linux-test-downloads/raw/225223f2ad7d637b34426810bf6c3b727b76a718/collie/zImage',
> +        '10ace8abf9e0875ef8a83b8829cc3b5b50bc6d7bc3ca29f19f49f5673a43c13b')
> +
> +    ASSET_ROOTFS = Asset(
> +        'https://github.com/groeck/linux-test-downloads/raw/225223f2ad7d637b34426810bf6c3b727b76a718/collie/rootfs-sa110.cpio',
> +        '89ccaaa5c6b33331887047e1618ffe81b0f55909173944347d5d2426f3bcc1f2')

Should we wrap these lines to comply with checkpatch.pl?

Otherwise,

Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Daniel P. Berrangé Oct. 22, 2024, 7:09 a.m. UTC | #3
On Tue, Oct 22, 2024 at 01:11:31AM -0300, Philippe Mathieu-Daudé wrote:
> On 17/10/24 13:32, Peter Maydell wrote:
> > Add a functional test for the collie board that uses the kernel and
> > rootfs provided by Guenter Roeck in the linux-test-downloads repo:
> >   https://github.com/groeck/linux-test-downloads/
> > 
> > This just boots Linux with a userspace that immediately reboots
> > the board, so we wait for the reboot log line.
> > 
> > Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
> > ---
> >   MAINTAINERS                         |  1 +
> >   tests/functional/meson.build        |  1 +
> >   tests/functional/test_arm_collie.py | 31 +++++++++++++++++++++++++++++
> >   3 files changed, 33 insertions(+)
> >   create mode 100755 tests/functional/test_arm_collie.py
> 
> 
> > +class CollieTest(LinuxKernelTest):
> > +
> > +    ASSET_ZIMAGE = Asset(
> > +        'https://github.com/groeck/linux-test-downloads/raw/225223f2ad7d637b34426810bf6c3b727b76a718/collie/zImage',
> > +        '10ace8abf9e0875ef8a83b8829cc3b5b50bc6d7bc3ca29f19f49f5673a43c13b')
> > +
> > +    ASSET_ROOTFS = Asset(
> > +        'https://github.com/groeck/linux-test-downloads/raw/225223f2ad7d637b34426810bf6c3b727b76a718/collie/rootfs-sa110.cpio',
> > +        '89ccaaa5c6b33331887047e1618ffe81b0f55909173944347d5d2426f3bcc1f2')
> 
> Should we wrap these lines to comply with checkpatch.pl?

While we have some line wrapped URLs in the tests already, IMHO they are
pretty awful to look at. I think we should make URLs be an exception to
line wrapping rules, provided the URL is the /only/ thing on the line.

With regards,
Daniel
Peter Maydell Oct. 22, 2024, 9:02 a.m. UTC | #4
On Tue, 22 Oct 2024 at 08:09, Daniel P. Berrangé <berrange@redhat.com> wrote:
>
> On Tue, Oct 22, 2024 at 01:11:31AM -0300, Philippe Mathieu-Daudé wrote:
> > On 17/10/24 13:32, Peter Maydell wrote:
> > > Add a functional test for the collie board that uses the kernel and
> > > rootfs provided by Guenter Roeck in the linux-test-downloads repo:
> > >   https://github.com/groeck/linux-test-downloads/
> > >
> > > This just boots Linux with a userspace that immediately reboots
> > > the board, so we wait for the reboot log line.
> > >
> > > Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
> > > ---
> > >   MAINTAINERS                         |  1 +
> > >   tests/functional/meson.build        |  1 +
> > >   tests/functional/test_arm_collie.py | 31 +++++++++++++++++++++++++++++
> > >   3 files changed, 33 insertions(+)
> > >   create mode 100755 tests/functional/test_arm_collie.py
> >
> >
> > > +class CollieTest(LinuxKernelTest):
> > > +
> > > +    ASSET_ZIMAGE = Asset(
> > > +        'https://github.com/groeck/linux-test-downloads/raw/225223f2ad7d637b34426810bf6c3b727b76a718/collie/zImage',
> > > +        '10ace8abf9e0875ef8a83b8829cc3b5b50bc6d7bc3ca29f19f49f5673a43c13b')
> > > +
> > > +    ASSET_ROOTFS = Asset(
> > > +        'https://github.com/groeck/linux-test-downloads/raw/225223f2ad7d637b34426810bf6c3b727b76a718/collie/rootfs-sa110.cpio',
> > > +        '89ccaaa5c6b33331887047e1618ffe81b0f55909173944347d5d2426f3bcc1f2')
> >
> > Should we wrap these lines to comply with checkpatch.pl?
>
> While we have some line wrapped URLs in the tests already, IMHO they are
> pretty awful to look at. I think we should make URLs be an exception to
> line wrapping rules, provided the URL is the /only/ thing on the line.

Our style guide already says
"If wrapping the line at 80 columns is obviously less readable and more
 awkward, prefer not to wrap it"
and that's the principle under which I chose not to wrap these.

(I think of this as analogous to George Orwell's "Break any
of these rules sooner than say anything outright barbarous"
rule for writing English...)

-- PMM
Philippe Mathieu-Daudé Oct. 22, 2024, 9:45 p.m. UTC | #5
On 22/10/24 06:02, Peter Maydell wrote:
> On Tue, 22 Oct 2024 at 08:09, Daniel P. Berrangé <berrange@redhat.com> wrote:
>>
>> On Tue, Oct 22, 2024 at 01:11:31AM -0300, Philippe Mathieu-Daudé wrote:
>>> On 17/10/24 13:32, Peter Maydell wrote:
>>>> Add a functional test for the collie board that uses the kernel and
>>>> rootfs provided by Guenter Roeck in the linux-test-downloads repo:
>>>>    https://github.com/groeck/linux-test-downloads/
>>>>
>>>> This just boots Linux with a userspace that immediately reboots
>>>> the board, so we wait for the reboot log line.
>>>>
>>>> Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
>>>> ---
>>>>    MAINTAINERS                         |  1 +
>>>>    tests/functional/meson.build        |  1 +
>>>>    tests/functional/test_arm_collie.py | 31 +++++++++++++++++++++++++++++
>>>>    3 files changed, 33 insertions(+)
>>>>    create mode 100755 tests/functional/test_arm_collie.py
>>>
>>>
>>>> +class CollieTest(LinuxKernelTest):
>>>> +
>>>> +    ASSET_ZIMAGE = Asset(
>>>> +        'https://github.com/groeck/linux-test-downloads/raw/225223f2ad7d637b34426810bf6c3b727b76a718/collie/zImage',
>>>> +        '10ace8abf9e0875ef8a83b8829cc3b5b50bc6d7bc3ca29f19f49f5673a43c13b')
>>>> +
>>>> +    ASSET_ROOTFS = Asset(
>>>> +        'https://github.com/groeck/linux-test-downloads/raw/225223f2ad7d637b34426810bf6c3b727b76a718/collie/rootfs-sa110.cpio',
>>>> +        '89ccaaa5c6b33331887047e1618ffe81b0f55909173944347d5d2426f3bcc1f2')
>>>
>>> Should we wrap these lines to comply with checkpatch.pl?
>>
>> While we have some line wrapped URLs in the tests already, IMHO they are
>> pretty awful to look at. I think we should make URLs be an exception to
>> line wrapping rules, provided the URL is the /only/ thing on the line.

Clever, fine by me.

> Our style guide already says
> "If wrapping the line at 80 columns is obviously less readable and more
>   awkward, prefer not to wrap it"
> and that's the principle under which I chose not to wrap these.
> 
> (I think of this as analogous to George Orwell's "Break any
> of these rules sooner than say anything outright barbarous"
> rule for writing English...)
> 
> -- PMM
diff mbox series

Patch

diff --git a/MAINTAINERS b/MAINTAINERS
index c21d6a2f9e1..10b3360ed40 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -929,6 +929,7 @@  F: hw/arm/strongarm*
 F: hw/gpio/zaurus.c
 F: include/hw/arm/sharpsl.h
 F: docs/system/arm/collie.rst
+F: tests/functional/test_arm_collie.py
 
 Stellaris
 M: Peter Maydell <peter.maydell@linaro.org>
diff --git a/tests/functional/meson.build b/tests/functional/meson.build
index c90c02517a0..0450805a9c4 100644
--- a/tests/functional/meson.build
+++ b/tests/functional/meson.build
@@ -51,6 +51,7 @@  tests_alpha_system_thorough = [
 
 tests_arm_system_thorough = [
   'arm_canona1100',
+  'arm_collie',
   'arm_integratorcp',
   'arm_raspi2',
   'arm_vexpress',
diff --git a/tests/functional/test_arm_collie.py b/tests/functional/test_arm_collie.py
new file mode 100755
index 00000000000..7e144a0a8fb
--- /dev/null
+++ b/tests/functional/test_arm_collie.py
@@ -0,0 +1,31 @@ 
+#!/usr/bin/env python3
+#
+# Functional test that boots a Linux kernel on a collie machine
+# and checks the console
+#
+# SPDX-License-Identifier: GPL-2.0-or-later
+
+from qemu_test import LinuxKernelTest, Asset
+from qemu_test.utils import archive_extract
+
+class CollieTest(LinuxKernelTest):
+
+    ASSET_ZIMAGE = Asset(
+        'https://github.com/groeck/linux-test-downloads/raw/225223f2ad7d637b34426810bf6c3b727b76a718/collie/zImage',
+        '10ace8abf9e0875ef8a83b8829cc3b5b50bc6d7bc3ca29f19f49f5673a43c13b')
+
+    ASSET_ROOTFS = Asset(
+        'https://github.com/groeck/linux-test-downloads/raw/225223f2ad7d637b34426810bf6c3b727b76a718/collie/rootfs-sa110.cpio',
+        '89ccaaa5c6b33331887047e1618ffe81b0f55909173944347d5d2426f3bcc1f2')
+
+    def test_arm_collie(self):
+        self.set_machine('collie')
+        zimage_path = self.ASSET_ZIMAGE.fetch()
+        rootfs_path = self.ASSET_ROOTFS.fetch()
+        self.vm.add_args('-append', 'rdinit=/sbin/init console=ttySA1')
+        self.launch_kernel(zimage_path,
+                           initrd=rootfs_path,
+                           wait_for='reboot: Restarting system')
+
+if __name__ == '__main__':
+    LinuxKernelTest.main()