* [PATCH v2] tests/acceptance: Add bFLT loader linux-user test
@ 2021-02-14 19:45 Philippe Mathieu-Daudé
2021-03-09 22:27 ` Philippe Mathieu-Daudé
` (2 more replies)
0 siblings, 3 replies; 8+ messages in thread
From: Philippe Mathieu-Daudé @ 2021-02-14 19:45 UTC (permalink / raw)
To: qemu-devel
Cc: Philippe Mathieu-Daudé,
Wainer dos Santos Moschetta, Laurent Vivier, Willian Rampazzo,
qemu-arm, Cleber Rosa, Philippe Mathieu-Daudé
Add a very quick test that runs a busybox binary in bFLT format:
$ avocado --show=app run -t linux_user tests/acceptance/load_bflt.py
JOB ID : db94d5960ce564c50904d666a7e259148c27e88f
JOB LOG : ~/avocado/job-results/job-2019-06-25T10.52-db94d59/job.log
(1/1) tests/acceptance/load_bflt.py:LoadBFLT.test_stm32: PASS (0.15 s)
RESULTS : PASS 1 | ERROR 0 | FAIL 0 | SKIP 0 | WARN 0 | INTERRUPT 0 | CANCEL 0
JOB TIME : 0.54 s
Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
---
Based-on: <20210214175912.732946-1-f4bug@amsat.org>
tests/acceptance: Extract QemuBaseTest from Test
tests/acceptance: Make pick_default_qemu_bin() more generic
tests/acceptance: Introduce QemuUserTest base class
---
tests/acceptance/load_bflt.py | 51 +++++++++++++++++++++++++++++++++++
1 file changed, 51 insertions(+)
create mode 100644 tests/acceptance/load_bflt.py
diff --git a/tests/acceptance/load_bflt.py b/tests/acceptance/load_bflt.py
new file mode 100644
index 00000000000..4b7796d0775
--- /dev/null
+++ b/tests/acceptance/load_bflt.py
@@ -0,0 +1,51 @@
+# Test the bFLT format
+#
+# Copyright (C) 2019 Philippe Mathieu-Daudé <f4bug@amsat.org>
+#
+# SPDX-License-Identifier: GPL-2.0-or-later
+
+import os
+import bz2
+import subprocess
+
+from avocado_qemu import QemuUserTest
+
+
+class LoadBFLT(QemuUserTest):
+
+ def extract_cpio(self, cpio_path):
+ """
+ Extracts a cpio archive into the test workdir
+
+ :param cpio_path: path to the cpio archive
+ """
+ cwd = os.getcwd()
+ os.chdir(self.workdir)
+ with bz2.open(cpio_path, 'rb') as archive_cpio:
+ subprocess.run(['cpio', '-i'], input=archive_cpio.read(),
+ stderr=subprocess.DEVNULL)
+ os.chdir(cwd)
+
+ @skipUnless(os.getenv('AVOCADO_ALLOW_UNTRUSTED_CODE'), 'untrusted code')
+ def test_stm32(self):
+ """
+ :avocado: tags=arch:arm
+ :avocado: tags=linux_user
+ :avocado: tags=quick
+ """
+ # See https://elinux.org/STM32#User_Space
+ rootfs_url = ('https://elinux.org/images/5/51/'
+ 'Stm32_mini_rootfs.cpio.bz2')
+ rootfs_hash = '9f065e6ba40cce7411ba757f924f30fcc57951e6'
+ rootfs_path_bz2 = self.fetch_asset(rootfs_url, asset_hash=rootfs_hash)
+ busybox_path = self.workdir + "/bin/busybox"
+
+ self.extract_cpio(rootfs_path_bz2)
+
+ res = self.run(busybox_path)
+ ver = 'BusyBox v1.24.0.git (2015-02-03 22:17:13 CET) multi-call binary.'
+ self.assertIn(ver, res.stdout_text)
+
+ res = self.run(busybox_path, ['uname', '-a'])
+ unm = 'armv7l GNU/Linux'
+ self.assertIn(unm, res.stdout_text)
--
2.26.2
^ permalink raw reply related [flat|nested] 8+ messages in thread
* Re: [PATCH v2] tests/acceptance: Add bFLT loader linux-user test
2021-02-14 19:45 [PATCH v2] tests/acceptance: Add bFLT loader linux-user test Philippe Mathieu-Daudé
@ 2021-03-09 22:27 ` Philippe Mathieu-Daudé
2021-03-10 5:48 ` Thomas Huth
2021-03-10 9:14 ` Thomas Huth
2021-03-10 15:19 ` Willian Rampazzo
2 siblings, 1 reply; 8+ messages in thread
From: Philippe Mathieu-Daudé @ 2021-03-09 22:27 UTC (permalink / raw)
To: qemu-devel
Cc: Laurent Vivier, Wainer dos Santos Moschetta, Willian Rampazzo,
qemu-arm, Cleber Rosa, Philippe Mathieu-Daudé
ping?
On 2/14/21 8:45 PM, Philippe Mathieu-Daudé wrote:
> Add a very quick test that runs a busybox binary in bFLT format:
>
> $ avocado --show=app run -t linux_user tests/acceptance/load_bflt.py
> JOB ID : db94d5960ce564c50904d666a7e259148c27e88f
> JOB LOG : ~/avocado/job-results/job-2019-06-25T10.52-db94d59/job.log
> (1/1) tests/acceptance/load_bflt.py:LoadBFLT.test_stm32: PASS (0.15 s)
> RESULTS : PASS 1 | ERROR 0 | FAIL 0 | SKIP 0 | WARN 0 | INTERRUPT 0 | CANCEL 0
> JOB TIME : 0.54 s
>
> Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
> ---
> Based-on: <20210214175912.732946-1-f4bug@amsat.org>
> tests/acceptance: Extract QemuBaseTest from Test
> tests/acceptance: Make pick_default_qemu_bin() more generic
> tests/acceptance: Introduce QemuUserTest base class
> ---
> tests/acceptance/load_bflt.py | 51 +++++++++++++++++++++++++++++++++++
> 1 file changed, 51 insertions(+)
> create mode 100644 tests/acceptance/load_bflt.py
>
> diff --git a/tests/acceptance/load_bflt.py b/tests/acceptance/load_bflt.py
> new file mode 100644
> index 00000000000..4b7796d0775
> --- /dev/null
> +++ b/tests/acceptance/load_bflt.py
> @@ -0,0 +1,51 @@
> +# Test the bFLT format
> +#
> +# Copyright (C) 2019 Philippe Mathieu-Daudé <f4bug@amsat.org>
> +#
> +# SPDX-License-Identifier: GPL-2.0-or-later
> +
> +import os
> +import bz2
> +import subprocess
> +
> +from avocado_qemu import QemuUserTest
> +
> +
> +class LoadBFLT(QemuUserTest):
> +
> + def extract_cpio(self, cpio_path):
> + """
> + Extracts a cpio archive into the test workdir
> +
> + :param cpio_path: path to the cpio archive
> + """
> + cwd = os.getcwd()
> + os.chdir(self.workdir)
> + with bz2.open(cpio_path, 'rb') as archive_cpio:
> + subprocess.run(['cpio', '-i'], input=archive_cpio.read(),
> + stderr=subprocess.DEVNULL)
> + os.chdir(cwd)
> +
> + @skipUnless(os.getenv('AVOCADO_ALLOW_UNTRUSTED_CODE'), 'untrusted code')
> + def test_stm32(self):
> + """
> + :avocado: tags=arch:arm
> + :avocado: tags=linux_user
> + :avocado: tags=quick
> + """
> + # See https://elinux.org/STM32#User_Space
> + rootfs_url = ('https://elinux.org/images/5/51/'
> + 'Stm32_mini_rootfs.cpio.bz2')
> + rootfs_hash = '9f065e6ba40cce7411ba757f924f30fcc57951e6'
> + rootfs_path_bz2 = self.fetch_asset(rootfs_url, asset_hash=rootfs_hash)
> + busybox_path = self.workdir + "/bin/busybox"
> +
> + self.extract_cpio(rootfs_path_bz2)
> +
> + res = self.run(busybox_path)
> + ver = 'BusyBox v1.24.0.git (2015-02-03 22:17:13 CET) multi-call binary.'
> + self.assertIn(ver, res.stdout_text)
> +
> + res = self.run(busybox_path, ['uname', '-a'])
> + unm = 'armv7l GNU/Linux'
> + self.assertIn(unm, res.stdout_text)
>
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH v2] tests/acceptance: Add bFLT loader linux-user test
2021-03-09 22:27 ` Philippe Mathieu-Daudé
@ 2021-03-10 5:48 ` Thomas Huth
2021-03-10 9:02 ` Laurent Vivier
2021-03-16 18:51 ` Willian Rampazzo
0 siblings, 2 replies; 8+ messages in thread
From: Thomas Huth @ 2021-03-10 5:48 UTC (permalink / raw)
To: Philippe Mathieu-Daudé,
qemu-devel, Wainer dos Santos Moschetta, Willian Rampazzo,
Cleber Rosa
Cc: qemu-arm, Philippe Mathieu-Daudé, Laurent Vivier
On 09/03/2021 23.27, Philippe Mathieu-Daudé wrote:
> ping?
I guess we really need someone who could act as a maintainer for the
tests/acceptance directory, who could pick up patches and send pull requests
if nobody else is picking up these patches...
Cleber, Wainer, Willian, any volunteers?
Thomas
> On 2/14/21 8:45 PM, Philippe Mathieu-Daudé wrote:
>> Add a very quick test that runs a busybox binary in bFLT format:
>>
>> $ avocado --show=app run -t linux_user tests/acceptance/load_bflt.py
>> JOB ID : db94d5960ce564c50904d666a7e259148c27e88f
>> JOB LOG : ~/avocado/job-results/job-2019-06-25T10.52-db94d59/job.log
>> (1/1) tests/acceptance/load_bflt.py:LoadBFLT.test_stm32: PASS (0.15 s)
>> RESULTS : PASS 1 | ERROR 0 | FAIL 0 | SKIP 0 | WARN 0 | INTERRUPT 0 | CANCEL 0
>> JOB TIME : 0.54 s
>>
>> Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
>> ---
>> Based-on: <20210214175912.732946-1-f4bug@amsat.org>
>> tests/acceptance: Extract QemuBaseTest from Test
>> tests/acceptance: Make pick_default_qemu_bin() more generic
>> tests/acceptance: Introduce QemuUserTest base class
>> ---
>> tests/acceptance/load_bflt.py | 51 +++++++++++++++++++++++++++++++++++
>> 1 file changed, 51 insertions(+)
>> create mode 100644 tests/acceptance/load_bflt.py
>>
>> diff --git a/tests/acceptance/load_bflt.py b/tests/acceptance/load_bflt.py
>> new file mode 100644
>> index 00000000000..4b7796d0775
>> --- /dev/null
>> +++ b/tests/acceptance/load_bflt.py
>> @@ -0,0 +1,51 @@
>> +# Test the bFLT format
>> +#
>> +# Copyright (C) 2019 Philippe Mathieu-Daudé <f4bug@amsat.org>
>> +#
>> +# SPDX-License-Identifier: GPL-2.0-or-later
>> +
>> +import os
>> +import bz2
>> +import subprocess
>> +
>> +from avocado_qemu import QemuUserTest
>> +
>> +
>> +class LoadBFLT(QemuUserTest):
>> +
>> + def extract_cpio(self, cpio_path):
>> + """
>> + Extracts a cpio archive into the test workdir
>> +
>> + :param cpio_path: path to the cpio archive
>> + """
>> + cwd = os.getcwd()
>> + os.chdir(self.workdir)
>> + with bz2.open(cpio_path, 'rb') as archive_cpio:
>> + subprocess.run(['cpio', '-i'], input=archive_cpio.read(),
>> + stderr=subprocess.DEVNULL)
>> + os.chdir(cwd)
>> +
>> + @skipUnless(os.getenv('AVOCADO_ALLOW_UNTRUSTED_CODE'), 'untrusted code')
>> + def test_stm32(self):
>> + """
>> + :avocado: tags=arch:arm
>> + :avocado: tags=linux_user
>> + :avocado: tags=quick
>> + """
>> + # See https://elinux.org/STM32#User_Space
>> + rootfs_url = ('https://elinux.org/images/5/51/'
>> + 'Stm32_mini_rootfs.cpio.bz2')
>> + rootfs_hash = '9f065e6ba40cce7411ba757f924f30fcc57951e6'
>> + rootfs_path_bz2 = self.fetch_asset(rootfs_url, asset_hash=rootfs_hash)
>> + busybox_path = self.workdir + "/bin/busybox"
>> +
>> + self.extract_cpio(rootfs_path_bz2)
>> +
>> + res = self.run(busybox_path)
>> + ver = 'BusyBox v1.24.0.git (2015-02-03 22:17:13 CET) multi-call binary.'
>> + self.assertIn(ver, res.stdout_text)
>> +
>> + res = self.run(busybox_path, ['uname', '-a'])
>> + unm = 'armv7l GNU/Linux'
>> + self.assertIn(unm, res.stdout_text)
>>
>
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH v2] tests/acceptance: Add bFLT loader linux-user test
2021-03-10 5:48 ` Thomas Huth
@ 2021-03-10 9:02 ` Laurent Vivier
2021-03-16 18:51 ` Willian Rampazzo
1 sibling, 0 replies; 8+ messages in thread
From: Laurent Vivier @ 2021-03-10 9:02 UTC (permalink / raw)
To: Thomas Huth, Philippe Mathieu-Daudé,
qemu-devel, Wainer dos Santos Moschetta, Willian Rampazzo,
Cleber Rosa
Cc: qemu-arm, Philippe Mathieu-Daudé
Le 10/03/2021 à 06:48, Thomas Huth a écrit :
> On 09/03/2021 23.27, Philippe Mathieu-Daudé wrote:
>> ping?
>
> I guess we really need someone who could act as a maintainer for the tests/acceptance directory, who
> could pick up patches and send pull requests if nobody else is picking up these patches...
I can take this patch via trivial or linux-user, but I need at least some Reviewed-by.
Thanks,
Laurent
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH v2] tests/acceptance: Add bFLT loader linux-user test
2021-02-14 19:45 [PATCH v2] tests/acceptance: Add bFLT loader linux-user test Philippe Mathieu-Daudé
2021-03-09 22:27 ` Philippe Mathieu-Daudé
@ 2021-03-10 9:14 ` Thomas Huth
2021-03-10 9:18 ` Philippe Mathieu-Daudé
2021-03-10 15:19 ` Willian Rampazzo
2 siblings, 1 reply; 8+ messages in thread
From: Thomas Huth @ 2021-03-10 9:14 UTC (permalink / raw)
To: Philippe Mathieu-Daudé, qemu-devel
Cc: Laurent Vivier, Wainer dos Santos Moschetta, Willian Rampazzo,
qemu-arm, Cleber Rosa, Philippe Mathieu-Daudé
On 14/02/2021 20.45, Philippe Mathieu-Daudé wrote:
> Add a very quick test that runs a busybox binary in bFLT format:
>
> $ avocado --show=app run -t linux_user tests/acceptance/load_bflt.py
> JOB ID : db94d5960ce564c50904d666a7e259148c27e88f
> JOB LOG : ~/avocado/job-results/job-2019-06-25T10.52-db94d59/job.log
> (1/1) tests/acceptance/load_bflt.py:LoadBFLT.test_stm32: PASS (0.15 s)
> RESULTS : PASS 1 | ERROR 0 | FAIL 0 | SKIP 0 | WARN 0 | INTERRUPT 0 | CANCEL 0
> JOB TIME : 0.54 s
>
> Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
> ---
> Based-on: <20210214175912.732946-1-f4bug@amsat.org>
> tests/acceptance: Extract QemuBaseTest from Test
> tests/acceptance: Make pick_default_qemu_bin() more generic
> tests/acceptance: Introduce QemuUserTest base class
> ---
> tests/acceptance/load_bflt.py | 51 +++++++++++++++++++++++++++++++++++
> 1 file changed, 51 insertions(+)
> create mode 100644 tests/acceptance/load_bflt.py
>
> diff --git a/tests/acceptance/load_bflt.py b/tests/acceptance/load_bflt.py
> new file mode 100644
> index 00000000000..4b7796d0775
> --- /dev/null
> +++ b/tests/acceptance/load_bflt.py
> @@ -0,0 +1,51 @@
> +# Test the bFLT format
> +#
> +# Copyright (C) 2019 Philippe Mathieu-Daudé <f4bug@amsat.org>
> +#
> +# SPDX-License-Identifier: GPL-2.0-or-later
> +
> +import os
> +import bz2
> +import subprocess
> +
> +from avocado_qemu import QemuUserTest
> +
> +
> +class LoadBFLT(QemuUserTest):
> +
> + def extract_cpio(self, cpio_path):
> + """
> + Extracts a cpio archive into the test workdir
> +
> + :param cpio_path: path to the cpio archive
> + """
> + cwd = os.getcwd()
> + os.chdir(self.workdir)
> + with bz2.open(cpio_path, 'rb') as archive_cpio:
> + subprocess.run(['cpio', '-i'], input=archive_cpio.read(),
> + stderr=subprocess.DEVNULL)
> + os.chdir(cwd)
> +
> + @skipUnless(os.getenv('AVOCADO_ALLOW_UNTRUSTED_CODE'), 'untrusted code')
Can we assume that cpio is always available? Otherwise this needs a
skipUnless check for has_cmd('cpio' ...).
Thomas
> + def test_stm32(self):
> + """
> + :avocado: tags=arch:arm
> + :avocado: tags=linux_user
> + :avocado: tags=quick
> + """
> + # See https://elinux.org/STM32#User_Space
> + rootfs_url = ('https://elinux.org/images/5/51/'
> + 'Stm32_mini_rootfs.cpio.bz2')
> + rootfs_hash = '9f065e6ba40cce7411ba757f924f30fcc57951e6'
> + rootfs_path_bz2 = self.fetch_asset(rootfs_url, asset_hash=rootfs_hash)
> + busybox_path = self.workdir + "/bin/busybox"
> +
> + self.extract_cpio(rootfs_path_bz2)
> +
> + res = self.run(busybox_path)
> + ver = 'BusyBox v1.24.0.git (2015-02-03 22:17:13 CET) multi-call binary.'
> + self.assertIn(ver, res.stdout_text)
> +
> + res = self.run(busybox_path, ['uname', '-a'])
> + unm = 'armv7l GNU/Linux'
> + self.assertIn(unm, res.stdout_text)
>
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH v2] tests/acceptance: Add bFLT loader linux-user test
2021-03-10 9:14 ` Thomas Huth
@ 2021-03-10 9:18 ` Philippe Mathieu-Daudé
0 siblings, 0 replies; 8+ messages in thread
From: Philippe Mathieu-Daudé @ 2021-03-10 9:18 UTC (permalink / raw)
To: Thomas Huth, qemu-devel
Cc: Laurent Vivier, Wainer dos Santos Moschetta, Willian Rampazzo,
qemu-arm, Cleber Rosa, Philippe Mathieu-Daudé
On 3/10/21 10:14 AM, Thomas Huth wrote:
> On 14/02/2021 20.45, Philippe Mathieu-Daudé wrote:
>> Add a very quick test that runs a busybox binary in bFLT format:
>>
>> $ avocado --show=app run -t linux_user tests/acceptance/load_bflt.py
>> JOB ID : db94d5960ce564c50904d666a7e259148c27e88f
>> JOB LOG :
>> ~/avocado/job-results/job-2019-06-25T10.52-db94d59/job.log
>> (1/1) tests/acceptance/load_bflt.py:LoadBFLT.test_stm32: PASS
>> (0.15 s)
>> RESULTS : PASS 1 | ERROR 0 | FAIL 0 | SKIP 0 | WARN 0 |
>> INTERRUPT 0 | CANCEL 0
>> JOB TIME : 0.54 s
>>
>> Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
>> ---
>> Based-on: <20210214175912.732946-1-f4bug@amsat.org>
>> tests/acceptance: Extract QemuBaseTest from Test
>> tests/acceptance: Make pick_default_qemu_bin() more generic
>> tests/acceptance: Introduce QemuUserTest base class
>> ---
>> tests/acceptance/load_bflt.py | 51 +++++++++++++++++++++++++++++++++++
>> 1 file changed, 51 insertions(+)
>> create mode 100644 tests/acceptance/load_bflt.py
>> +class LoadBFLT(QemuUserTest):
>> +
>> + def extract_cpio(self, cpio_path):
>> + """
>> + Extracts a cpio archive into the test workdir
>> +
>> + :param cpio_path: path to the cpio archive
>> + """
>> + cwd = os.getcwd()
>> + os.chdir(self.workdir)
>> + with bz2.open(cpio_path, 'rb') as archive_cpio:
>> + subprocess.run(['cpio', '-i'], input=archive_cpio.read(),
>> + stderr=subprocess.DEVNULL)
>> + os.chdir(cwd)
>> +
>> + @skipUnless(os.getenv('AVOCADO_ALLOW_UNTRUSTED_CODE'), 'untrusted
>> code')
>
> Can we assume that cpio is always available? Otherwise this needs a
> skipUnless check for has_cmd('cpio' ...).
Good point! Thanks for having a look,
Phil.
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH v2] tests/acceptance: Add bFLT loader linux-user test
2021-02-14 19:45 [PATCH v2] tests/acceptance: Add bFLT loader linux-user test Philippe Mathieu-Daudé
2021-03-09 22:27 ` Philippe Mathieu-Daudé
2021-03-10 9:14 ` Thomas Huth
@ 2021-03-10 15:19 ` Willian Rampazzo
2 siblings, 0 replies; 8+ messages in thread
From: Willian Rampazzo @ 2021-03-10 15:19 UTC (permalink / raw)
To: Philippe Mathieu-Daudé
Cc: qemu-devel, Wainer dos Santos Moschetta, Laurent Vivier,
Willian Rampazzo, qemu-arm, Cleber Rosa,
Philippe Mathieu-Daudé
On Sun, Feb 14, 2021 at 4:45 PM Philippe Mathieu-Daudé <f4bug@amsat.org> wrote:
>
> Add a very quick test that runs a busybox binary in bFLT format:
>
> $ avocado --show=app run -t linux_user tests/acceptance/load_bflt.py
> JOB ID : db94d5960ce564c50904d666a7e259148c27e88f
> JOB LOG : ~/avocado/job-results/job-2019-06-25T10.52-db94d59/job.log
> (1/1) tests/acceptance/load_bflt.py:LoadBFLT.test_stm32: PASS (0.15 s)
> RESULTS : PASS 1 | ERROR 0 | FAIL 0 | SKIP 0 | WARN 0 | INTERRUPT 0 | CANCEL 0
> JOB TIME : 0.54 s
>
> Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
> ---
> Based-on: <20210214175912.732946-1-f4bug@amsat.org>
> tests/acceptance: Extract QemuBaseTest from Test
> tests/acceptance: Make pick_default_qemu_bin() more generic
> tests/acceptance: Introduce QemuUserTest base class
> ---
> tests/acceptance/load_bflt.py | 51 +++++++++++++++++++++++++++++++++++
> 1 file changed, 51 insertions(+)
> create mode 100644 tests/acceptance/load_bflt.py
>
Including the skipUnless on `cpio` mentioned by Thomas,
Reviewed-by: Willian Rampazzo <willianr@redhat.com>
> diff --git a/tests/acceptance/load_bflt.py b/tests/acceptance/load_bflt.py
> new file mode 100644
> index 00000000000..4b7796d0775
> --- /dev/null
> +++ b/tests/acceptance/load_bflt.py
> @@ -0,0 +1,51 @@
> +# Test the bFLT format
> +#
> +# Copyright (C) 2019 Philippe Mathieu-Daudé <f4bug@amsat.org>
> +#
> +# SPDX-License-Identifier: GPL-2.0-or-later
> +
> +import os
> +import bz2
> +import subprocess
> +
> +from avocado_qemu import QemuUserTest
> +
> +
> +class LoadBFLT(QemuUserTest):
> +
> + def extract_cpio(self, cpio_path):
> + """
> + Extracts a cpio archive into the test workdir
> +
> + :param cpio_path: path to the cpio archive
> + """
> + cwd = os.getcwd()
> + os.chdir(self.workdir)
> + with bz2.open(cpio_path, 'rb') as archive_cpio:
> + subprocess.run(['cpio', '-i'], input=archive_cpio.read(),
> + stderr=subprocess.DEVNULL)
> + os.chdir(cwd)
> +
> + @skipUnless(os.getenv('AVOCADO_ALLOW_UNTRUSTED_CODE'), 'untrusted code')
> + def test_stm32(self):
> + """
> + :avocado: tags=arch:arm
> + :avocado: tags=linux_user
> + :avocado: tags=quick
> + """
> + # See https://elinux.org/STM32#User_Space
> + rootfs_url = ('https://elinux.org/images/5/51/'
> + 'Stm32_mini_rootfs.cpio.bz2')
> + rootfs_hash = '9f065e6ba40cce7411ba757f924f30fcc57951e6'
> + rootfs_path_bz2 = self.fetch_asset(rootfs_url, asset_hash=rootfs_hash)
> + busybox_path = self.workdir + "/bin/busybox"
> +
> + self.extract_cpio(rootfs_path_bz2)
> +
> + res = self.run(busybox_path)
> + ver = 'BusyBox v1.24.0.git (2015-02-03 22:17:13 CET) multi-call binary.'
> + self.assertIn(ver, res.stdout_text)
> +
> + res = self.run(busybox_path, ['uname', '-a'])
> + unm = 'armv7l GNU/Linux'
> + self.assertIn(unm, res.stdout_text)
> --
> 2.26.2
>
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH v2] tests/acceptance: Add bFLT loader linux-user test
2021-03-10 5:48 ` Thomas Huth
2021-03-10 9:02 ` Laurent Vivier
@ 2021-03-16 18:51 ` Willian Rampazzo
1 sibling, 0 replies; 8+ messages in thread
From: Willian Rampazzo @ 2021-03-16 18:51 UTC (permalink / raw)
To: Thomas Huth
Cc: qemu-devel, Laurent Vivier, Wainer dos Santos Moschetta,
Philippe Mathieu-Daudé,
Willian Rampazzo, qemu-arm, Cleber Rosa,
Philippe Mathieu-Daudé
Hi Thomas,
Sorry for the late reply.
On Wed, Mar 10, 2021 at 2:49 AM Thomas Huth <thuth@redhat.com> wrote:
>
> On 09/03/2021 23.27, Philippe Mathieu-Daudé wrote:
> > ping?
>
> I guess we really need someone who could act as a maintainer for the
> tests/acceptance directory, who could pick up patches and send pull requests
> if nobody else is picking up these patches...
>
> Cleber, Wainer, Willian, any volunteers?
>
This is something I have discussed with Philippe some times already. I
understand the tests/acceptance directory is a gray area. I'm more
comfortable with the idea that subsystem maintainers are responsible
to send pull requests for tests related to them or, at least, ack
them. In case of a refactor or test improvement, someone else working
with testing core features could send the pull request.
I know Cleber has been sending pull requests with changes related to
the testing core (avocado_qemu) and changes related to tests
refactoring or code improvement. I would be more than happy to backup
him if needed.
Willian
> Thomas
>
>
> > On 2/14/21 8:45 PM, Philippe Mathieu-Daudé wrote:
> >> Add a very quick test that runs a busybox binary in bFLT format:
> >>
> >> $ avocado --show=app run -t linux_user tests/acceptance/load_bflt.py
> >> JOB ID : db94d5960ce564c50904d666a7e259148c27e88f
> >> JOB LOG : ~/avocado/job-results/job-2019-06-25T10.52-db94d59/job.log
> >> (1/1) tests/acceptance/load_bflt.py:LoadBFLT.test_stm32: PASS (0.15 s)
> >> RESULTS : PASS 1 | ERROR 0 | FAIL 0 | SKIP 0 | WARN 0 | INTERRUPT 0 | CANCEL 0
> >> JOB TIME : 0.54 s
> >>
> >> Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
> >> ---
> >> Based-on: <20210214175912.732946-1-f4bug@amsat.org>
> >> tests/acceptance: Extract QemuBaseTest from Test
> >> tests/acceptance: Make pick_default_qemu_bin() more generic
> >> tests/acceptance: Introduce QemuUserTest base class
> >> ---
> >> tests/acceptance/load_bflt.py | 51 +++++++++++++++++++++++++++++++++++
> >> 1 file changed, 51 insertions(+)
> >> create mode 100644 tests/acceptance/load_bflt.py
> >>
> >> diff --git a/tests/acceptance/load_bflt.py b/tests/acceptance/load_bflt.py
> >> new file mode 100644
> >> index 00000000000..4b7796d0775
> >> --- /dev/null
> >> +++ b/tests/acceptance/load_bflt.py
> >> @@ -0,0 +1,51 @@
> >> +# Test the bFLT format
> >> +#
> >> +# Copyright (C) 2019 Philippe Mathieu-Daudé <f4bug@amsat.org>
> >> +#
> >> +# SPDX-License-Identifier: GPL-2.0-or-later
> >> +
> >> +import os
> >> +import bz2
> >> +import subprocess
> >> +
> >> +from avocado_qemu import QemuUserTest
> >> +
> >> +
> >> +class LoadBFLT(QemuUserTest):
> >> +
> >> + def extract_cpio(self, cpio_path):
> >> + """
> >> + Extracts a cpio archive into the test workdir
> >> +
> >> + :param cpio_path: path to the cpio archive
> >> + """
> >> + cwd = os.getcwd()
> >> + os.chdir(self.workdir)
> >> + with bz2.open(cpio_path, 'rb') as archive_cpio:
> >> + subprocess.run(['cpio', '-i'], input=archive_cpio.read(),
> >> + stderr=subprocess.DEVNULL)
> >> + os.chdir(cwd)
> >> +
> >> + @skipUnless(os.getenv('AVOCADO_ALLOW_UNTRUSTED_CODE'), 'untrusted code')
> >> + def test_stm32(self):
> >> + """
> >> + :avocado: tags=arch:arm
> >> + :avocado: tags=linux_user
> >> + :avocado: tags=quick
> >> + """
> >> + # See https://elinux.org/STM32#User_Space
> >> + rootfs_url = ('https://elinux.org/images/5/51/'
> >> + 'Stm32_mini_rootfs.cpio.bz2')
> >> + rootfs_hash = '9f065e6ba40cce7411ba757f924f30fcc57951e6'
> >> + rootfs_path_bz2 = self.fetch_asset(rootfs_url, asset_hash=rootfs_hash)
> >> + busybox_path = self.workdir + "/bin/busybox"
> >> +
> >> + self.extract_cpio(rootfs_path_bz2)
> >> +
> >> + res = self.run(busybox_path)
> >> + ver = 'BusyBox v1.24.0.git (2015-02-03 22:17:13 CET) multi-call binary.'
> >> + self.assertIn(ver, res.stdout_text)
> >> +
> >> + res = self.run(busybox_path, ['uname', '-a'])
> >> + unm = 'armv7l GNU/Linux'
> >> + self.assertIn(unm, res.stdout_text)
> >>
> >
>
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2021-03-16 19:40 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-02-14 19:45 [PATCH v2] tests/acceptance: Add bFLT loader linux-user test Philippe Mathieu-Daudé
2021-03-09 22:27 ` Philippe Mathieu-Daudé
2021-03-10 5:48 ` Thomas Huth
2021-03-10 9:02 ` Laurent Vivier
2021-03-16 18:51 ` Willian Rampazzo
2021-03-10 9:14 ` Thomas Huth
2021-03-10 9:18 ` Philippe Mathieu-Daudé
2021-03-10 15:19 ` Willian Rampazzo
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.