Skip to contentSkip to conversation

tests/acceptance: Add a test for the canon-a1100 machine

PATCH Superseded Thomas Huth 3 participants 9 messages Jan 27, 2020 – Jan 28, 2020

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 tests/acceptance: Add a test for the canon-a1100 machine

The canon-a1100 machine can be used with the Barebox firmware. The QEMU Advent Calendar 2018 features a pre-compiled image which we can use for testing.

---
 tests/acceptance/machine_arm_canon-a1100.py | 33 +++++++++++++++++++++
 1 file changed, 33 insertions(+)
 create mode 100644 tests/acceptance/machine_arm_canon-a1100.py
tests/acceptance/machine_arm_canon-a1100.py new file +33 -0
new file mode 100644
index 0000000000..3888168451
@@ -0,0 +1,33 @@
+# Functional test that boots the canon-a1100 machine with firmware
+#
+# Copyright (c) 2020 Red Hat, Inc.
+#
+# Author:
+#  Thomas Huth <[email protected]>
+#
+# This work is licensed under the terms of the GNU GPL, version 2 or
+# later.  See the COPYING file in the top-level directory.
+
+from avocado_qemu import Test
+from avocado_qemu import wait_for_console_pattern
+from avocado.utils import archive
+
+class CanonA1100Machine(Test):
+
+    timeout = 90
+
+    def test_arm_canona1100(self):
+        """
+        :avocado: tags=arch:arm
+        :avocado: tags=machine:canon-a1100
+        """
+        tar_url = ('https://www.qemu-advent-calendar.org'
+                   '/2018/download/day18.tar.xz')
+        tar_hash = '068b5fc4242b29381acee94713509f8a876e9db6'
+        file_path = self.fetch_asset(tar_url, asset_hash=tar_hash)
+        archive.extract(file_path, self.workdir)
+        self.vm.set_console()
+        self.vm.add_args('-bios',
+                         self.workdir + '/day18/barebox.canon-a1100.bin')
+        self.vm.launch()
+        wait_for_console_pattern(self, 'running /env/bin/init')
Signature · 1 line
2.18.1
Reviewed-by Tested-by on v1 1/1
#1 lore raw
Quoted 28 lines · Thomas Huth

The canon-a1100 machine can be used with the Barebox firmware. The QEMU Advent Calendar 2018 features a pre-compiled image which we can use for testing.

---
  tests/acceptance/machine_arm_canon-a1100.py | 33 +++++++++++++++++++++
  1 file changed, 33 insertions(+)

create mode 100644 tests/acceptance/machine_arm_canon-a1100.py

tests/acceptance/machine_arm_canon-a1100.py new file +12 -0
new file mode 100644
index 0000000000..3888168451
@@ -0,0 +1,33 @@
+# Functional test that boots the canon-a1100 machine with firmware
+#
+# Copyright (c) 2020 Red Hat, Inc.
+#
+# Author:
+#  Thomas Huth <[email protected]>
+#
+# This work is licensed under the terms of the GNU GPL, version 2 or
+# later.  See the COPYING file in the top-level directory.
+
+from avocado_qemu import Test
+from avocado_qemu import wait_for_console_pattern

tests/acceptance/machine_arm_canon-a1100.py line 22

Quoted 10 lines
tests/acceptance/machine_arm_canon-a1100.py new file +10 -0
+from avocado.utils import archive
+
+class CanonA1100Machine(Test):
+
+    timeout = 90
+
+    def test_arm_canona1100(self):
+        """
+        :avocado: tags=arch:arm
+        :avocado: tags=machine:canon-a1100

To the maintainer taking this, please add:

:avocado: tags=pflash_cfi02

console: Switch to console [cs0]
console: barebox 2017.02.0 #2 Mon Nov 12 09:28:33 CET 2018
console: Board: Canon PowerShot A1100 IS
console: digic-gpio c0220000.gpio: probed gpiochip-1 with base 0
console: cfi_flash f8000000.flash: found cfi flash at 0xf8000000, size 4 MiB
console: malloc space: 0x00100000 -> 0x002fffff (size 2 MiB)
console: environment load /dev/env0: No such file or directory
console: Maybe you have to create the partition.
console: running /env/bin/init...
PASS (1.86 s)

Quoted 12 lines
tests/acceptance/machine_arm_canon-a1100.py new file +11 -0
+        """
+        tar_url = ('https://www.qemu-advent-calendar.org'
+                   '/2018/download/day18.tar.xz')
+        tar_hash = '068b5fc4242b29381acee94713509f8a876e9db6'
+        file_path = self.fetch_asset(tar_url, asset_hash=tar_hash)
+        archive.extract(file_path, self.workdir)
+        self.vm.set_console()
+        self.vm.add_args('-bios',
+                         self.workdir + '/day18/barebox.canon-a1100.bin')
+        self.vm.launch()
+        wait_for_console_pattern(self, 'running /env/bin/init')
#2 lore raw
Quoted 43 lines · Philippe Mathieu-Daudé
Quoted 29 lines · Thomas Huth

The canon-a1100 machine can be used with the Barebox firmware. The QEMU Advent Calendar 2018 features a pre-compiled image which we can use for testing.

---
  tests/acceptance/machine_arm_canon-a1100.py | 33 +++++++++++++++++++++

  1 file changed, 33 insertions(+)

  create mode 100644 tests/acceptance/machine_arm_canon-a1100.py

tests/acceptance/machine_arm_canon-a1100.py new file +12 -0
new file mode 100644
index 0000000000..3888168451
@@ -0,0 +1,33 @@
+# Functional test that boots the canon-a1100 machine with firmware
+#
+# Copyright (c) 2020 Red Hat, Inc.
+#
+# Author:
+#  Thomas Huth <[email protected]>
+#
+# This work is licensed under the terms of the GNU GPL, version 2 or
+# later.  See the COPYING file in the top-level directory.
+
+from avocado_qemu import Test
+from avocado_qemu import wait_for_console_pattern

tests/acceptance/machine_arm_canon-a1100.py line 22

Quoted 10 lines
tests/acceptance/machine_arm_canon-a1100.py new file +10 -0
+from avocado.utils import archive
+
+class CanonA1100Machine(Test):
+
+    timeout = 90
+
+    def test_arm_canona1100(self):
+        """
+        :avocado: tags=arch:arm
+        :avocado: tags=machine:canon-a1100

To the maintainer taking this, please add:

Quoted 1 line

           :avocado: tags=pflash_cfi02

Should there be a "device:" between the "=" and the device name? At least I can see some other files using "device:" for similar tags...

Thomas

#3 lore raw
Quoted 44 lines · Thomas Huth
Quoted 43 lines · Philippe Mathieu-Daudé
Quoted 29 lines · Thomas Huth

The canon-a1100 machine can be used with the Barebox firmware. The QEMU Advent Calendar 2018 features a pre-compiled image which we can use for testing.

---
   tests/acceptance/machine_arm_canon-a1100.py | 33 +++++++++++++++++++++
   1 file changed, 33 insertions(+)

  create mode 100644 tests/acceptance/machine_arm_canon-a1100.py

tests/acceptance/machine_arm_canon-a1100.py new file +12 -0
new file mode 100644
index 0000000000..3888168451
@@ -0,0 +1,33 @@
+# Functional test that boots the canon-a1100 machine with firmware
+#
+# Copyright (c) 2020 Red Hat, Inc.
+#
+# Author:
+#  Thomas Huth <[email protected]>
+#
+# This work is licensed under the terms of the GNU GPL, version 2 or
+# later.  See the COPYING file in the top-level directory.
+
+from avocado_qemu import Test
+from avocado_qemu import wait_for_console_pattern

tests/acceptance/machine_arm_canon-a1100.py line 22

Quoted 10 lines
tests/acceptance/machine_arm_canon-a1100.py new file +10 -0
+from avocado.utils import archive
+
+class CanonA1100Machine(Test):
+
+    timeout = 90
+
+    def test_arm_canona1100(self):
+        """
+        :avocado: tags=arch:arm
+        :avocado: tags=machine:canon-a1100

