public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-commits] proj/pms-test-suite:master commit in: PMSTestSuite/library/standard/, PMSTestSuite/repository/
@ 2011-06-03 17:36 Michał Górny
  0 siblings, 0 replies; 3+ messages in thread
From: Michał Górny @ 2011-06-03 17:36 UTC (permalink / raw
  To: gentoo-commits

commit:     2cea380313ef7210a84dc0687f1ec6761a25fd4e
Author:     Michał Górny <mgorny <AT> gentoo <DOT> org>
AuthorDate: Fri Jun  3 16:59:54 2011 +0000
Commit:     Michał Górny <mgorny <AT> gentoo <DOT> org>
CommitDate: Fri Jun  3 17:00:25 2011 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/pms-test-suite.git;a=commit;h=2cea3803

For DBusEbuildTests, ensure they were started (using D-Bus).

---
 PMSTestSuite/library/standard/dbus_case.py |   11 ++++++++++-
 PMSTestSuite/repository/pms_eclass.py      |   19 ++++++++++++++-----
 2 files changed, 24 insertions(+), 6 deletions(-)

diff --git a/PMSTestSuite/library/standard/dbus_case.py b/PMSTestSuite/library/standard/dbus_case.py
index 08778fa..610a673 100644
--- a/PMSTestSuite/library/standard/dbus_case.py
+++ b/PMSTestSuite/library/standard/dbus_case.py
@@ -18,6 +18,7 @@ class RunningTest(dbus.service.Object):
 		"""
 		self.test = test
 		self.test.dbus_output = []
+		self.test.dbus_started = False
 		dbus.service.Object.__init__(
 				self,
 				dbus_handler.bus,
@@ -26,6 +27,13 @@ class RunningTest(dbus.service.Object):
 
 	@dbus.service.method(
 			dbus_interface=dbus_interface_name,
+			in_signature='', out_signature='')
+	def test_started(self):
+		""" Notify the test suite that a particular test has been started. """
+		self.test.dbus_started = True
+
+	@dbus.service.method(
+			dbus_interface=dbus_interface_name,
 			in_signature='s', out_signature='')
 	def append_output(self, l):
 		""" Append the line <l> to the test output. """
@@ -40,4 +48,5 @@ class DBusEbuildTestCase(EbuildTestCase):
 		self._dbusobj = RunningTest(self)
 
 	def check_result(self, res):
-		return self.check_output('\n'.join(self.dbus_output))
+		return self.dbus_started \
+			and self.check_output('\n'.join(self.dbus_output))

diff --git a/PMSTestSuite/repository/pms_eclass.py b/PMSTestSuite/repository/pms_eclass.py
index 21f1ac3..6a6c756 100644
--- a/PMSTestSuite/repository/pms_eclass.py
+++ b/PMSTestSuite/repository/pms_eclass.py
@@ -22,11 +22,10 @@ S=${WORKDIR}
 
 EXPORT_FUNCTIONS pkg_setup
 
-pms-test_pkg_setup() {
-	:
-}
+pms-test__dbus_call() {
+	local method=${1}
+	shift
 
-pms-test_append_result() {
 	PMS_TEST_DBUS_P=${P//-/_}
 	dbus-send \\
 		--system \\
@@ -34,7 +33,17 @@ pms-test_append_result() {
 		--type=method_call \\
 		--dest=org.gentoo.PMSTestSuite \\
 		/org/gentoo/PMSTestSuite/${PMS_TEST_DBUS_P} \\
-		org.gentoo.PMSTestSuite.append_output \\
+		org.gentoo.PMSTestSuite.${method} \\
+		"${@}"
+}
+
+pms-test_pkg_setup() {
+	# XXX: only for dbus cases
+	pms-test__dbus_call test_started
+}
+
+pms-test_append_result() {
+	pms-test__dbus_call append_output \\
 		string:"${*}" \\
 		|| die 'Failed to append the test result using dbus'
 }"""



^ permalink raw reply related	[flat|nested] 3+ messages in thread

* [gentoo-commits] proj/pms-test-suite:master commit in: pmstestsuite/library/standard/, pmstestsuite/repository/
@ 2011-06-29 12:58 Michał Górny
  0 siblings, 0 replies; 3+ messages in thread
From: Michał Górny @ 2011-06-29 12:58 UTC (permalink / raw
  To: gentoo-commits

commit:     ee860a5f98baac4ada1dbe39ffe085b64f32e358
Author:     Michał Górny <mgorny <AT> gentoo <DOT> org>
AuthorDate: Wed Jun 29 12:19:33 2011 +0000
Commit:     Michał Górny <mgorny <AT> gentoo <DOT> org>
CommitDate: Wed Jun 29 12:19:33 2011 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/pms-test-suite.git;a=commit;h=ee860a5f

Move mirroring restriction to the eclass.

---
 pmstestsuite/library/standard/workdir_fallback.py |    1 -
 pmstestsuite/repository/pms_eclass.py             |    1 +
 2 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/pmstestsuite/library/standard/workdir_fallback.py b/pmstestsuite/library/standard/workdir_fallback.py
index de3c3ce..142c33c 100644
--- a/pmstestsuite/library/standard/workdir_fallback.py
+++ b/pmstestsuite/library/standard/workdir_fallback.py
@@ -15,7 +15,6 @@ class WorkdirFallbackTest(DBusEbuildTestCase):
 	# 3) have one of the further phase funcs.
 
 	ebuild_vars = {
-		'RESTRICT': 'mirror',
 		'SRC_URI': 'http://www.gentoo.org/ -> pms-test-suite-dummy.html',
 		'S': '${WORKDIR}/nonexistent'
 	}

diff --git a/pmstestsuite/repository/pms_eclass.py b/pmstestsuite/repository/pms_eclass.py
index b17714e..0d26d59 100644
--- a/pmstestsuite/repository/pms_eclass.py
+++ b/pmstestsuite/repository/pms_eclass.py
@@ -16,6 +16,7 @@ SLOT=${PV}
 KEYWORDS="alpha amd64 arm hppa ia64 m68k ~mips ppc ppc64 s390 sh sparc x86"
 IUSE=""
 
+RESTRICT="mirror"
 S=${WORKDIR}
 """
 



^ permalink raw reply related	[flat|nested] 3+ messages in thread

* [gentoo-commits] proj/pms-test-suite:master commit in: pmstestsuite/library/standard/, pmstestsuite/repository/
@ 2012-01-02 22:03 Michał Górny
  0 siblings, 0 replies; 3+ messages in thread
From: Michał Górny @ 2012-01-02 22:03 UTC (permalink / raw
  To: gentoo-commits

commit:     efe9fbbe65d0114724b99e016a931902618cc9c7
Author:     Michał Górny <mgorny <AT> gentoo <DOT> org>
AuthorDate: Mon Jan  2 20:28:44 2012 +0000
Commit:     Michał Górny <mgorny <AT> gentoo <DOT> org>
CommitDate: Mon Jan  2 20:55:41 2012 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/pms-test-suite.git;a=commit;h=efe9fbbe

Integrate D-Bus code into the main eclass.

---
 pmstestsuite/library/standard/__init__.py          |    9 +----
 pmstestsuite/library/standard/banned_commands.py   |    8 ++--
 pmstestsuite/library/standard/dbus_case.py         |   38 +-------------------
 pmstestsuite/library/standard/depend.py            |    4 +-
 pmstestsuite/library/standard/deprecated_vars.py   |    6 ++--
 .../library/standard/phase_function_order.py       |    4 +-
 pmstestsuite/library/standard/special_vars.py      |    7 ++--
 pmstestsuite/library/standard/variable_scope.py    |    4 +-
 pmstestsuite/repository/pms_eclass.py              |   33 ++++++++++++++++-
 9 files changed, 49 insertions(+), 64 deletions(-)

diff --git a/pmstestsuite/library/standard/__init__.py b/pmstestsuite/library/standard/__init__.py
index e3ab8ec..3e87200 100644
--- a/pmstestsuite/library/standard/__init__.py
+++ b/pmstestsuite/library/standard/__init__.py
@@ -1,13 +1,11 @@
 #	vim:fileencoding=utf-8
-# (c) 2011 Michał Górny <mgorny@gentoo.org>
+# (c) 2011-2012 Michał Górny <mgorny@gentoo.org>
 # Released under the terms of the 2-clause BSD license.
 
 import os.path
 
 from pmstestsuite.library import TestLibrary
 
-from .dbus_case import pms_dbus_eclass
-
 class StandardTestLibrary(TestLibrary):
 	"""
 	Standard test library for the PMS Test Suite.
@@ -36,8 +34,3 @@ class StandardTestLibrary(TestLibrary):
 		'variable_scope.VariableScopeTest',
 		'workdir_fallback.WorkdirFallbackTest'
 	]
-
-	def get_common_files(self):
-		return {
-			os.path.join('eclass', 'pms-test-dbus.eclass'): pms_dbus_eclass
-		}

diff --git a/pmstestsuite/library/standard/banned_commands.py b/pmstestsuite/library/standard/banned_commands.py
index 1eae774..216d6df 100644
--- a/pmstestsuite/library/standard/banned_commands.py
+++ b/pmstestsuite/library/standard/banned_commands.py
@@ -1,5 +1,5 @@
 #	vim:fileencoding=utf-8
-# (c) 2011 Michał Górny <mgorny@gentoo.org>
+# (c) 2011-2012 Michał Górny <mgorny@gentoo.org>
 # Released under the terms of the 2-clause BSD license.
 
 from .dbus_case import DBusEbuildTestCase
@@ -25,10 +25,10 @@ class DoHardCommandTest(BannedCommandTest):
 		self.phase_funcs['src_install'].extend([
 				'dohard %s/foo %s/bar || die' % (self._path, self._path),
 				'[[ "${D}"%s/foo -ef "${D}"%s/bar ]]' % (self._path, self._path),
-				'pms-test-dbus_append_result ${?}'])
+				'pms-test_dbus_append_result ${?}'])
 		self.phase_funcs['pkg_postinst'].extend([
 				'[[ "${ROOT}"%s/foo -ef "${ROOT}"%s/bar ]]' % (self._path, self._path),
-				'pms-test-dbus_append_result ${?}'])
+				'pms-test_dbus_append_result ${?}'])
 
 	def check_dbus_result(self, output, pm):
 		try:
