diff options
| -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 @@ | |||
| 1 | import unittest | 1 | import unittest |
| 2 | from oeqa.oetest import oeRuntimeTest | 2 | from oeqa.oetest import oeRuntimeTest |
| 3 | from oeqa.utils.decorators import * | 3 | from oeqa.utils.decorators import * |
| 4 | from oeqa.utils.httpserver import HTTPService | ||
| 4 | 5 | ||
| 5 | def setUpModule(): | 6 | def setUpModule(): |
| 6 | if not oeRuntimeTest.hasFeature("package-management"): | 7 | if not oeRuntimeTest.hasFeature("package-management"): |
| @@ -8,21 +9,100 @@ def setUpModule(): | |||
| 8 | if not oeRuntimeTest.hasPackage("smart"): | 9 | if not oeRuntimeTest.hasPackage("smart"): |
| 9 | skipModule("Image doesn't have smart installed") | 10 | skipModule("Image doesn't have smart installed") |
| 10 | 11 | ||
| 11 | class SmartHelpTest(oeRuntimeTest): | 12 | class SmartTest(oeRuntimeTest): |
| 13 | |||
| 14 | longMessage = True | ||
| 15 | |||
| 16 | @skipUnlessPassed('test_smart_help') | ||
| 17 | def smart(self, command, expected = 0): | ||
| 18 | command = 'smart %s' % command | ||
| 19 | status, output = self.target.run(command) | ||
| 20 | message = os.linesep.join([command, output]) | ||
| 21 | self.assertEqual(status, expected, message) | ||
| 22 | return output | ||
| 23 | |||
| 24 | class SmartBasicTest(SmartTest): | ||
| 12 | 25 | ||
| 13 | @skipUnlessPassed('test_ssh') | 26 | @skipUnlessPassed('test_ssh') |
| 14 | def test_smart_help(self): | 27 | def test_smart_help(self): |
| 15 | status = self.target.run('smart --help')[0] | 28 | self.smart('--help') |
| 16 | self.assertEqual(status, 0) | ||
| 17 | 29 | ||
| 18 | class SmartQueryTest(oeRuntimeTest): | 30 | def test_smart_version(self): |
| 31 | self.smart('--version') | ||
| 32 | |||
| 33 | def test_smart_info(self): | ||
| 34 | self.smart('info python-smartpm') | ||
| 19 | 35 | ||
| 20 | @skipUnlessPassed('test_smart_help') | ||
| 21 | def test_smart_query(self): | 36 | def test_smart_query(self): |
| 22 | (status, output) = self.target.run('smart query rpm') | 37 | self.smart('query python-smartpm') |
| 23 | self.assertEqual(status, 0, msg="smart query failed, output: %s" % output) | ||
| 24 | 38 | ||
| 25 | @skipUnlessPassed('test_smart_query') | 39 | def test_smart_search(self): |
| 26 | def test_smart_info(self): | 40 | self.smart('search python-smartpm') |
| 27 | (status, output) = self.target.run('smart info rpm') | 41 | |
| 28 | self.assertEqual(status, 0, msg="smart info rpm failed, output: %s" % output) | 42 | def test_smart_stats(self): |
| 43 | self.smart('stats') | ||
| 44 | |||
| 45 | class SmartRepoTest(SmartTest): | ||
| 46 | |||
| 47 | @classmethod | ||
| 48 | def setUpClass(self): | ||
| 49 | self.repo_server = HTTPService(oeRuntimeTest.tc.d.getVar('DEPLOY_DIR', True)) | ||
| 50 | self.repo_server.start() | ||
| 51 | |||
| 52 | @classmethod | ||
| 53 | def tearDownClass(self): | ||
| 54 | self.repo_server.stop() | ||
| 55 | |||
| 56 | def test_smart_channel(self): | ||
| 57 | self.smart('channel', 1) | ||
| 58 | |||
| 59 | def test_smart_channel_add(self): | ||
| 60 | image_pkgtype = self.tc.d.getVar('IMAGE_PKGTYPE', True) | ||
| 61 | deploy_url = 'http://%s:%s/%s' %(self.tc.qemu.host_ip, self.repo_server.port, image_pkgtype) | ||
| 62 | for arch in os.listdir('%s/%s' % (self.repo_server.root_dir, image_pkgtype)): | ||
| 63 | self.smart('channel -y --add {a} type=rpm-md baseurl={u}/{a}'.format(a=arch, u=deploy_url)) | ||
| 64 | self.smart('update') | ||
| 65 | |||
| 66 | def test_smart_channel_help(self): | ||
| 67 | self.smart('channel --help') | ||
| 68 | |||
| 69 | def test_smart_channel_list(self): | ||
| 70 | self.smart('channel --list') | ||
| 71 | |||
| 72 | def test_smart_channel_show(self): | ||
| 73 | self.smart('channel --show') | ||
| 74 | |||
| 75 | def test_smart_channel_rpmsys(self): | ||
| 76 | self.smart('channel --show rpmsys') | ||
| 77 | self.smart('channel --disable rpmsys') | ||
| 78 | self.smart('channel --enable rpmsys') | ||
| 79 | |||
| 80 | @skipUnlessPassed('test_smart_channel_add') | ||
| 81 | def test_smart_install(self): | ||
| 82 | self.smart('remove -y psplash-default') | ||
| 83 | self.smart('install -y psplash-default') | ||
| 84 | |||
| 85 | @skipUnlessPassed('test_smart_install') | ||
| 86 | def test_smart_install_dependency(self): | ||
| 87 | self.smart('remove -y psplash') | ||
| 88 | self.smart('install -y psplash-default') | ||
| 89 | |||
| 90 | @skipUnlessPassed('test_smart_channel_add') | ||
| 91 | def test_smart_install_from_disk(self): | ||
| 92 | self.smart('remove -y psplash-default') | ||
| 93 | self.smart('download psplash-default') | ||
| 94 | self.smart('install -y ./psplash-default*') | ||
| 95 | |||
| 96 | @skipUnlessPassed('test_smart_channel_add') | ||
| 97 | def test_smart_install_from_http(self): | ||
| 98 | url = 'http://' | ||
| 99 | output = self.smart('download --urls psplash-default') | ||
| 100 | for line in output.splitlines(): | ||
| 101 | if line.startswith(url): | ||
| 102 | url = line | ||
| 103 | self.smart('remove -y psplash-default') | ||
| 104 | self.smart('install -y %s' % url) | ||
| 105 | |||
| 106 | @skipUnlessPassed('test_smart_install') | ||
| 107 | def test_smart_reinstall(self): | ||
| 108 | self.smart('reinstall -y psplash-default') | ||
