diff options
author | Mihai Lindner <mihaix.lindner@linux.intel.com> | 2013-08-14 17:57:51 +0300 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2013-08-26 11:42:15 +0100 |
commit | f6186b4204dcc421b4e616774315c8a2a77fb5c5 (patch) | |
tree | 6d711c9a19176e95d68597dab77ab5e7e0cf0095 /meta/lib | |
parent | c92513d6ff3f8f06d937a5cdf4d94708f27c3850 (diff) | |
download | openembedded-core-f6186b4204dcc421b4e616774315c8a2a77fb5c5.tar.gz openembedded-core-f6186b4204dcc421b4e616774315c8a2a77fb5c5.tar.bz2 openembedded-core-f6186b4204dcc421b4e616774315c8a2a77fb5c5.zip |
lib/oeqa/runtime: smart: add new smart tests
Add class to be inherited by smart tests, along with more basic tests and tests
using a rpm repository.
Signed-off-by: Mihai Lindner <mihaix.lindner@linux.intel.com>
Signed-off-by: Stefan Stanacar <stefanx.stanacar@intel.com>
Signed-off-by: Saul Wold <sgw@linux.intel.com>
Diffstat (limited to 'meta/lib')
-rw-r--r-- | meta/lib/oeqa/runtime/smart.py | 102 |
1 files changed, 91 insertions, 11 deletions
diff --git a/meta/lib/oeqa/runtime/smart.py b/meta/lib/oeqa/runtime/smart.py index 0b03a30a3f..4ea2699508 100644 --- a/meta/lib/oeqa/runtime/smart.py +++ b/meta/lib/oeqa/runtime/smart.py @@ -1,6 +1,7 @@ import unittest from oeqa.oetest import oeRuntimeTest from oeqa.utils.decorators import * +from oeqa.utils.httpserver import HTTPService def setUpModule(): if not oeRuntimeTest.hasFeature("package-management"): @@ -8,21 +9,100 @@ def setUpModule(): if not oeRuntimeTest.hasPackage("smart"): skipModule("Image doesn't have smart installed") -class SmartHelpTest(oeRuntimeTest): +class SmartTest(oeRuntimeTest): + + longMessage = True + + @skipUnlessPassed('test_smart_help') + def smart(self, command, expected = 0): + command = 'smart %s' % command + status, output = self.target.run(command) + message = os.linesep.join([command, output]) + self.assertEqual(status, expected, message) + return output + +class SmartBasicTest(SmartTest): @skipUnlessPassed('test_ssh') def test_smart_help(self): - status = self.target.run('smart --help')[0] - self.assertEqual(status, 0) + self.smart('--help') -class SmartQueryTest(oeRuntimeTest): + def test_smart_version(self): + self.smart('--version') + + def test_smart_info(self): + self.smart('info python-smartpm') - @skipUnlessPassed('test_smart_help') def test_smart_query(self): - (status, output) = self.target.run('smart query rpm') - self.assertEqual(status, 0, msg="smart query failed, output: %s" % output) + self.smart('query python-smartpm') - @skipUnlessPassed('test_smart_query') - def test_smart_info(self): - (status, output) = self.target.run('smart info rpm') - self.assertEqual(status, 0, msg="smart info rpm failed, output: %s" % output) + def test_smart_search(self): + self.smart('search python-smartpm') + + def test_smart_stats(self): + self.smart('stats') + +class SmartRepoTest(SmartTest): + + @classmethod + def setUpClass(self): + self.repo_server = HTTPService(oeRuntimeTest.tc.d.getVar('DEPLOY_DIR', True)) + self.repo_server.start() + + @classmethod + def tearDownClass(self): + self.repo_server.stop() + + def test_smart_channel(self): + self.smart('channel', 1) + + def test_smart_channel_add(self): + image_pkgtype = self.tc.d.getVar('IMAGE_PKGTYPE', True) + deploy_url = 'http://%s:%s/%s' %(self.tc.qemu.host_ip, self.repo_server.port, image_pkgtype) + for arch in os.listdir('%s/%s' % (self.repo_server.root_dir, image_pkgtype)): + self.smart('channel -y --add {a} type=rpm-md baseurl={u}/{a}'.format(a=arch, u=deploy_url)) + self.smart('update') + + def test_smart_channel_help(self): + self.smart('channel --help') + + def test_smart_channel_list(self): + self.smart('channel --list') + + def test_smart_channel_show(self): + self.smart('channel --show') + + def test_smart_channel_rpmsys(self): + self.smart('channel --show rpmsys') + self.smart('channel --disable rpmsys') + self.smart('channel --enable rpmsys') + + @skipUnlessPassed('test_smart_channel_add') + def test_smart_install(self): + self.smart('remove -y psplash-default') + self.smart('install -y psplash-default') + + @skipUnlessPassed('test_smart_install') + def test_smart_install_dependency(self): + self.smart('remove -y psplash') + self.smart('install -y psplash-default') + + @skipUnlessPassed('test_smart_channel_add') + def test_smart_install_from_disk(self): + self.smart('remove -y psplash-default') + self.smart('download psplash-default') + self.smart('install -y ./psplash-default*') + + @skipUnlessPassed('test_smart_channel_add') + def test_smart_install_from_http(self): + url = 'http://' + output = self.smart('download --urls psplash-default') + for line in output.splitlines(): + if line.startswith(url): + url = line + self.smart('remove -y psplash-default') + self.smart('install -y %s' % url) + + @skipUnlessPassed('test_smart_install') + def test_smart_reinstall(self): + self.smart('reinstall -y psplash-default') |