To the maintainer taking this, please add:

Quoted 4 lines
Quoted 1 line

           :avocado: tags=pflash_cfi02

Should there be a "device:" between the "=" and the device name? At least I can see some other files using "device:" for similar tags...

Ah yes you are right, it is clearer.

#4 lore raw
Quoted 11 lines · Philippe Mathieu-Daudé
Quoted 10 lines · Thomas Huth
Quoted 9 lines · Philippe Mathieu-Daudé
Quoted 8 lines · Thomas Huth

The canon-a1100 machine can be used with the Barebox firmware. The QEMU Advent Calendar 2018 features a pre-compiled image which we can use for testing.

---
   tests/acceptance/machine_arm_canon-a1100.py | 33
+++++++++++++++++++++

What is the reason for not adding this case in boot_linux_console suite?

Quoted 35 lines
Quoted 35 lines
Quoted 35 lines
Quoted 22 lines
   1 file changed, 33 insertions(+)

   create mode 100644 tests/acceptance/machine_arm_canon-a1100.py

tests/acceptance/machine_arm_canon-a1100.py new file +12 -0
new file mode 100644
index 0000000000..3888168451
@@ -0,0 +1,33 @@
+# Functional test that boots the canon-a1100 machine with firmware
+#
+# Copyright (c) 2020 Red Hat, Inc.
+#
+# Author:
+#  Thomas Huth <[email protected]>
+#
+# This work is licensed under the terms of the GNU GPL, version 2 or
+# later.  See the COPYING file in the top-level directory.
+
+from avocado_qemu import Test
+from avocado_qemu import wait_for_console_pattern

tests/acceptance/machine_arm_canon-a1100.py line 22

Quoted 10 lines
tests/acceptance/machine_arm_canon-a1100.py new file +10 -0
+from avocado.utils import archive
+
+class CanonA1100Machine(Test):
+
+    timeout = 90
+
+    def test_arm_canona1100(self):
+        """
+        :avocado: tags=arch:arm
+        :avocado: tags=machine:canon-a1100

To the maintainer taking this, please add:

Quoted 6 lines
Quoted 4 lines
Quoted 1 line

            :avocado: tags=pflash_cfi02

Should there be a "device:" between the "=" and the device name? At least I can see some other files using "device:" for similar tags...

Ah yes you are right, it is clearer.

Notice that avocado_qemu won't automatically convert that tag into QEMU's -device option, If that is the intention...

Thanks!

- Wainer

Quoted 2 lines
#5 lore raw

Hey Wainer,

Quoted 8 lines · Wainer dos Santos Moschetta
Quoted 7 lines · Philippe Mathieu-Daudé
Quoted 6 lines · Thomas Huth
Quoted 5 lines · Philippe Mathieu-Daudé
Quoted 4 lines · Thomas Huth

The canon-a1100 machine can be used with the Barebox firmware. The QEMU Advent Calendar 2018 features a pre-compiled image which we can use for testing.

Quoted 7 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines

---
   tests/acceptance/machine_arm_canon-a1100.py | 33
+++++++++++++++++++++

What is the reason for not adding this case in boot_linux_console suite?

Because there are too many tests in this file and it became hardly maintainable. Also it is easier to add a 'F:' entry in the MAINTAINERS file to each machine section.

Quoted 37 lines
Quoted 37 lines
Quoted 37 lines
Quoted 36 lines
Quoted 22 lines
   1 file changed, 33 insertions(+)

   create mode 100644 tests/acceptance/machine_arm_canon-a1100.py

tests/acceptance/machine_arm_canon-a1100.py new file +12 -0
new file mode 100644
index 0000000000..3888168451
@@ -0,0 +1,33 @@
+# Functional test that boots the canon-a1100 machine with firmware
+#
+# Copyright (c) 2020 Red Hat, Inc.
+#
+# Author:
+#  Thomas Huth <[email protected]>
+#
+# This work is licensed under the terms of the GNU GPL, version 2 or
+# later.  See the COPYING file in the top-level directory.
+
+from avocado_qemu import Test
+from avocado_qemu import wait_for_console_pattern

tests/acceptance/machine_arm_canon-a1100.py line 22

Quoted 10 lines
tests/acceptance/machine_arm_canon-a1100.py new file +10 -0
+from avocado.utils import archive
+
+class CanonA1100Machine(Test):
+
+    timeout = 90
+
+    def test_arm_canona1100(self):
+        """
+        :avocado: tags=arch:arm
+        :avocado: tags=machine:canon-a1100

