[OE-core] [PATCH 1/2] oeqa/runtime/cases/rpm.py: Enable rpm install dependency testing
Convert manual testcase bsps-hw.bsps-hw.rpm_-__install_dependency_package from oeqa/manual/bsp-hw.json to runtime automated test. Signed-off-by: Yeoh Ee Peng --- meta/lib/oeqa/runtime/cases/rpm.py | 29 + 1 file changed, 29 insertions(+) diff --git a/meta/lib/oeqa/runtime/cases/rpm.py b/meta/lib/oeqa/runtime/cases/rpm.py index d8cabd3..fe1b489 100644 --- a/meta/lib/oeqa/runtime/cases/rpm.py +++ b/meta/lib/oeqa/runtime/cases/rpm.py @@ -135,3 +135,32 @@ class RpmInstallRemoveTest(OERuntimeTestCase): # Check that there's enough of them self.assertGreaterEqual(int(output), 80, 'Cound not find sufficient amount of rpm entries in /var/log/messages, found {} entries'.format(output)) + +def test_rpm_install_dependency(self): +rpmdir = os.path.join(self.tc.td['DEPLOY_DIR'], 'rpm', 'noarch') +rpm_tests = {'run-postinsts-dev': '', 'run-postinsts': ''} +rpm_pattern = 'run-postinsts-*.noarch.rpm' +for f in fnmatch.filter(os.listdir(rpmdir), rpm_pattern): +if 'run-postinsts-dev' not in f and 'run-postinsts-dbg' not in f: +rpm_tests['run-postinsts'] = f +continue +if 'run-postinsts-dev' in f: +rpm_tests['run-postinsts-dev'] = f +continue +rpm_dest_dir = '/tmp' +for rpm in rpm_tests: +self.tc.target.copyTo(os.path.join(rpmdir, rpm_tests[rpm]), os.path.join(rpm_dest_dir, rpm_tests[rpm])) +# remove existing rpm before testing install with dependency +self.tc.target.run('rpm -e %s' % 'run-postinsts-dev') +self.tc.target.run('rpm -e %s' % 'run-postinsts') +status, output = self.tc.target.run('rpm -ivh %s' % os.path.join(rpm_dest_dir, rpm_tests['run-postinsts-dev'])) +self.assertTrue(status == 1, 'rpm installed should have failed but it was getting %s' % status) +self.assertTrue('error: Failed dependencies:' in output, +'rpm installed should have failed with error but it was getting: %s' % output) +# reinstall rpm with dependency +status, output = self.tc.target.run('rpm -ivh %s' % os.path.join(rpm_dest_dir, rpm_tests['run-postinsts'])) +self.assertTrue(status == 0, 'rpm (%s) installed with error: %s (%s)' % (rpm_tests['run-postinsts'], status, output)) +status, output = self.tc.target.run('rpm -ivh %s' % os.path.join(rpm_dest_dir, rpm_tests['run-postinsts-dev'])) +self.assertTrue(status == 0, 'rpm (%s) installed with error: %s (%s)' % (rpm_tests['run-postinsts-dev'], status, output)) +for rpm in rpm_tests: +self.tc.target.run('rm -f %s' % os.path.join(rpm_dest_dir, rpm_tests[rpm])) -- 2.7.4 -- ___ Openembedded-core mailing list Openembedded-core@lists.openembedded.org http://lists.openembedded.org/mailman/listinfo/openembedded-core
Re: [OE-core] [PATCH 1/2] oeqa/runtime/cases/rpm.py: Enable rpm install dependency testing
This needs the same condition guard as other rpm tests, e.g. @OETestDepends(['rpm.RpmBasicTest.test_rpm_query']) should be enough. Alex On Wed, 15 May 2019 at 04:48, Yeoh Ee Peng wrote: > > Convert manual testcase bsps-hw.bsps-hw.rpm_-__install_dependency_package > from oeqa/manual/bsp-hw.json to runtime automated test. > > Signed-off-by: Yeoh Ee Peng > --- > meta/lib/oeqa/runtime/cases/rpm.py | 29 + > 1 file changed, 29 insertions(+) > > diff --git a/meta/lib/oeqa/runtime/cases/rpm.py > b/meta/lib/oeqa/runtime/cases/rpm.py > index d8cabd3..fe1b489 100644 > --- a/meta/lib/oeqa/runtime/cases/rpm.py > +++ b/meta/lib/oeqa/runtime/cases/rpm.py > @@ -135,3 +135,32 @@ class RpmInstallRemoveTest(OERuntimeTestCase): > # Check that there's enough of them > self.assertGreaterEqual(int(output), 80, > 'Cound not find sufficient amount of rpm > entries in /var/log/messages, found {} entries'.format(output)) > + > +def test_rpm_install_dependency(self): > +rpmdir = os.path.join(self.tc.td['DEPLOY_DIR'], 'rpm', 'noarch') > +rpm_tests = {'run-postinsts-dev': '', 'run-postinsts': ''} > +rpm_pattern = 'run-postinsts-*.noarch.rpm' > +for f in fnmatch.filter(os.listdir(rpmdir), rpm_pattern): > +if 'run-postinsts-dev' not in f and 'run-postinsts-dbg' not in f: > +rpm_tests['run-postinsts'] = f > +continue > +if 'run-postinsts-dev' in f: > +rpm_tests['run-postinsts-dev'] = f > +continue > +rpm_dest_dir = '/tmp' > +for rpm in rpm_tests: > +self.tc.target.copyTo(os.path.join(rpmdir, rpm_tests[rpm]), > os.path.join(rpm_dest_dir, rpm_tests[rpm])) > +# remove existing rpm before testing install with dependency > +self.tc.target.run('rpm -e %s' % 'run-postinsts-dev') > +self.tc.target.run('rpm -e %s' % 'run-postinsts') > +status, output = self.tc.target.run('rpm -ivh %s' % > os.path.join(rpm_dest_dir, rpm_tests['run-postinsts-dev'])) > +self.assertTrue(status == 1, 'rpm installed should have failed but > it was getting %s' % status) > +self.assertTrue('error: Failed dependencies:' in output, > +'rpm installed should have failed with error but it > was getting: %s' % output) > +# reinstall rpm with dependency > +status, output = self.tc.target.run('rpm -ivh %s' % > os.path.join(rpm_dest_dir, rpm_tests['run-postinsts'])) > +self.assertTrue(status == 0, 'rpm (%s) installed with error: %s > (%s)' % (rpm_tests['run-postinsts'], status, output)) > +status, output = self.tc.target.run('rpm -ivh %s' % > os.path.join(rpm_dest_dir, rpm_tests['run-postinsts-dev'])) > +self.assertTrue(status == 0, 'rpm (%s) installed with error: %s > (%s)' % (rpm_tests['run-postinsts-dev'], status, output)) > +for rpm in rpm_tests: > +self.tc.target.run('rm -f %s' % os.path.join(rpm_dest_dir, > rpm_tests[rpm])) > -- > 2.7.4 > > -- > ___ > Openembedded-core mailing list > Openembedded-core@lists.openembedded.org > http://lists.openembedded.org/mailman/listinfo/openembedded-core -- ___ Openembedded-core mailing list Openembedded-core@lists.openembedded.org http://lists.openembedded.org/mailman/listinfo/openembedded-core
Re: [OE-core] [PATCH 1/2] oeqa/runtime/cases/rpm.py: Enable rpm install dependency testing
On Wed, 2019-05-15 at 21:43 +0200, Alexander Kanavin wrote: > This needs the same condition guard as other rpm tests, e.g. > > @OETestDepends(['rpm.RpmBasicTest.test_rpm_query']) > > should be enough. Yes, there were failures on the autobuilder from this, e.g.: https://autobuilder.yoctoproject.org/typhoon/#/builders/45/builds/602 https://autobuilder.yoctoproject.org/typhoon/#/builders/59/builds/596 and so on. Cheers, Richard -- ___ Openembedded-core mailing list Openembedded-core@lists.openembedded.org http://lists.openembedded.org/mailman/listinfo/openembedded-core
Re: [OE-core] [PATCH 1/2] oeqa/runtime/cases/rpm.py: Enable rpm install dependency testing
Hi Richard and Alex, Thanks for the inputs! I added the OETestDepends decorator to the test case. Best regards, Yeoh Ee Peng -Original Message- From: richard.pur...@linuxfoundation.org [mailto:richard.pur...@linuxfoundation.org] Sent: Thursday, May 16, 2019 4:08 AM To: Alexander Kanavin ; Yeoh, Ee Peng Cc: OE-core Subject: Re: [OE-core] [PATCH 1/2] oeqa/runtime/cases/rpm.py: Enable rpm install dependency testing On Wed, 2019-05-15 at 21:43 +0200, Alexander Kanavin wrote: > This needs the same condition guard as other rpm tests, e.g. > > @OETestDepends(['rpm.RpmBasicTest.test_rpm_query']) > > should be enough. Yes, there were failures on the autobuilder from this, e.g.: https://autobuilder.yoctoproject.org/typhoon/#/builders/45/builds/602 https://autobuilder.yoctoproject.org/typhoon/#/builders/59/builds/596 and so on. Cheers, Richard -- ___ Openembedded-core mailing list Openembedded-core@lists.openembedded.org http://lists.openembedded.org/mailman/listinfo/openembedded-core