summaryrefslogtreecommitdiffstats
path: root/meta/lib
diff options
context:
space:
mode:
authorMihai Lindner <mihaix.lindner@linux.intel.com>2013-08-14 17:57:51 +0300
committerRichard Purdie <richard.purdie@linuxfoundation.org>2013-08-26 11:47:21 +0100
commitecb21fd7f88e4f2f37389d8efbde76effa00d7db (patch)
treedcfb1cd1068cba55875fe443b0929a7bf617ad40 /meta/lib
parent2c8339894045733e297559ddfb1fb829fc6da0fd (diff)
downloadpoky-ecb21fd7f88e4f2f37389d8efbde76effa00d7db.tar.gz
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. (From OE-Core rev: f6186b4204dcc421b4e616774315c8a2a77fb5c5) 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> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/lib')
-rw-r--r--meta/lib/oeqa/runtime/smart.py102
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 @@
1import unittest 1import unittest
2from oeqa.oetest import oeRuntimeTest 2from oeqa.oetest import oeRuntimeTest
3from oeqa.utils.decorators import * 3from oeqa.utils.decorators import *
4from oeqa.utils.httpserver import HTTPService
4 5
5def setUpModule(): 6def 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
11class SmartHelpTest(oeRuntimeTest): 12class 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
24class 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
18class 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
45class 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')