diff options
Diffstat (limited to 'meta/lib/oeqa/runtime/smart.py')
-rw-r--r-- | meta/lib/oeqa/runtime/smart.py | 108 |
1 files changed, 108 insertions, 0 deletions
diff --git a/meta/lib/oeqa/runtime/smart.py b/meta/lib/oeqa/runtime/smart.py new file mode 100644 index 0000000000..c3fdf7d499 --- /dev/null +++ b/meta/lib/oeqa/runtime/smart.py | |||
@@ -0,0 +1,108 @@ | |||
1 | import unittest | ||
2 | import re | ||
3 | from oeqa.oetest import oeRuntimeTest | ||
4 | from oeqa.utils.decorators import * | ||
5 | from oeqa.utils.httpserver import HTTPService | ||
6 | |||
7 | def setUpModule(): | ||
8 | if not oeRuntimeTest.hasFeature("package-management"): | ||
9 | skipModule("Image doesn't have package management feature") | ||
10 | if not oeRuntimeTest.hasPackage("smart"): | ||
11 | skipModule("Image doesn't have smart installed") | ||
12 | |||
13 | class SmartTest(oeRuntimeTest): | ||
14 | |||
15 | @skipUnlessPassed('test_smart_help') | ||
16 | def smart(self, command, expected = 0): | ||
17 | command = 'smart %s' % command | ||
18 | status, output = self.target.run(command, 1500) | ||
19 | message = os.linesep.join([command, output]) | ||
20 | self.assertEqual(status, expected, message) | ||
21 | self.assertFalse("Cannot allocate memory" in output, message) | ||
22 | return output | ||
23 | |||
24 | class SmartBasicTest(SmartTest): | ||
25 | |||
26 | @skipUnlessPassed('test_ssh') | ||
27 | def test_smart_help(self): | ||
28 | self.smart('--help') | ||
29 | |||
30 | def test_smart_version(self): | ||
31 | self.smart('--version') | ||
32 | |||
33 | def test_smart_info(self): | ||
34 | self.smart('info python-smartpm') | ||
35 | |||
36 | def test_smart_query(self): | ||
37 | self.smart('query python-smartpm') | ||
38 | |||
39 | def test_smart_search(self): | ||
40 | self.smart('search python-smartpm') | ||
41 | |||
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), oeRuntimeTest.tc.qemu.host_ip) | ||
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 | pkgarchs = self.tc.d.getVar('PACKAGE_ARCHS', True) | ||
63 | for arch in os.listdir('%s/%s' % (self.repo_server.root_dir, image_pkgtype)): | ||
64 | if arch in pkgarchs: | ||
65 | self.smart('channel -y --add {a} type=rpm-md baseurl={u}/{a}'.format(a=arch, u=deploy_url)) | ||
66 | self.smart('update') | ||
67 | |||
68 | def test_smart_channel_help(self): | ||
69 | self.smart('channel --help') | ||
70 | |||
71 | def test_smart_channel_list(self): | ||
72 | self.smart('channel --list') | ||
73 | |||
74 | def test_smart_channel_show(self): | ||
75 | self.smart('channel --show') | ||
76 | |||
77 | def test_smart_channel_rpmsys(self): | ||
78 | self.smart('channel --show rpmsys') | ||
79 | self.smart('channel --disable rpmsys') | ||
80 | self.smart('channel --enable rpmsys') | ||
81 | |||
82 | @skipUnlessPassed('test_smart_channel_add') | ||
83 | def test_smart_install(self): | ||
84 | self.smart('remove -y psplash-default') | ||
85 | self.smart('install -y psplash-default') | ||
86 | |||
87 | @skipUnlessPassed('test_smart_install') | ||
88 | def test_smart_install_dependency(self): | ||
89 | self.smart('remove -y psplash') | ||
90 | self.smart('install -y psplash-default') | ||
91 | |||
92 | @skipUnlessPassed('test_smart_channel_add') | ||
93 | def test_smart_install_from_disk(self): | ||
94 | self.smart('remove -y psplash-default') | ||
95 | self.smart('download psplash-default') | ||
96 | self.smart('install -y ./psplash-default*') | ||
97 | |||
98 | @skipUnlessPassed('test_smart_channel_add') | ||
99 | def test_smart_install_from_http(self): | ||
100 | output = self.smart('download --urls psplash-default') | ||
101 | url = re.search('(http://.*/psplash-default.*\.rpm)', output) | ||
102 | self.assertTrue(url, msg="Couln't find download url in %s" % output) | ||
103 | self.smart('remove -y psplash-default') | ||
104 | self.smart('install -y %s' % url.group(0)) | ||
105 | |||
106 | @skipUnlessPassed('test_smart_install') | ||
107 | def test_smart_reinstall(self): | ||
108 | self.smart('reinstall -y psplash-default') | ||