To the maintainer taking this, please add:

            :avocado: tags=pflash_cfi02

Quoted 7 lines
Quoted 4 lines
Quoted 2 lines

Should there be a "device:" between the "=" and the device name? At least I can see some other files using "device:" for similar tags...

Ah yes you are right, it is clearer.

Notice that avocado_qemu won't automatically convert that tag into QEMU's -device option, If that is the intention...

That could be useful, but currently my usage is 'avocado run -t device:pcnet32' to run all tests using the pcnet32 network device.

I have pflash tests which I plan to use the same way.

This is a hint to other maintainers, who don't have to look at each test to find the set of tests that suits them.

IOW "As a maintainer of the device:pflash I'm interested to run all tests using this device, and while they pass I won't look at them".

(This is how I expect maintainers to use the acceptance tests when I add some).

#6 lore raw
Quoted 17 lines · Philippe Mathieu-Daudé

Hey Wainer,

Quoted 14 lines · Wainer dos Santos Moschetta
Quoted 11 lines · Philippe Mathieu-Daudé
Quoted 10 lines · Thomas Huth
Quoted 9 lines · Philippe Mathieu-Daudé
Quoted 8 lines · Thomas Huth

The canon-a1100 machine can be used with the Barebox firmware. The QEMU Advent Calendar 2018 features a pre-compiled image which we can use for testing.

---
   tests/acceptance/machine_arm_canon-a1100.py | 33
+++++++++++++++++++++

Quoted 5 lines
Quoted 1 line

What is the reason for not adding this case in boot_linux_console suite?

Because there are too many tests in this file and it became hardly maintainable. Also it is easier to add a 'F:' entry in the MAINTAINERS file to each machine section.

Additionally, this is not a test with a Linux kernel, it uses the Barebox firmware instead. So boot_*linux*_console.py sounds like the wrong place for this test.

Thomas

Reviewed-by Tested-by
#7 lore raw
Quoted 17 lines · Thomas Huth
Quoted 16 lines · Philippe Mathieu-Daudé

Hey Wainer,

Quoted 13 lines · Wainer dos Santos Moschetta
Quoted 11 lines · Philippe Mathieu-Daudé
Quoted 10 lines · Thomas Huth
Quoted 9 lines · Philippe Mathieu-Daudé
Quoted 8 lines · Thomas Huth

The canon-a1100 machine can be used with the Barebox firmware. The QEMU Advent Calendar 2018 features a pre-compiled image which we can use for testing.

---
    tests/acceptance/machine_arm_canon-a1100.py | 33

+++++++++++++++++++++

Quoted 4 lines
Quoted 4 lines
Quoted 1 line

What is the reason for not adding this case in boot_linux_console suite?

Because there are too many tests in this file and it became hardly maintainable. Also it is easier to add a 'F:' entry in the MAINTAINERS file to each machine section.

Maybe it reached an inflection point and deserves to be split among files and directories...

Quoted 3 lines

Additionally, this is not a test with a Linux kernel, it uses the Barebox firmware instead. So boot_*linux*_console.py sounds like the wrong place for this test.

OK, makes complete sense.

One last comment about this new file. To not look like boring I let pylint say that for me :) :

[wainersm@localhost qemu]$ pylint-3 tests/acceptance/machine_arm_canon-a1100.py
************* Module machine_arm_canon-a1100
tests/acceptance/machine_arm_canon-a1100.py:1:0: C0103: Module name "machine_arm_canon-a1100" doesn't conform to snake_case naming style (invalid-name)

With that fix:

Thanks,

Wainer

Quoted 2 lines

Thomas

#8 lore raw
In reply to Philippe Mathieu-Daudé
Quoted 69 lines · Philippe Mathieu-Daudé

Hey Wainer,

Quoted 8 lines · Wainer dos Santos Moschetta
Quoted 7 lines · Philippe Mathieu-Daudé
Quoted 6 lines · Thomas Huth
Quoted 5 lines · Philippe Mathieu-Daudé
Quoted 4 lines · Thomas Huth

The canon-a1100 machine can be used with the Barebox firmware. The QEMU Advent Calendar 2018 features a pre-compiled image which we can use for testing.

Quoted 7 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines

---
   tests/acceptance/machine_arm_canon-a1100.py | 33
+++++++++++++++++++++

What is the reason for not adding this case in boot_linux_console suite?

Because there are too many tests in this file and it became hardly maintainable. Also it is easier to add a 'F:' entry in the MAINTAINERS file to each machine section.

Quoted 38 lines
Quoted 38 lines
Quoted 38 lines
Quoted 37 lines
Quoted 23 lines
   1 file changed, 33 insertions(+)

   create mode 100644 tests/acceptance/machine_arm_canon-a1100.py

tests/acceptance/machine_arm_canon-a1100.py new file +8 -0
new file mode 100644
index 0000000000..3888168451
@@ -0,0 +1,33 @@
+# Functional test that boots the canon-a1100 machine with firmware
+#
+# Copyright (c) 2020 Red Hat, Inc.
+#
+# Author:
+#  Thomas Huth <[email protected]>
+#
+# This work is licensed under the terms of the GNU GPL, version 

2 or

tests/acceptance/machine_arm_canon-a1100.py new file +4 -0
+# later.  See the COPYING file in the top-level directory.
+
+from avocado_qemu import Test
+from avocado_qemu import wait_for_console_pattern

tests/acceptance/machine_arm_canon-a1100.py line 22

Quoted 10 lines
tests/acceptance/machine_arm_canon-a1100.py new file +10 -0
+from avocado.utils import archive
+
+class CanonA1100Machine(Test):
+
+    timeout = 90
+
+    def test_arm_canona1100(self):
+        """
+        :avocado: tags=arch:arm
+        :avocado: tags=machine:canon-a1100

To the maintainer taking this, please add:

            :avocado: tags=pflash_cfi02

Quoted 7 lines
Quoted 4 lines
Quoted 2 lines

Should there be a "device:" between the "=" and the device name? At least I can see some other files using "device:" for similar tags...

Ah yes you are right, it is clearer.

Notice that avocado_qemu won't automatically convert that tag into QEMU's -device option, If that is the intention...

That could be useful, but currently my usage is 'avocado run -t device:pcnet32' to run all tests using the pcnet32 network device.

Quoted 7 lines

I have pflash tests which I plan to use the same way.

This is a hint to other maintainers, who don't have to look at each test to find the set of tests that suits them.

IOW "As a maintainer of the device:pflash I'm interested to run all tests using this device, and while they pass I won't look at them".

(This is how I expect maintainers to use the acceptance tests when I add some).

OK, understood. Thanks for sharing your usage of acceptance tests!

- Wainer