@@ -73,7 +73,7 @@ class DoSedCommandTest(BannedCommandTest):
 		BannedCommandTest.__init__(self, *args, **kwargs)
 		self.phase_funcs['src_install'].extend([
 				"dosed -e '$i SED WORKED' %s/foo || die" % self._path,
-				'pms-test-dbus_append_result "$(cat "${D}"%s/foo)"' % self._path])
+				'pms-test_dbus_append_result "$(cat "${D}"%s/foo)"' % self._path])
 
 	def check_dbus_result(self, output, pm):
 		try:

diff --git a/pmstestsuite/library/standard/dbus_case.py b/pmstestsuite/library/standard/dbus_case.py
index 6bfbd88..672ace5 100644
--- a/pmstestsuite/library/standard/dbus_case.py
+++ b/pmstestsuite/library/standard/dbus_case.py
@@ -13,40 +13,6 @@ from pmstestsuite.dbus_handler import DBusHandler, dbus_interface_name, dbus_obj
 
 dbus_handler = DBusHandler()
 
-pms_dbus_eclass = """# Copyright 1999-2011 Gentoo Foundation
-# Distributed under the terms of the GNU General Public License v2
-# $Header: $
-
-DEPEND="sys-apps/dbus"
-
-EXPORT_FUNCTIONS pkg_setup
-
-pms-test-dbus_call() {
-	local method=${1}
-	shift
-
-	PMS_TEST_DBUS_P=${P//-/_}
-	dbus-send \\
-		--system \\
-		--print-reply \\
-		--type=method_call \\
-		--dest=org.gentoo.pmstestsuite \\
-		/org/gentoo/pmstestsuite/${PMS_TEST_DBUS_P} \\
-		org.gentoo.pmstestsuite.${method} \\
-		"${@}"
-}
-
-pms-test-dbus_pkg_setup() {
-	pms-test-dbus_call test_started
-}
-
-pms-test-dbus_append_result() {
-	pms-test-dbus_call append_output \\
-		string:"${*}" \\
-		|| die 'Failed to append the test result using dbus'
-}
-"""
-
 class RunningTest(dbus.service.Object):
 	""" A class encapsulating a running test. """
 
