diff options
Diffstat (limited to 'meta/lib/oeqa/runtime/cases/smart.py')
-rw-r--r-- | meta/lib/oeqa/runtime/cases/smart.py | 196 |
1 files changed, 0 insertions, 196 deletions
diff --git a/meta/lib/oeqa/runtime/cases/smart.py b/meta/lib/oeqa/runtime/cases/smart.py deleted file mode 100644 index 79bd9c8af7..0000000000 --- a/meta/lib/oeqa/runtime/cases/smart.py +++ /dev/null | |||
@@ -1,196 +0,0 @@ | |||
1 | import os | ||
2 | import re | ||
3 | import subprocess | ||
4 | from oeqa.utils.httpserver import HTTPService | ||
5 | |||
6 | from oeqa.runtime.case import OERuntimeTestCase | ||
7 | from oeqa.core.decorator.depends import OETestDepends | ||
8 | from oeqa.core.decorator.oeid import OETestID | ||
9 | from oeqa.core.decorator.data import skipIfNotDataVar, skipIfNotFeature | ||
10 | from oeqa.runtime.decorator.package import OEHasPackage | ||
11 | |||
12 | class SmartTest(OERuntimeTestCase): | ||
13 | |||
14 | def smart(self, command, expected = 0): | ||
15 | command = 'smart %s' % command | ||
16 | status, output = self.target.run(command, 1500) | ||
17 | message = os.linesep.join([command, output]) | ||
18 | self.assertEqual(status, expected, message) | ||
19 | self.assertFalse('Cannot allocate memory' in output, message) | ||
20 | return output | ||
21 | |||
22 | class SmartBasicTest(SmartTest): | ||
23 | |||
24 | @skipIfNotFeature('package-management', | ||
25 | 'Test requires package-management to be in IMAGE_FEATURES') | ||
26 | @skipIfNotDataVar('IMAGE_PKGTYPE', 'rpm', | ||
27 | 'RPM is not the primary package manager') | ||
28 | @OEHasPackage(['smartpm']) | ||
29 | @OETestID(716) | ||
30 | @OETestDepends(['ssh.SSHTest.test_ssh']) | ||
31 | def test_smart_help(self): | ||
32 | self.smart('--help') | ||
33 | |||
34 | @OETestID(968) | ||
35 | @OETestDepends(['smart.SmartBasicTest.test_smart_help']) | ||
36 | def test_smart_version(self): | ||
37 | self.smart('--version') | ||
38 | |||
39 | @OETestID(721) | ||
40 | @OETestDepends(['smart.SmartBasicTest.test_smart_help']) | ||
41 | def test_smart_info(self): | ||
42 | self.smart('info python-smartpm') | ||
43 | |||
44 | @OETestID(421) | ||
45 | @OETestDepends(['smart.SmartBasicTest.test_smart_help']) | ||
46 | def test_smart_query(self): | ||
47 | self.smart('query python-smartpm') | ||
48 | |||
49 | @OETestID(720) | ||
50 | @OETestDepends(['smart.SmartBasicTest.test_smart_help']) | ||
51 | def test_smart_search(self): | ||
52 | self.smart('search python-smartpm') | ||
53 | |||
54 | @OETestID(722) | ||
55 | @OETestDepends(['smart.SmartBasicTest.test_smart_help']) | ||
56 | def test_smart_stats(self): | ||
57 | self.smart('stats') | ||
58 | |||
59 | class SmartRepoTest(SmartTest): | ||
60 | |||
61 | @classmethod | ||
62 | def setUpClass(cls): | ||
63 | cls.repolist = [] | ||
64 | cls.repo_server = HTTPService(cls.tc.td['WORKDIR'], | ||
65 | cls.tc.target.server_ip) | ||
66 | cls.repo_server.start() | ||
67 | |||
68 | @classmethod | ||
69 | def tearDownClass(cls): | ||
70 | cls.repo_server.stop() | ||
71 | for repo in cls.repolist: | ||
72 | cls.tc.target.run('smart channel -y --remove %s' % repo) | ||
73 | |||
74 | @OETestID(1143) | ||
75 | @OETestDepends(['smart.SmartBasicTest.test_smart_help']) | ||
76 | def test_smart_channel(self): | ||
77 | self.smart('channel', 1) | ||
78 | |||
79 | @OETestID(719) | ||
80 | @OETestDepends(['smart.SmartBasicTest.test_smart_help']) | ||
81 | def test_smart_channel_add(self): | ||
82 | image_pkgtype = self.tc.td['IMAGE_PKGTYPE'] | ||
83 | deploy_url = 'http://%s:%s/%s' % (self.target.server_ip, | ||
84 | self.repo_server.port, | ||
85 | image_pkgtype) | ||
86 | pkgarchs = self.tc.td['PACKAGE_ARCHS'].replace("-","_").split() | ||
87 | archs = os.listdir(os.path.join(self.repo_server.root_dir, | ||
88 | image_pkgtype)) | ||
89 | for arch in archs: | ||
90 | if arch in pkgarchs: | ||
91 | cmd = ('channel -y --add {a} type=rpm-md ' | ||
92 | 'baseurl={u}/{a}'.format(a=arch, u=deploy_url)) | ||
93 | self.smart(cmd) | ||
94 | self.repolist.append(arch) | ||
95 | self.smart('update') | ||
96 | |||
97 | @OETestID(969) | ||
98 | @OETestDepends(['smart.SmartBasicTest.test_smart_help']) | ||
99 | def test_smart_channel_help(self): | ||
100 | self.smart('channel --help') | ||
101 | |||
102 | @OETestID(970) | ||
103 | @OETestDepends(['smart.SmartBasicTest.test_smart_help']) | ||
104 | def test_smart_channel_list(self): | ||
105 | self.smart('channel --list') | ||
106 | |||
107 | @OETestID(971) | ||
108 | @OETestDepends(['smart.SmartBasicTest.test_smart_help']) | ||
109 | def test_smart_channel_show(self): | ||
110 | self.smart('channel --show') | ||
111 | |||
112 | @OETestID(717) | ||
113 | @OETestDepends(['smart.SmartBasicTest.test_smart_help']) | ||
114 | def test_smart_channel_rpmsys(self): | ||
115 | self.smart('channel --show rpmsys') | ||
116 | self.smart('channel --disable rpmsys') | ||
117 | self.smart('channel --enable rpmsys') | ||
118 | |||
119 | @OETestID(1144) | ||
120 | @OETestDepends(['smart.SmartRepoTest.test_smart_channel_add']) | ||
121 | def test_smart_install(self): | ||
122 | self.smart('remove -y psplash-default') | ||
123 | self.smart('install -y psplash-default') | ||
124 | |||
125 | @OETestID(728) | ||
126 | @OETestDepends(['smart.SmartRepoTest.test_smart_install']) | ||
127 | def test_smart_install_dependency(self): | ||
128 | self.smart('remove -y psplash') | ||
129 | self.smart('install -y psplash-default') | ||
130 | |||
131 | @OETestID(723) | ||
132 | @OETestDepends(['smart.SmartRepoTest.test_smart_channel_add']) | ||
133 | def test_smart_install_from_disk(self): | ||
134 | self.smart('remove -y psplash-default') | ||
135 | self.smart('download psplash-default') | ||
136 | self.smart('install -y ./psplash-default*') | ||
137 | |||
138 | @OETestID(725) | ||
139 | @OETestDepends(['smart.SmartRepoTest.test_smart_channel_add']) | ||
140 | def test_smart_install_from_http(self): | ||
141 | output = self.smart('download --urls psplash-default') | ||
142 | url = re.search('(http://.*/psplash-default.*\.rpm)', output) | ||
143 | self.assertTrue(url, msg="Couln't find download url in %s" % output) | ||
144 | self.smart('remove -y psplash-default') | ||
145 | self.smart('install -y %s' % url.group(0)) | ||
146 | |||
147 | @OETestID(729) | ||
148 | @OETestDepends(['smart.SmartRepoTest.test_smart_install']) | ||
149 | def test_smart_reinstall(self): | ||
150 | self.smart('reinstall -y psplash-default') | ||
151 | |||
152 | @OETestID(727) | ||
153 | @OETestDepends(['smart.SmartRepoTest.test_smart_channel_add']) | ||
154 | def test_smart_remote_repo(self): | ||
155 | self.smart('update') | ||
156 | self.smart('install -y psplash') | ||
157 | self.smart('remove -y psplash') | ||
158 | |||
159 | @OETestID(726) | ||
160 | @OETestDepends(['smart.SmartBasicTest.test_smart_help']) | ||
161 | def test_smart_local_dir(self): | ||
162 | self.target.run('mkdir /tmp/myrpmdir') | ||
163 | self.smart('channel --add myrpmdir type=rpm-dir path=/tmp/myrpmdir -y') | ||
164 | self.target.run('cd /tmp/myrpmdir') | ||
165 | self.smart('download psplash') | ||
166 | output = self.smart('channel --list') | ||
167 | for i in output.split("\n"): | ||
168 | if ("rpmsys" != str(i)) and ("myrpmdir" != str(i)): | ||
169 | self.smart('channel --disable '+str(i)) | ||
170 | self.target.run('cd $HOME') | ||
171 | self.smart('install psplash') | ||
172 | for i in output.split("\n"): | ||
173 | if ("rpmsys" != str(i)) and ("myrpmdir" != str(i)): | ||
174 | self.smart('channel --enable '+str(i)) | ||
175 | self.smart('channel --remove myrpmdir -y') | ||
176 | self.target.run("rm -rf /tmp/myrpmdir") | ||
177 | |||
178 | @OETestID(718) | ||
179 | @OETestDepends(['smart.SmartBasicTest.test_smart_help']) | ||
180 | def test_smart_add_rpmdir(self): | ||
181 | self.target.run('mkdir /tmp/myrpmdir') | ||
182 | self.smart('channel --add myrpmdir type=rpm-dir path=/tmp/myrpmdir -y') | ||
183 | self.smart('channel --disable myrpmdir -y') | ||
184 | output = self.smart('channel --show myrpmdir') | ||
185 | self.assertTrue("disabled = yes" in output, msg="Failed to disable rpm dir") | ||
186 | self.smart('channel --enable myrpmdir -y') | ||
187 | output = self.smart('channel --show myrpmdir') | ||
188 | self.assertFalse("disabled = yes" in output, msg="Failed to enable rpm dir") | ||
189 | self.smart('channel --remove myrpmdir -y') | ||
190 | self.target.run("rm -rf /tmp/myrpmdir") | ||
191 | |||
192 | @OETestID(731) | ||
193 | @OETestDepends(['smart.SmartRepoTest.test_smart_channel_add']) | ||
194 | def test_smart_remove_package(self): | ||
195 | self.smart('install -y psplash') | ||
196 | self.smart('remove -y psplash') | ||