Skip to contentSkip to conversation

oeqa/runtime/cases/rpm.py: Enable rpm install dependency testing

PATCH Superseded Yeoh Ee Peng 2 participants 4 messages May 17, 2019

v3 of 4 Superseded Latest is v4 →

lore
Share & tools
lore
#0 lore raw

PATCH v3 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.

---
 meta/lib/oeqa/runtime/cases/rpm.py | 34 ++++++++++++++++++++++++++++++++++
 1 file changed, 34 insertions(+)
meta/lib/oeqa/runtime/cases/rpm.py +34 -0
index d8cabd3..ce3fce1 100644
@@ -135,3 +135,37 @@ 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')
+        if not os.path.exists(rpmdir):
+            self.skipTest('No %s on target' % rpmdir)
+        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:
+            if not rpm_tests[rpm]:
+                self.skipTest('No %s on target' % os.path.join(rpmdir, rpm))
+            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]))
Signature · 1 line
2.7.4
#1 lore raw

PATCH v3 2/2 oeqa/manual/bsp-hw.json: Remove rpm install dependency

Remove the bsps-hw.bsps-hw.rpm_-__install_dependency_package as it was replaced by the test_rpm_install_dependency inside oeqa/runtime/cases/rpm.py.

---
 meta/lib/oeqa/manual/bsp-hw.json | 26 --------------------------
 1 file changed, 26 deletions(-)
meta/lib/oeqa/manual/bsp-hw.json +0 -26
index 4b7c76f..017de9d 100644
@@ -1,32 +1,6 @@
 [
     {
         "test": {
-            "@alias": "bsps-hw.bsps-hw.rpm_-__install_dependency_package",
-            "author": [
-                {
-                    "email": "[email protected]",
-                    "name": "[email protected]"
-                }
-            ],
-            "execution": {
-                "1": {
-                    "action": "Get a not previously installed RPM package or build one on local machine, which should have run-time dependency.For example, \"mc\" (Midnight Commander, which is a visual file manager) should depend on \"ncurses-terminfo\".   \n\n$ bitbake mc  \n\n\n",
-                    "expected_results": ""
-                },
-                "2": {
-                    "action": "Copy the package into a system folder (for example /home/root/rpm_packages).  \n\n\n",
-                    "expected_results": ""
-                },
-                "3": {
-                    "action": "Run \"rpm -ivh package_name\" and check the output, for example \"rpm -ivh mc.rpm*\" should report the dependency on \"ncurses-terminfo\".\n\n\n\n",
-                    "expected_results": "3 . rpm command should report message when some RPM installation depends on other packages."
-                }
-            },
-            "summary": "rpm_-__install_dependency_package"
-        }
-    },
-    {
-        "test": {
             "@alias": "bsps-hw.bsps-hw.boot_and_install_from_USB",
             "author": [
                 {
Signature · 1 line
2.7.4
#2 lore raw
In reply to Yeoh Ee Peng

Hi Ee Peng,

Quoted 26 lines · Yeoh Ee Peng

Convert manual testcase bsps-hw.bsps-hw.rpm_- __install_dependency_package
from oeqa/manual/bsp-hw.json to runtime automated test.

---
 meta/lib/oeqa/runtime/cases/rpm.py | 34
++++++++++++++++++++++++++++++++++
 1 file changed, 34 insertions(+)
meta/lib/oeqa/runtime/cases/rpm.py +0 -0
index d8cabd3..ce3fce1 100644
@@ -135,3 +135,37 @@ 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))

meta/lib/oeqa/runtime/cases/rpm.py +4 -0
+
+    @OETestDepends(['rpm.RpmBasicTest.test_rpm_query'])
+    def test_rpm_install_dependency(self):
+        rpmdir = os.path.join(self.tc.td['DEPLOY_DIR'], 'rpm',

'noarch')

meta/lib/oeqa/runtime/cases/rpm.py class RpmInstallRemoveTest(OERuntimeTestCase): · line 143

Quoted 2 lines
meta/lib/oeqa/runtime/cases/rpm.py +2 -0
+        if not os.path.exists(rpmdir):
+            self.skipTest('No %s on target' % rpmdir)

This message doesn't sound quite right as you're checking for rpmdir locally on the build server, not on target? Could you clarify that please?

+ if not rpm_tests[rpm]:
+ self.skipTest('No %s on target' % os.path.join(rpmdir, rpm))

The same issue here, these files are not being searched for "on target".

Cheers,

Richard

#3 lore raw

Hi Richard,

Yes, you are right, we are checking directory and package on the host server/machine.
Actually, this message was inherited from within the rpm, I had made the correction on this new patch. I shall submit another patch to correction for the message inside existing rpm test base code.

Thank you very much for your inputs.

Thanks,
Yeoh Ee Peng

-----Original Message-----
From: Richard Purdie [mailto:[email protected]]
Sent: Friday, May 17, 2019 2:02 PM
To: Yeoh, Ee Peng <[email protected]>; [email protected]
Subject: Re: [OE-core] [PATCH 1/2 v3] oeqa/runtime/cases/rpm.py: Enable rpm install dependency testing

Hi Ee Peng,

Quoted 26 lines · Yeoh Ee Peng

Convert manual testcase bsps-hw.bsps-hw.rpm_- __install_dependency_package from oeqa/manual/bsp-hw.json to runtime automated test.

---
 meta/lib/oeqa/runtime/cases/rpm.py | 34
++++++++++++++++++++++++++++++++++
 1 file changed, 34 insertions(+)
meta/lib/oeqa/runtime/cases/rpm.py +0 -0
index d8cabd3..ce3fce1 100644
@@ -135,3 +135,37 @@ 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))

meta/lib/oeqa/runtime/cases/rpm.py +4 -0
+
+    @OETestDepends(['rpm.RpmBasicTest.test_rpm_query'])
+    def test_rpm_install_dependency(self):
+        rpmdir = os.path.join(self.tc.td['DEPLOY_DIR'], 'rpm',

'noarch')

meta/lib/oeqa/runtime/cases/rpm.py class RpmInstallRemoveTest(OERuntimeTestCase): · line 143

Quoted 2 lines
meta/lib/oeqa/runtime/cases/rpm.py +2 -0
+        if not os.path.exists(rpmdir):
+            self.skipTest('No %s on target' % rpmdir)

This message doesn't sound quite right as you're checking for rpmdir locally on the build server, not on target? Could you clarify that please?

+ if not rpm_tests[rpm]:
+ self.skipTest('No %s on target' % os.path.join(rpmdir,
+ rpm))

The same issue here, these files are not being searched for "on target".

Cheers,

Richard