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é <[email protected]>
>> ---
>> Based-on: <[email protected]>
>> 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.