public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
From: "Michał Górny" <mgorny@gentoo.org>
To: gentoo-commits@lists.gentoo.org
Subject: [gentoo-commits] proj/pms-test-suite:master commit in: pmstestsuite/library/standard/, pmstestsuite/repository/
Date: Mon,  2 Jan 2012 22:03:45 +0000 (UTC)	[thread overview]
Message-ID: <efe9fbbe65d0114724b99e016a931902618cc9c7.mgorny@gentoo> (raw)

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():



             reply	other threads:[~2012-01-02 22:04 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-01-02 22:03 Michał Górny [this message]
  -- 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
2011-06-03 17:36 [gentoo-commits] proj/pms-test-suite:master commit in: PMSTestSuite/library/standard/, PMSTestSuite/repository/ Michał Górny

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=efe9fbbe65d0114724b99e016a931902618cc9c7.mgorny@gentoo \
    --to=mgorny@gentoo.org \
    --cc=gentoo-commits@lists.gentoo.org \
    --cc=gentoo-dev@lists.gentoo.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox