* [PATCH] oeqa/runtime/dpkg.py: add runtime test for dpkg
@ 2018-03-01 2:11 Yeoh Ee Peng
2018-03-01 2:11 ` [PATCH] oeqa/runtime/opkg.py: add runtime test for opkg Yeoh Ee Peng
2018-03-01 10:22 ` [PATCH] oeqa/runtime/dpkg.py: add runtime test for dpkg Alexander Kanavin
0 siblings, 2 replies; 3+ messages in thread
From: Yeoh Ee Peng @ 2018-03-01 2:11 UTC (permalink / raw)
To: openembedded-core
Add runtime test for dpkg to test that it can install deb
package from remote source.
Signed-off-by: Yeoh Ee Peng <ee.peng.yeoh@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
+
+class DpkgRepoTest(DpkgTest):
+
+ @classmethod
+ def setUpClass(cls):
+ service_repo = os.path.join(cls.tc.td['DEPLOY_DIR_DEB'], 'all')
+ cls.repo_server = HTTPService(service_repo, cls.tc.target.server_ip)
+ cls.repo_server.start()
+
+ @classmethod
+ def tearDownClass(cls):
+ cls.repo_server.stop()
+
+ def setup_source_config_for_package_install(self):
+ apt_get_source_server = 'http://%s:%s/' % (self.tc.target.server_ip, self.repo_server.port)
+ apt_get_sourceslist_dir = '/etc/apt/'
+ self.target.run('cd %s; echo deb %s ./ > sources.list' % (apt_get_sourceslist_dir, apt_get_source_server))
+
+ def cleanup_source_config_for_package_install(self):
+ apt_get_sourceslist_dir = '/etc/apt/'
+ self.target.run('cd %s; rm sources.list' % (apt_get_sourceslist_dir))
+
+ @skipIfNotFeature('package-management',
+ 'Test requires package-management to be in IMAGE_FEATURES')
+ @skipIfNotDataVar('IMAGE_PKGTYPE', 'deb',
+ 'DEB is not the primary package manager')
+ @OEHasPackage(['dpkg','apt'])
+ 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()
--
2.7.4
^ permalink raw reply related [flat|nested] 3+ messages in thread
* [PATCH] oeqa/runtime/opkg.py: add runtime test for opkg
2018-03-01 2:11 [PATCH] oeqa/runtime/dpkg.py: add runtime test for dpkg Yeoh Ee Peng
@ 2018-03-01 2:11 ` Yeoh Ee Peng
2018-03-01 10:22 ` [PATCH] oeqa/runtime/dpkg.py: add runtime test for dpkg Alexander Kanavin
1 sibling, 0 replies; 3+ messages in thread
From: Yeoh Ee Peng @ 2018-03-01 2:11 UTC (permalink / raw)
To: openembedded-core
Add runtime test for opkg to test that it can install ipk
package from remote source.
Signed-off-by: Yeoh Ee Peng <ee.peng.yeoh@intel.com>
---
meta/lib/oeqa/runtime/cases/opkg.py | 47 +++++++++++++++++++++++++++++++++++++
1 file changed, 47 insertions(+)
create mode 100644 meta/lib/oeqa/runtime/cases/opkg.py
diff --git a/meta/lib/oeqa/runtime/cases/opkg.py b/meta/lib/oeqa/runtime/cases/opkg.py
new file mode 100644
index 0000000..671ee06
--- /dev/null
+++ b/meta/lib/oeqa/runtime/cases/opkg.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 OpkgTest(OERuntimeTestCase):
+
+ def pkg(self, command, expected = 0):
+ command = 'opkg %s' % command
+ status, output = self.target.run(command, 1500)
+ message = os.linesep.join([command, output])
+ self.assertEqual(status, expected, message)
+ return output
+
+class OpkgRepoTest(OpkgTest):
+
+ @classmethod
+ def setUpClass(cls):
+ service_repo = os.path.join(cls.tc.td['DEPLOY_DIR_IPK'], 'all')
+ cls.repo_server = HTTPService(service_repo, cls.tc.target.server_ip)
+ cls.repo_server.start()
+
+ @classmethod
+ def tearDownClass(cls):
+ cls.repo_server.stop()
+
+ def setup_source_config_for_package_install(self):
+ apt_get_source_server = 'http://%s:%s/' % (self.tc.target.server_ip, self.repo_server.port)
+ apt_get_sourceslist_dir = '/etc/opkg/'
+ self.target.run('cd %s; echo src/gz all %s >> opkg.conf' % (apt_get_sourceslist_dir, apt_get_source_server))
+
+ def cleanup_source_config_for_package_install(self):
+ apt_get_sourceslist_dir = '/etc/opkg/'
+ self.target.run('cd %s; sed -i "/^src/d" opkg.conf' % (apt_get_sourceslist_dir))
+
+ @skipIfNotFeature('package-management',
+ 'Test requires package-management to be in IMAGE_FEATURES')
+ @skipIfNotDataVar('IMAGE_PKGTYPE', 'ipk',
+ 'IPK is not the primary package manager')
+ @OEHasPackage(['opkg'])
+ def test_opkg_install_from_repo(self):
+ self.setup_source_config_for_package_install()
+ self.pkg('update')
+ self.pkg('remove run-postinsts-dev')
+ self.pkg('install run-postinsts-dev')
+ self.cleanup_source_config_for_package_install()
--
2.7.4
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] oeqa/runtime/dpkg.py: add runtime test for dpkg
2018-03-01 2:11 [PATCH] oeqa/runtime/dpkg.py: add runtime test for dpkg Yeoh Ee Peng
2018-03-01 2:11 ` [PATCH] oeqa/runtime/opkg.py: add runtime test for opkg Yeoh Ee Peng
@ 2018-03-01 10:22 ` Alexander Kanavin
1 sibling, 0 replies; 3+ messages in thread
From: Alexander Kanavin @ 2018-03-01 10:22 UTC (permalink / raw)
To: Yeoh Ee Peng, openembedded-core
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.yeoh@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
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2018-03-01 10:28 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-03-01 2:11 [PATCH] oeqa/runtime/dpkg.py: add runtime test for dpkg Yeoh Ee Peng
2018-03-01 2:11 ` [PATCH] oeqa/runtime/opkg.py: add runtime test for opkg Yeoh Ee Peng
2018-03-01 10:22 ` [PATCH] oeqa/runtime/dpkg.py: add runtime test for dpkg Alexander Kanavin
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.