@@ -96,8 +62,6 @@ class RunningTest(dbus.service.Object):
 class DBusBaseTestCase(object):
 	""" A base D-Bus test case class. """
 
-	inherits = ['pms-test-dbus']
-
 	def __init__(self):
 		self._dbusobj = RunningTest(self)
 
@@ -106,7 +70,7 @@ class DBusBaseTestCase(object):
 		Finalize the object, ensuring that C{pkg_setup()} will be called.
 		"""
 		if self.phase_funcs['pkg_setup']:
-			self.phase_funcs['pkg_setup'].insert(0, 'pms-test-dbus_pkg_setup')
+			self.phase_funcs['pkg_setup'].insert(0, 'pms-test_pkg_setup')
 
 	def check_dbus_result(self, output, pm):
 		"""

diff --git a/pmstestsuite/library/standard/depend.py b/pmstestsuite/library/standard/depend.py
index a773b25..f95f090 100644
--- a/pmstestsuite/library/standard/depend.py
+++ b/pmstestsuite/library/standard/depend.py
@@ -1,5 +1,5 @@
 #	vim:fileencoding=utf-8
-# (c) 2011 Michał Górny <mgorny@gentoo.org>
+# (c) 2011-2012 Michał Górny <mgorny@gentoo.org>
 # Released under the terms of the 2-clause BSD license.
 
 from .dbus_case import DBusEbuildDependencyTestCase
