All of lore.kernel.org
 help / color / mirror / Atom feed
From: Yeoh Ee Peng <ee.peng.yeoh@intel.com>
To: openembedded-core@lists.openembedded.org
Subject: [PATCH 1/2 v2] oeqa/runtime/cases/rpm.py: Enable rpm install dependency testing
Date: Thu, 16 May 2019 09:22:28 +0800	[thread overview]
Message-ID: <1557969749-80524-1-git-send-email-ee.peng.yeoh@intel.com> (raw)

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 <ee.peng.yeoh@intel.com>
---
 meta/lib/oeqa/runtime/cases/rpm.py | 30 ++++++++++++++++++++++++++++++
 1 file changed, 30 insertions(+)

diff --git a/meta/lib/oeqa/runtime/cases/rpm.py b/meta/lib/oeqa/runtime/cases/rpm.py
index d8cabd3..f71125f 100644
--- a/meta/lib/oeqa/runtime/cases/rpm.py
+++ b/meta/lib/oeqa/runtime/cases/rpm.py
@@ -135,3 +135,33 @@ 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))
+
+    @OETestDepends(['rpm.RpmBasicTest.test_rpm_query'])
+    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



             reply	other threads:[~2019-05-16  1:22 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-05-16  1:22 Yeoh Ee Peng [this message]
2019-05-16  1:22 ` [PATCH 2/2 v2] oeqa/manual/bsp-hw.json: Remove rpm install dependency Yeoh Ee Peng
2019-05-16 19:29 ` [PATCH 1/2 v2] oeqa/runtime/cases/rpm.py: Enable rpm install dependency testing Richard Purdie
2019-05-17  2:09   ` Yeoh, Ee Peng

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1557969749-80524-1-git-send-email-ee.peng.yeoh@intel.com \
    --to=ee.peng.yeoh@intel.com \
    --cc=openembedded-core@lists.openembedded.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.