qemu-arm
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH v2] tests/acceptance: Add bFLT loader linux-user test


From: Philippe Mathieu-Daudé
Subject: Re: [PATCH v2] tests/acceptance: Add bFLT loader linux-user test
Date: Wed, 10 Mar 2021 10:18:02 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.7.0

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.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]