@@ -36,7 +36,7 @@ class PDependTest(DBusEbuildDependencyTestCase):
 		DBusEbuildDependencyTestCase.__init__(self, *args, **kwargs)
 		self.phase_funcs['pkg_postinst'].extend([
 			'pms-test-suite-%s' % self.dependant_ebuilds[0].pv,
-			'pms-test-dbus_append_result ${?}'
+			'pms-test_dbus_append_result ${?}'
 		])
 
 	def check_dbus_result(self, output, pm):

diff --git a/pmstestsuite/library/standard/deprecated_vars.py b/pmstestsuite/library/standard/deprecated_vars.py
index 9f695cb..14d1bd6 100644
--- a/pmstestsuite/library/standard/deprecated_vars.py
+++ b/pmstestsuite/library/standard/deprecated_vars.py
@@ -1,5 +1,5 @@
 #	vim:fileencoding=utf-8
-# (c) 2011 Michał Górny <mgorny@gentoo.org>
+# (c) 2011-2012 Michał Górny <mgorny@gentoo.org>
 # Released under the terms of the 2-clause BSD license.
 
 import os.path
@@ -16,7 +16,7 @@ class AATest(DBusFetchingEbuildTestCase):
 	}
 	phase_funcs = {
 		'src_unpack': [
-			'pms-test-dbus_append_result "${AA}"'
+			'pms-test_dbus_append_result "${AA}"'
 		]
 	}
 
@@ -41,7 +41,7 @@ class KVTest(DBusEbuildTestCase):
 	supported_eapis = (range(0, 4), (4,))
 	phase_funcs = {
 		'src_compile': [
-			'pms-test-dbus_append_result "${KV}"'
+			'pms-test_dbus_append_result "${KV}"'
 		]
 	}
 

diff --git a/pmstestsuite/library/standard/phase_function_order.py b/pmstestsuite/library/standard/phase_function_order.py
index 2c56d4f..a9f24ac 100644
--- a/pmstestsuite/library/standard/phase_function_order.py
+++ b/pmstestsuite/library/standard/phase_function_order.py
@@ -1,5 +1,5 @@
 #	vim:fileencoding=utf-8
-# (c) 2011 Michał Górny <mgorny@gentoo.org>
+# (c) 2011-2012 Michał Górny <mgorny@gentoo.org>
 # Released under the terms of the 2-clause BSD license.
 
 from .dbus_case import DBusEbuildTestCase
@@ -12,7 +12,7 @@ class PhaseFunctionOrderTest(DBusEbuildTestCase):
 	def __init__(self, *args, **kwargs):
 		DBusEbuildTestCase.__init__(self, *args, **kwargs)
 		for k, lines in self.phase_funcs.items():
-			lines.append('pms-test-dbus_append_result %s' % k)
+			lines.append('pms-test_dbus_append_result %s' % k)
 
 	def check_dbus_result(self, output, pm):
 		expect = []

diff --git a/pmstestsuite/library/standard/special_vars.py b/pmstestsuite/library/standard/special_vars.py
index eae9ca1..8283a60 100644
--- a/pmstestsuite/library/standard/special_vars.py
+++ b/pmstestsuite/library/standard/special_vars.py
@@ -1,5 +1,5 @@
 #	vim:fileencoding=utf-8
-# (c) 2011 Michał Górny <mgorny@gentoo.org>
+# (c) 2011-2012 Michał Górny <mgorny@gentoo.org>
 # Released under the terms of the 2-clause BSD license.
 
 from .dbus_case import DBusEbuildTestCase
