Skip to contentSkip to conversation

oe-pkgdata-util: Added a test to verify oe-pkgdata-util without parameters

PATCH Superseded Milan Shah 2 participants 3 messages Dec 24, 2020 – Jan 4, 2021

v2 of 3 Superseded Latest is v3 →

lore
Share & tools
lore

Milan Shah

author
#0 lore raw

PATCH v2 1/1 oe-pkgdata-util: Added a test to verify oe-pkgdata-util without parameters

A test is implemented on poky/meta/lib/oeqa/selftest/pkgdata.py to test the scenario when oe-pkgdata-util is executed without parameters and help is displayed.

See [YOCTO #10726] for detailed bug information.

---
 meta/lib/oeqa/selftest/cases/pkgdata.py | 6 ++++++
 1 file changed, 6 insertions(+)
meta/lib/oeqa/selftest/cases/pkgdata.py +6 -0
index 833a180..94ee1f5 100644
@@ -218,3 +218,9 @@ class OePkgdataUtilTests(OESelftestTestCase):
     def test_specify_pkgdatadir(self):
         result = runCmd('oe-pkgdata-util -p %s lookup-pkg zlib' % get_bb_var('PKGDATA_DIR'))
         self.assertEqual(result.output, 'libz1')
+
+    def test_no_param(self):
+        result = runCmd('oe-pkgdata-util', ignore_status=True)
+        self.assertEqual(result.status, 2, "Status different than 2. output: %s" % result.output)
+        currpos = result.output.find('usage: oe-pkgdata-util [-h] [-d] [-p PKGDATA_DIR] <subcommand>')
+        self.assertTrue(currpos != -1, msg = "Test is Failed. Help is not Displayed in %s" % result.output)
Signature · 1 line
2.7.4
#1 lore raw
Quoted 17 lines · Milan Shah

A test is implemented on poky/meta/lib/oeqa/selftest/pkgdata.py to test the scenario when oe-pkgdata-util is executed without parameters and help is displayed.

See [YOCTO #10726] for detailed bug information.

---
 meta/lib/oeqa/selftest/cases/pkgdata.py | 6 ++++++
 1 file changed, 6 insertions(+)
meta/lib/oeqa/selftest/cases/pkgdata.py +0 -0
index 833a180..94ee1f5 100644

meta/lib/oeqa/selftest/cases/pkgdata.py class OePkgdataUtilTests(OESelftestTestCase): · line 225

Quoted 8 lines
meta/lib/oeqa/selftest/cases/pkgdata.py +5 -0
@@ -218,3 +218,9 @@ class OePkgdataUtilTests(OESelftestTestCase):
     def test_specify_pkgdatadir(self):
         result = runCmd('oe-pkgdata-util -p %s lookup-pkg zlib' % get_bb_var('PKGDATA_DIR'))
         self.assertEqual(result.output, 'libz1')
+
+    def test_no_param(self):
+        result = runCmd('oe-pkgdata-util', ignore_status=True)
+        self.assertEqual(result.status, 2, "Status different than 2. output: %s" % result.output)
+        currpos = result.output.find('usage: oe-pkgdata-util [-h] [-d] [-p PKGDATA_DIR] <subcommand>')

In my opinion this is still too restrictive a test, it would need updating when any further arguments are added to the oe-pkgdata-util tool. I'd recommend just checking for "usage: oe-pkgdata-util" and ignoring the rest of the line.

Thanks,

Signature · 2 lines
Paul Barker
Konsulko Group
author
#2 lore raw

Hi Paul,

Thanks for the review. Review comments are addressed and the new Patch
<https://lists.openembedded.org/g/openembedded-core/topic/patch_v3_oe_pkgdata_util/79418977?p=,,,20,0,0,0::recentpostdate%2Fsticky,,,20,2,0,79418977>
is sent again for review.

-----------------------
Thanks & Regards,
*Milan Shah*
MontaVista Software, Bangalore, India

Quoted 42 lines · Paul Barker
Quoted 5 lines · Milan Shah

A test is implemented on poky/meta/lib/oeqa/selftest/pkgdata.py to test the scenario when oe-pkgdata-util is executed without parameters and help is displayed.

Review

Quoted 8 lines

See [YOCTO #10726] for detailed bug information.

---
 meta/lib/oeqa/selftest/cases/pkgdata.py | 6 ++++++
 1 file changed, 6 insertions(+)
(quoted diff) +0 -0

b/meta/lib/oeqa/selftest/cases/pkgdata.py

meta/lib/oeqa/selftest/cases/pkgdata.py class OePkgdataUtilTests(OESelftestTestCase): · line 219

Quoted 6 lines

index 833a180..94ee1f5 100644

meta/lib/oeqa/selftest/cases/pkgdata.py +0 -0
@@ -218,3 +218,9 @@ class OePkgdataUtilTests(OESelftestTestCase):
     def test_specify_pkgdatadir(self):
         result = runCmd('oe-pkgdata-util -p %s lookup-pkg zlib' %

get_bb_var('PKGDATA_DIR'))

meta/lib/oeqa/selftest/cases/pkgdata.py class OePkgdataUtilTests(OESelftestTestCase):

Quoted 5 lines
meta/lib/oeqa/selftest/cases/pkgdata.py +4 -0
         self.assertEqual(result.output, 'libz1')
+
+    def test_no_param(self):
+        result = runCmd('oe-pkgdata-util', ignore_status=True)
+        self.assertEqual(result.status, 2, "Status different than 2.

output: %s" % result.output)

meta/lib/oeqa/selftest/cases/pkgdata.py class OePkgdataUtilTests(OESelftestTestCase): · line 225

Quoted 1 line
meta/lib/oeqa/selftest/cases/pkgdata.py +1 -0
+        currpos = result.output.find('usage: oe-pkgdata-util [-h] [-d]

[-p PKGDATA_DIR] <subcommand>')

In my opinion this is still too restrictive a test, it would need updating when any further arguments are added to the oe-pkgdata-util tool. I'd recommend just checking for "usage: oe-pkgdata-util" and ignoring the rest of the line.

Thanks,

--
Paul Barker
Konsulko Group