Gentoo Archives: gentoo-commits

From: "Michał Górny" <mgorny@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] proj/pms-test-suite:master commit in: pmstestsuite/library/standard/, pmstestsuite/repository/
Date: Mon, 02 Jan 2012 22:04:12
Message-Id: efe9fbbe65d0114724b99e016a931902618cc9c7.mgorny@gentoo
1 commit: efe9fbbe65d0114724b99e016a931902618cc9c7
2 Author: Michał Górny <mgorny <AT> gentoo <DOT> org>
3 AuthorDate: Mon Jan 2 20:28:44 2012 +0000
4 Commit: Michał Górny <mgorny <AT> gentoo <DOT> org>
5 CommitDate: Mon Jan 2 20:55:41 2012 +0000
6 URL: http://git.overlays.gentoo.org/gitweb/?p=proj/pms-test-suite.git;a=commit;h=efe9fbbe
7
8 Integrate D-Bus code into the main eclass.
9
10 ---
11 pmstestsuite/library/standard/__init__.py | 9 +----
12 pmstestsuite/library/standard/banned_commands.py | 8 ++--
13 pmstestsuite/library/standard/dbus_case.py | 38 +-------------------
14 pmstestsuite/library/standard/depend.py | 4 +-
15 pmstestsuite/library/standard/deprecated_vars.py | 6 ++--
16 .../library/standard/phase_function_order.py | 4 +-
17 pmstestsuite/library/standard/special_vars.py | 7 ++--
18 pmstestsuite/library/standard/variable_scope.py | 4 +-
19 pmstestsuite/repository/pms_eclass.py | 33 ++++++++++++++++-
20 9 files changed, 49 insertions(+), 64 deletions(-)
21
22 diff --git a/pmstestsuite/library/standard/__init__.py b/pmstestsuite/library/standard/__init__.py
23 index e3ab8ec..3e87200 100644
24 --- a/pmstestsuite/library/standard/__init__.py
25 +++ b/pmstestsuite/library/standard/__init__.py
26 @@ -1,13 +1,11 @@
27 # vim:fileencoding=utf-8
28 -# (c) 2011 Michał Górny <mgorny@g.o>
29 +# (c) 2011-2012 Michał Górny <mgorny@g.o>
30 # Released under the terms of the 2-clause BSD license.
31
32 import os.path
33
34 from pmstestsuite.library import TestLibrary
35
36 -from .dbus_case import pms_dbus_eclass
37 -
38 class StandardTestLibrary(TestLibrary):
39 """
40 Standard test library for the PMS Test Suite.
41 @@ -36,8 +34,3 @@ class StandardTestLibrary(TestLibrary):
42 'variable_scope.VariableScopeTest',
43 'workdir_fallback.WorkdirFallbackTest'
44 ]
45 -
46 - def get_common_files(self):
47 - return {
48 - os.path.join('eclass', 'pms-test-dbus.eclass'): pms_dbus_eclass
49 - }
50
51 diff --git a/pmstestsuite/library/standard/banned_commands.py b/pmstestsuite/library/standard/banned_commands.py
52 index 1eae774..216d6df 100644
53 --- a/pmstestsuite/library/standard/banned_commands.py
54 +++ b/pmstestsuite/library/standard/banned_commands.py
55 @@ -1,5 +1,5 @@
56 # vim:fileencoding=utf-8
57 -# (c) 2011 Michał Górny <mgorny@g.o>
58 +# (c) 2011-2012 Michał Górny <mgorny@g.o>
59 # Released under the terms of the 2-clause BSD license.
60
61 from .dbus_case import DBusEbuildTestCase
62 @@ -25,10 +25,10 @@ class DoHardCommandTest(BannedCommandTest):
63 self.phase_funcs['src_install'].extend([
64 'dohard %s/foo %s/bar || die' % (self._path, self._path),
65 '[[ "${D}"%s/foo -ef "${D}"%s/bar ]]' % (self._path, self._path),
66 - 'pms-test-dbus_append_result ${?}'])
67 + 'pms-test_dbus_append_result ${?}'])
68 self.phase_funcs['pkg_postinst'].extend([
69 '[[ "${ROOT}"%s/foo -ef "${ROOT}"%s/bar ]]' % (self._path, self._path),
70 - 'pms-test-dbus_append_result ${?}'])
71 + 'pms-test_dbus_append_result ${?}'])
72
73 def check_dbus_result(self, output, pm):
74 try:
75 @@ -73,7 +73,7 @@ class DoSedCommandTest(BannedCommandTest):
76 BannedCommandTest.__init__(self, *args, **kwargs)
77 self.phase_funcs['src_install'].extend([
78 "dosed -e '$i SED WORKED' %s/foo || die" % self._path,
79 - 'pms-test-dbus_append_result "$(cat "${D}"%s/foo)"' % self._path])
80 + 'pms-test_dbus_append_result "$(cat "${D}"%s/foo)"' % self._path])
81
82 def check_dbus_result(self, output, pm):
83 try:
84
85 diff --git a/pmstestsuite/library/standard/dbus_case.py b/pmstestsuite/library/standard/dbus_case.py
86 index 6bfbd88..672ace5 100644
87 --- a/pmstestsuite/library/standard/dbus_case.py
88 +++ b/pmstestsuite/library/standard/dbus_case.py
89 @@ -13,40 +13,6 @@ from pmstestsuite.dbus_handler import DBusHandler, dbus_interface_name, dbus_obj
90
91 dbus_handler = DBusHandler()
92
93 -pms_dbus_eclass = """# Copyright 1999-2011 Gentoo Foundation
94 -# Distributed under the terms of the GNU General Public License v2
95 -# $Header: $
96 -
97 -DEPEND="sys-apps/dbus"
98 -
99 -EXPORT_FUNCTIONS pkg_setup
100 -
101 -pms-test-dbus_call() {
102 - local method=${1}
103 - shift
104 -
105 - PMS_TEST_DBUS_P=${P//-/_}
106 - dbus-send \\
107 - --system \\
108 - --print-reply \\
109 - --type=method_call \\
110 - --dest=org.gentoo.pmstestsuite \\
111 - /org/gentoo/pmstestsuite/${PMS_TEST_DBUS_P} \\
112 - org.gentoo.pmstestsuite.${method} \\
113 - "${@}"
114 -}
115 -
116 -pms-test-dbus_pkg_setup() {
117 - pms-test-dbus_call test_started
118 -}
119 -
120 -pms-test-dbus_append_result() {
121 - pms-test-dbus_call append_output \\
122 - string:"${*}" \\
123 - || die 'Failed to append the test result using dbus'
124 -}
125 -"""
126 -
127 class RunningTest(dbus.service.Object):
128 """ A class encapsulating a running test. """
129
130 @@ -96,8 +62,6 @@ class RunningTest(dbus.service.Object):
131 class DBusBaseTestCase(object):
132 """ A base D-Bus test case class. """
133
134 - inherits = ['pms-test-dbus']
135 -
136 def __init__(self):
137 self._dbusobj = RunningTest(self)
138
139 @@ -106,7 +70,7 @@ class DBusBaseTestCase(object):
140 Finalize the object, ensuring that C{pkg_setup()} will be called.
141 """
142 if self.phase_funcs['pkg_setup']:
143 - self.phase_funcs['pkg_setup'].insert(0, 'pms-test-dbus_pkg_setup')
144 + self.phase_funcs['pkg_setup'].insert(0, 'pms-test_pkg_setup')
145
146 def check_dbus_result(self, output, pm):
147 """
148
149 diff --git a/pmstestsuite/library/standard/depend.py b/pmstestsuite/library/standard/depend.py
150 index a773b25..f95f090 100644
151 --- a/pmstestsuite/library/standard/depend.py
152 +++ b/pmstestsuite/library/standard/depend.py
153 @@ -1,5 +1,5 @@
154 # vim:fileencoding=utf-8
155 -# (c) 2011 Michał Górny <mgorny@g.o>
156 +# (c) 2011-2012 Michał Górny <mgorny@g.o>
157 # Released under the terms of the 2-clause BSD license.
158
159 from .dbus_case import DBusEbuildDependencyTestCase
160 @@ -36,7 +36,7 @@ class PDependTest(DBusEbuildDependencyTestCase):
161 DBusEbuildDependencyTestCase.__init__(self, *args, **kwargs)
162 self.phase_funcs['pkg_postinst'].extend([
163 'pms-test-suite-%s' % self.dependant_ebuilds[0].pv,
164 - 'pms-test-dbus_append_result ${?}'
165 + 'pms-test_dbus_append_result ${?}'
166 ])
167
168 def check_dbus_result(self, output, pm):
169
170 diff --git a/pmstestsuite/library/standard/deprecated_vars.py b/pmstestsuite/library/standard/deprecated_vars.py
171 index 9f695cb..14d1bd6 100644
172 --- a/pmstestsuite/library/standard/deprecated_vars.py
173 +++ b/pmstestsuite/library/standard/deprecated_vars.py
174 @@ -1,5 +1,5 @@
175 # vim:fileencoding=utf-8
176 -# (c) 2011 Michał Górny <mgorny@g.o>
177 +# (c) 2011-2012 Michał Górny <mgorny@g.o>
178 # Released under the terms of the 2-clause BSD license.
179
180 import os.path
181 @@ -16,7 +16,7 @@ class AATest(DBusFetchingEbuildTestCase):
182 }
183 phase_funcs = {
184 'src_unpack': [
185 - 'pms-test-dbus_append_result "${AA}"'
186 + 'pms-test_dbus_append_result "${AA}"'
187 ]
188 }
189
190 @@ -41,7 +41,7 @@ class KVTest(DBusEbuildTestCase):
191 supported_eapis = (range(0, 4), (4,))
192 phase_funcs = {
193 'src_compile': [
194 - 'pms-test-dbus_append_result "${KV}"'
195 + 'pms-test_dbus_append_result "${KV}"'
196 ]
197 }
198
199
200 diff --git a/pmstestsuite/library/standard/phase_function_order.py b/pmstestsuite/library/standard/phase_function_order.py
201 index 2c56d4f..a9f24ac 100644
202 --- a/pmstestsuite/library/standard/phase_function_order.py
203 +++ b/pmstestsuite/library/standard/phase_function_order.py
204 @@ -1,5 +1,5 @@
205 # vim:fileencoding=utf-8
206 -# (c) 2011 Michał Górny <mgorny@g.o>
207 +# (c) 2011-2012 Michał Górny <mgorny@g.o>
208 # Released under the terms of the 2-clause BSD license.
209
210 from .dbus_case import DBusEbuildTestCase
211 @@ -12,7 +12,7 @@ class PhaseFunctionOrderTest(DBusEbuildTestCase):
212 def __init__(self, *args, **kwargs):
213 DBusEbuildTestCase.__init__(self, *args, **kwargs)
214 for k, lines in self.phase_funcs.items():
215 - lines.append('pms-test-dbus_append_result %s' % k)
216 + lines.append('pms-test_dbus_append_result %s' % k)
217
218 def check_dbus_result(self, output, pm):
219 expect = []
220
221 diff --git a/pmstestsuite/library/standard/special_vars.py b/pmstestsuite/library/standard/special_vars.py
222 index eae9ca1..8283a60 100644
223 --- a/pmstestsuite/library/standard/special_vars.py
224 +++ b/pmstestsuite/library/standard/special_vars.py
225 @@ -1,5 +1,5 @@
226 # vim:fileencoding=utf-8
227 -# (c) 2011 Michał Górny <mgorny@g.o>
228 +# (c) 2011-2012 Michał Górny <mgorny@g.o>
229 # Released under the terms of the 2-clause BSD license.
230
231 from .dbus_case import DBusEbuildTestCase
232 @@ -9,15 +9,14 @@ class InheritedVariableTest(DBusEbuildTestCase):
233
234 phase_funcs = {
235 'src_compile': [
236 - 'pms-test-dbus_append_result "${INHERITED}"'
237 + 'pms-test_dbus_append_result "${INHERITED}"'
238 ]
239 }
240
241 def check_dbus_result(self, output, pm):
242 DBusEbuildTestCase.check_dbus_result(self, output, pm)
243 inherits = output[0].split()
244 - self.assertContains('pms-test-dbus', inherits,
245 - 'INHERITED')
246 + self.assertContains('pms-test', inherits, 'INHERITED')
247
248 class RDependFallbackTest(DBusEbuildTestCase):
249 """ Test whether RDEPEND=${DEPEND} fallback works as expected. """
250
251 diff --git a/pmstestsuite/library/standard/variable_scope.py b/pmstestsuite/library/standard/variable_scope.py
252 index 60e3572..bee1d7e 100644
253 --- a/pmstestsuite/library/standard/variable_scope.py
254 +++ b/pmstestsuite/library/standard/variable_scope.py
255 @@ -1,5 +1,5 @@
256 # vim:fileencoding=utf-8
257 -# (c) 2011 Michał Górny <mgorny@g.o>
258 +# (c) 2011-2012 Michał Górny <mgorny@g.o>
259 # Released under the terms of the 2-clause BSD license.
260
261 import re
262 @@ -25,7 +25,7 @@ class VariableScopeTest(DBusEbuildTestCase):
263 'local LOCAL_TEST=bar'
264 ],
265 'src_install': [
266 - 'pms-test-dbus_append_result "$(declare -p %s)"' % var
267 + 'pms-test_dbus_append_result "$(declare -p %s)"' % var
268 for var in ('GLOBAL_TEST', 'UNSET_GLOBAL', 'DEFAULT_TEST',
269 'EXPORT_TEST', 'LOCAL_TEST')
270 ]
271
272 diff --git a/pmstestsuite/repository/pms_eclass.py b/pmstestsuite/repository/pms_eclass.py
273 index 99cbc5e..9be1ee0 100644
274 --- a/pmstestsuite/repository/pms_eclass.py
275 +++ b/pmstestsuite/repository/pms_eclass.py
276 @@ -1,13 +1,15 @@
277 # vim:fileencoding=utf-8
278 -# (c) 2011 Michał Górny <mgorny@g.o>
279 +# (c) 2011-2012 Michał Górny <mgorny@g.o>
280 # Released under the terms of the 2-clause BSD license.
281
282 import os.path
283
284 -eclass_contents = """# Copyright 1999-2011 Gentoo Foundation
285 +eclass_contents = """# Copyright 1999-2012 Gentoo Foundation
286 # Distributed under the terms of the GNU General Public License v2
287 # $Header: $
288
289 +EXPORT_FUNCTIONS pkg_setup
290 +
291 HOMEPAGE="http://www.gentoo.org/proj/en/qa/pms/pms-test-suite.xml"
292 SRC_URI=""
293
294 @@ -15,8 +17,35 @@ LICENSE="as-is"
295 SLOT=${PV}
296 IUSE=""
297
298 +DEPEND="sys-apps/dbus"
299 +
300 RESTRICT="mirror"
301 S=${WORKDIR}
302 +
303 +pms-test_dbus_call() {
304 + local method=${1}
305 + shift
306 +
307 + PMS_TEST_DBUS_P=${P//-/_}
308 + dbus-send \\
309 + --system \\
310 + --print-reply \\
311 + --type=method_call \\
312 + --dest=org.gentoo.pmstestsuite \\
313 + /org/gentoo/pmstestsuite/${PMS_TEST_DBUS_P} \\
314 + org.gentoo.pmstestsuite.${method} \\
315 + "${@}"
316 +}
317 +
318 +pms-test_dbus_append_result() {
319 + pms-test_dbus_call append_output \\
320 + string:"${*}" \\
321 + || die 'Failed to append the test result using dbus'
322 +}
323 +
324 +pms-test_pkg_setup() {
325 + pms-test_dbus_call test_started
326 +}
327 """
328
329 def get_common_eclass_files():