@@ -9,15 +9,14 @@ class InheritedVariableTest(DBusEbuildTestCase):
 
 	phase_funcs = {
 		'src_compile': [
-			'pms-test-dbus_append_result "${INHERITED}"'
+			'pms-test_dbus_append_result "${INHERITED}"'
 		]
 	}
 
 	def check_dbus_result(self, output, pm):
 		DBusEbuildTestCase.check_dbus_result(self, output, pm)
 		inherits = output[0].split()
-		self.assertContains('pms-test-dbus', inherits,
-				'INHERITED')
+		self.assertContains('pms-test', inherits, 'INHERITED')
 
 class RDependFallbackTest(DBusEbuildTestCase):
 	""" Test whether RDEPEND=${DEPEND} fallback works as expected. """

diff --git a/pmstestsuite/library/standard/variable_scope.py b/pmstestsuite/library/standard/variable_scope.py
index 60e3572..bee1d7e 100644
--- a/pmstestsuite/library/standard/variable_scope.py
+++ b/pmstestsuite/library/standard/variable_scope.py
@@ -1,5 +1,5 @@
 #	vim:fileencoding=utf-8
-# (c) 2011 Michał Górny <mgorny@gentoo.org>
+# (c) 2011-2012 Michał Górny <mgorny@gentoo.org>
 # Released under the terms of the 2-clause BSD license.
 
 import re
@@ -25,7 +25,7 @@ class VariableScopeTest(DBusEbuildTestCase):
 			'local LOCAL_TEST=bar'
 		],
 		'src_install': [
-			'pms-test-dbus_append_result "$(declare -p %s)"' % var
+			'pms-test_dbus_append_result "$(declare -p %s)"' % var
 				for var in ('GLOBAL_TEST', 'UNSET_GLOBAL', 'DEFAULT_TEST',
 					'EXPORT_TEST', 'LOCAL_TEST')
 		]

diff --git a/pmstestsuite/repository/pms_eclass.py b/pmstestsuite/repository/pms_eclass.py
index 99cbc5e..9be1ee0 100644
--- a/pmstestsuite/repository/pms_eclass.py
+++ b/pmstestsuite/repository/pms_eclass.py
@@ -1,13 +1,15 @@
 #	vim:fileencoding=utf-8
-# (c) 2011 Michał Górny <mgorny@gentoo.org>
+# (c) 2011-2012 Michał Górny <mgorny@gentoo.org>
 # Released under the terms of the 2-clause BSD license.
 
 import os.path
 
-eclass_contents = """# Copyright 1999-2011 Gentoo Foundation
+eclass_contents = """# Copyright 1999-2012 Gentoo Foundation
 # Distributed under the terms of the GNU General Public License v2
 # $Header: $
 
+EXPORT_FUNCTIONS pkg_setup
+
 HOMEPAGE="http://www.gentoo.org/proj/en/qa/pms/pms-test-suite.xml"
 SRC_URI=""
 
@@ -15,8 +17,35 @@ LICENSE="as-is"
 SLOT=${PV}
 IUSE=""
 
+DEPEND="sys-apps/dbus"
+
 RESTRICT="mirror"
 S=${WORKDIR}
+
+pms-test_dbus_call() {
+	local method=${1}
+	shift
+
+	PMS_TEST_DBUS_P=${P//-/_}
+	dbus-send \\
+		--system \\
+		--print-reply \\
+		--type=method_call \\
+		--dest=org.gentoo.pmstestsuite \\
+		/org/gentoo/pmstestsuite/${PMS_TEST_DBUS_P} \\
+		org.gentoo.pmstestsuite.${method} \\
+		"${@}"
+}
+
+pms-test_dbus_append_result() {
+	pms-test_dbus_call append_output \\
+		string:"${*}" \\
+		|| die 'Failed to append the test result using dbus'
+}
+
+pms-test_pkg_setup() {
+	pms-test_dbus_call test_started
+}
 """
 
 def get_common_eclass_files():



^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2012-01-02 22:04 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-06-03 17:36 [gentoo-commits] proj/pms-test-suite:master commit in: PMSTestSuite/library/standard/, PMSTestSuite/repository/ Michał Górny
  -- strict thread matches above, loose matches on Subject: below --
2011-06-29 12:58 [gentoo-commits] proj/pms-test-suite:master commit in: pmstestsuite/library/standard/, pmstestsuite/repository/ Michał Górny
2012-01-02 22:03 Michał Górny

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox