[OE-core] [PATCH 1/1] oeqa/runtime/cases/rpm.py: change to use base-passwd-doc

ChenQi Qi.Chen at windriver.com
Thu Jun 14 09:31:45 UTC 2018


Hi Alex,

In short, it's about setUpClass.
See details below.

In fact, if rpm is not installed, these test cases have been skipped.

See codes below from rpm.py:

     @OETestID(960)
     @OEHasPackage(['rpm'])
     @OETestDepends(['ssh.SSHTest.test_ssh'])
     def test_rpm_help(self):
         status, output = self.target.run('rpm --help')
         msg = 'status and output: %s and %s' % (status, output)
         self.assertEqual(status, 0, msg=msg)

     @OETestID(192)
     @OETestDepends(['rpm.RpmBasicTest.test_rpm_help'])
     def test_rpm_install(self):
         status, output = self.target.run('rpm -ivh 
/tmp/base-passwd-doc.rpm')
         msg = 'Failed to install base-passwd-doc package: %s' % output
         self.assertEqual(status, 0, msg=msg)

You can see that if 'rpm' is not installed on target, the test cases are 
skipped.
The '@skipIfNotFeature' decorator you suggested will achieve the same 
effect that the above logic has already achieved.

The key problem here is that the copying action happens in setUpClass().
Even if the testcase is determined to be skipped via the decorator 
logic, this setUpClass function will still be called.

For the current OEQA's runtime testing design, we need to ensure 
setUpClass do not generate 'error'.

For the problem I described in this email, the simplest approach I see 
here is to change rpm-doc to base-passwd-doc.
Another apporach is to check whether 'rpm' is installed in setUpClass() 
function and if not skip. But this is more complex and kind of weird as 
we've checked it via @HasPackage and the test cases dependencies are 
correct.

You can do a quick test with the following configuration to reproduce 
the problem.
local.conf:
IMAGE_INSTALL_append = " openssh"
TEST_IMAGE = "1"
TEST_SUITES = "auto"

bitbake core-image-minimal

Best Regards,
Chen Qi


On 06/14/2018 04:55 PM, Alexander Kanavin wrote:
> Hello Chen,
>
> But the test still attempts to run rpm on the target. I can't
> understand how target rpm can be available on the image, but at the
> same time target rpm-doc package is not available in rpm deploy dir.
>
> The issue is probably that the test should simply be skipped (in the
> same way that dnf testcases are skipped - please refer to them), if
> there is no package management on target? Like this:
>
>      @skipIfNotFeature('package-management',
>                        'Test requires package-management to be in
> IMAGE_FEATURES')
>
>
> Alex
>
> 2018-06-14 10:29 GMT+03:00 ChenQi <Qi.Chen at windriver.com>:
>> On 06/14/2018 02:57 PM, Alexander Kanavin wrote:
>>> 2018-06-14 7:52 GMT+03:00 Chen Qi <Qi.Chen at windriver.com>:
>>>> The test cases assume that rpm-doc is built out, as it says it its
>>>> comment. This is not always true. And it sometimes results in
>>>> following error.
>>>>
>>>>     |     cls.tc.target.copyTo(test_file, dst)
>>>>     | UnboundLocalError: local variable 'test_file' referenced before
>>>> assignment
>>> Wait, you need to explain this further. What is the situation when it
>>> isn't true?
>>>
>>> Alex
>>>
>> Hi Alex,
>>
>> For any image that does not have rpm installed, rpm package is not likely to
>> be built out.
>> Having PACKAGE_CLASSES set to "package_rpm" will only ensure rpm-native to
>> be built out.
>>
>> Best Regards,
>> Chen Qi





More information about the Openembedded-core mailing list