diff options
author | Tudor Florea <tudor.florea@enea.com> | 2014-10-16 03:05:19 +0200 |
---|---|---|
committer | Tudor Florea <tudor.florea@enea.com> | 2014-10-16 03:05:19 +0200 |
commit | c527fd1f14c27855a37f2e8ac5346ce8d940ced2 (patch) | |
tree | bb002c1fdf011c41dbd2f0927bed23ecb5f83c97 /meta/lib/oeqa/runtime/smart.py | |
download | poky-daisy-140929.tar.gz |
initial commit for Enea Linux 4.0-140929daisy-140929
Migrated from the internal git server on the daisy-enea-point-release branch
Signed-off-by: Tudor Florea <tudor.florea@enea.com>
Diffstat (limited to 'meta/lib/oeqa/runtime/smart.py')
-rw-r--r-- | meta/lib/oeqa/runtime/smart.py | 110 |
1 files changed, 110 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..195f1170c6 --- /dev/null +++ b/meta/lib/oeqa/runtime/smart.py | |||
@@ -0,0 +1,110 @@ | |||
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 | if "package_rpm" != oeRuntimeTest.tc.d.getVar("PACKAGE_CLASSES", True).split()[0]: | ||
13 | skipModule("Rpm is not the primary package manager") | ||
14 | |||
15 | class SmartTest(oeRuntimeTest): | ||
16 | |||
17 | @skipUnlessPassed('test_smart_help') | ||
18 | def smart(self, command, expected = 0): | ||
19 | command = 'smart %s' % command | ||
20 | status, output = self.target.run(command, 1500) | ||
21 | message = os.linesep.join([command, output]) | ||
22 | self.assertEqual(status, expected, message) | ||
23 | self.assertFalse("Cannot allocate memory" in output, message) | ||
24 | return output | ||
25 | |||
26 | class SmartBasicTest(SmartTest): | ||
27 | |||
28 | @skipUnlessPassed('test_ssh') | ||
29 | def test_smart_help(self): | ||
30 | self.smart('--help') | ||
31 | |||
32 | def test_smart_version(self): | ||
33 | self.smart('--version') | ||
34 | |||
35 | def test_smart_info(self): | ||
36 | self.smart('info python-smartpm') | ||
37 | |||
38 | def test_smart_query(self): | ||
39 | self.smart('query python-smartpm') | ||
40 | |||
41 | def test_smart_search(self): | ||
42 | self.smart('search python-smartpm') | ||
43 | |||
44 | def test_smart_stats(self): | ||
45 | self.smart('stats') | ||
46 | |||
47 | class SmartRepoTest(SmartTest): | ||
48 | |||
49 | @classmethod | ||
50 | def setUpClass(self): | ||
51 | self.repo_server = HTTPService(oeRuntimeTest.tc.d.getVar('DEPLOY_DIR', True), oeRuntimeTest.tc.target.server_ip) | ||
52 | self.repo_server.start() | ||
53 | |||
54 | @classmethod | ||
55 | def tearDownClass(self): | ||
56 | self.repo_server.stop() | ||
57 | |||
58 | def test_smart_channel(self): | ||
59 | self.smart('channel', 1) | ||
60 | |||
61 | def test_smart_channel_add(self): | ||
62 | image_pkgtype = self.tc.d.getVar('IMAGE_PKGTYPE', True) | ||
63 | deploy_url = 'http://%s:%s/%s' %(self.target.server_ip, self.repo_server.port, image_pkgtype) | ||
64 | pkgarchs = self.tc.d.getVar('PACKAGE_ARCHS', True).replace("-","_").split() | ||
65 | for arch in os.listdir('%s/%s' % (self.repo_server.root_dir, image_pkgtype)): | ||
66 | if arch in pkgarchs: | ||
67 | self.smart('channel -y --add {a} type=rpm-md baseurl={u}/{a}'.format(a=arch, u=deploy_url)) | ||
68 | self.smart('update') | ||
69 | |||
70 | def test_smart_channel_help(self): | ||
71 | self.smart('channel --help') | ||
72 | |||
73 | def test_smart_channel_list(self): | ||
74 | self.smart('channel --list') | ||
75 | |||
76 | def test_smart_channel_show(self): | ||
77 | self.smart('channel --show') | ||
78 | |||
79 | def test_smart_channel_rpmsys(self): | ||
80 | self.smart('channel --show rpmsys') | ||
81 | self.smart('channel --disable rpmsys') | ||
82 | self.smart('channel --enable rpmsys') | ||
83 | |||
84 | @skipUnlessPassed('test_smart_channel_add') | ||
85 | def test_smart_install(self): | ||
86 | self.smart('remove -y psplash-default') | ||
87 | self.smart('install -y psplash-default') | ||
88 | |||
89 | @skipUnlessPassed('test_smart_install') | ||
90 | def test_smart_install_dependency(self): | ||
91 | self.smart('remove -y psplash') | ||
92 | self.smart('install -y psplash-default') | ||
93 | |||
94 | @skipUnlessPassed('test_smart_channel_add') | ||
95 | def test_smart_install_from_disk(self): | ||
96 | self.smart('remove -y psplash-default') | ||
97 | self.smart('download psplash-default') | ||
98 | self.smart('install -y ./psplash-default*') | ||
99 | |||
100 | @skipUnlessPassed('test_smart_channel_add') | ||
101 | def test_smart_install_from_http(self): | ||
102 | output = self.smart('download --urls psplash-default') | ||
103 | url = re.search('(http://.*/psplash-default.*\.rpm)', output) | ||
104 | self.assertTrue(url, msg="Couln't find download url in %s" % output) | ||
105 | self.smart('remove -y psplash-default') | ||
106 | self.smart('install -y %s' % url.group(0)) | ||
107 | |||
108 | @skipUnlessPassed('test_smart_install') | ||
109 | def test_smart_reinstall(self): | ||
110 | self.smart('reinstall -y psplash-default') | ||