[PATCH 08/26] tests/acceptance: Introduce LinuxUserTest base class

Philippe Mathieu-Daudé posted 26 patches 6 years, 3 months ago
Maintainers: Aleksandar Rikalo <aleksandar.rikalo@rt-rk.com>, "Alex Bennée" <alex.bennee@linaro.org>, "Philippe Mathieu-Daudé" <philmd@redhat.com>, Fam Zheng <fam@euphon.net>, Kamil Rytarowski <kamil@netbsd.org>, Aurelien Jarno <aurelien@aurel32.net>, Fabien Chouteau <chouteau@adacore.com>, KONRAD Frederic <frederic.konrad@adacore.com>
[PATCH 08/26] tests/acceptance: Introduce LinuxUserTest base class
Posted by Philippe Mathieu-Daudé 6 years, 3 months ago
Similarly to the MachineTest base class, this class contains
methods common to linux-user tests.

Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
---
 tests/acceptance/avocado_qemu/__init__.py | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/tests/acceptance/avocado_qemu/__init__.py b/tests/acceptance/avocado_qemu/__init__.py
index d23681818d..2611a5146c 100644
--- a/tests/acceptance/avocado_qemu/__init__.py
+++ b/tests/acceptance/avocado_qemu/__init__.py
@@ -14,6 +14,7 @@ import sys
 import uuid
 
 import avocado
+from avocado.utils import process
 
 SRC_ROOT_DIR = os.path.join(os.path.dirname(__file__), '..', '..', '..')
 sys.path.append(os.path.join(SRC_ROOT_DIR, 'python'))
@@ -138,3 +139,11 @@ class MachineTest(Test):
     def tearDown(self):
         for vm in self._vms.values():
             vm.shutdown()
+
+
+class LinuxUserTest(Test):
+    def setUp(self):
+        self.base_setUp("%s-linux-user", "qemu-%s")
+
+    def run(self, cmd):
+        return process.run("%s %s" % (self.qemu_bin, cmd))
-- 
2.21.0


Re: [PATCH 08/26] tests/acceptance: Introduce LinuxUserTest base class
Posted by Philippe Mathieu-Daudé 6 years, 2 months ago
Laurent, you weren't Cc'ed on this series, you might find it helpful to 
test linux-user code. The next patch (09/26 Add bFLT loader linux-user 
test) is provided as an example, and tests a STM32 BusyBox.

On 10/28/19 8:34 AM, Philippe Mathieu-Daudé wrote:
> Similarly to the MachineTest base class, this class contains
> methods common to linux-user tests.
> 
> Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
> ---
>   tests/acceptance/avocado_qemu/__init__.py | 9 +++++++++
>   1 file changed, 9 insertions(+)
> 
> diff --git a/tests/acceptance/avocado_qemu/__init__.py b/tests/acceptance/avocado_qemu/__init__.py
> index d23681818d..2611a5146c 100644
> --- a/tests/acceptance/avocado_qemu/__init__.py
> +++ b/tests/acceptance/avocado_qemu/__init__.py
> @@ -14,6 +14,7 @@ import sys
>   import uuid
>   
>   import avocado
> +from avocado.utils import process
>   
>   SRC_ROOT_DIR = os.path.join(os.path.dirname(__file__), '..', '..', '..')
>   sys.path.append(os.path.join(SRC_ROOT_DIR, 'python'))
> @@ -138,3 +139,11 @@ class MachineTest(Test):
>       def tearDown(self):
>           for vm in self._vms.values():
>               vm.shutdown()
> +
> +
> +class LinuxUserTest(Test):
> +    def setUp(self):
> +        self.base_setUp("%s-linux-user", "qemu-%s")
> +
> +    def run(self, cmd):
> +        return process.run("%s %s" % (self.qemu_bin, cmd))
>