On 03/01/2018 04:11 AM, Yeoh Ee Peng wrote:
Add runtime test for dpkg to test that it can install deb
package from remote source.

Signed-off-by: Yeoh Ee Peng <ee.peng.y...@intel.com>
---
  meta/lib/oeqa/runtime/cases/dpkg.py | 47 +++++++++++++++++++++++++++++++++++++
  1 file changed, 47 insertions(+)
  create mode 100644 meta/lib/oeqa/runtime/cases/dpkg.py

diff --git a/meta/lib/oeqa/runtime/cases/dpkg.py 
b/meta/lib/oeqa/runtime/cases/dpkg.py
new file mode 100644
index 0000000..adf5195
--- /dev/null
+++ b/meta/lib/oeqa/runtime/cases/dpkg.py
@@ -0,0 +1,47 @@
+import os
+from oeqa.utils.httpserver import HTTPService
+from oeqa.runtime.case import OERuntimeTestCase
+from oeqa.core.decorator.data import skipIfNotDataVar, skipIfNotFeature
+from oeqa.runtime.decorator.package import OEHasPackage
+
+class DpkgTest(OERuntimeTestCase):
+
+    def pkg(self, command, expected = 0):
+        command = 'apt-get %s' % command
+        status, output = self.target.run(command, 1500)
+        message = os.linesep.join([command, output])
+        self.assertEqual(status, expected, message)
+        return output

This is testing apt, not dpkg. So the file name and the testcases/class names should be renamed accoridngly.


+    def test_dpkg_install_from_repo(self):
+        self.setup_source_config_for_package_install()
+        self.pkg('update')
+        self.pkg('remove --yes run-postinsts-dev')
+        self.pkg('install --yes --allow-unauthenticated run-postinsts-dev')
+        self.cleanup_source_config_for_package_install()

That's a good start, but apt can do more, right? Play with its various utilities (apt-get, apt-cache, etc.) on the command line. What kind of features it has? Can those be tested automatically? Should they be tested?

Also, before you do advanced package installation/removal, it's good to run a few sanity checks. Check that apt is able to print a help message without crashing, that it can list installed and available packages and so on. You can look at dnf test cases for examples.

And same applies to opkg test cases as well.

Regards,
Alex
--
_______________________________________________
Openembedded-core mailing list
Openembedded-core@lists.openembedded.org
http://lists.openembedded.org/mailman/listinfo/openembedded-core

Reply via email to