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/library/standard/basic/
@ 2011-06-14  8:32 Michał Górny
  0 siblings, 0 replies; 5+ messages in thread
From: Michał Górny @ 2011-06-14  8:32 UTC (permalink / raw
  To: gentoo-commits

commit:     df419b8f8eccc77bab0eb83b379d78f76e9d814f
Author:     Michał Górny <mgorny <AT> gentoo <DOT> org>
AuthorDate: Tue Jun 14 07:27:14 2011 +0000
Commit:     Michał Górny <mgorny <AT> gentoo <DOT> org>
CommitDate: Tue Jun 14 07:28:02 2011 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/pms-test-suite.git;a=commit;h=df419b8f

Use _finalize() to ensure pms-test-dbus_pkg_setup() is called.

---
 .../library/standard/basic/phase_function_order.py |    1 -
 PMSTestSuite/library/standard/dbus_case.py         |    6 +++++-
 2 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/PMSTestSuite/library/standard/basic/phase_function_order.py b/PMSTestSuite/library/standard/basic/phase_function_order.py
index 82889ca..cf4dd0a 100644
--- a/PMSTestSuite/library/standard/basic/phase_function_order.py
+++ b/PMSTestSuite/library/standard/basic/phase_function_order.py
@@ -13,7 +13,6 @@ class PhaseFunctionOrderTest(DBusEbuildTestCase):
 	}
 
 	phase_funcs = dict([(x, [
-		"pms-test-dbus_pkg_setup" if x == 'pkg_setup' else "",
 		"pms-test-dbus_append_result %s" % x
 		]) for x in phase_func_names])
 

diff --git a/PMSTestSuite/library/standard/dbus_case.py b/PMSTestSuite/library/standard/dbus_case.py
index 977d6da..53991ba 100644
--- a/PMSTestSuite/library/standard/dbus_case.py
+++ b/PMSTestSuite/library/standard/dbus_case.py
@@ -33,7 +33,6 @@ pms-test-dbus_call() {
 }
 
 pms-test-dbus_pkg_setup() {
-	# XXX: only for dbus cases
 	pms-test-dbus_call test_started
 }
 
@@ -84,6 +83,11 @@ class DBusEbuildTestCase(EbuildTestCase):
 		EbuildTestCase.__init__(self, *args, **kwargs)
 		self._dbusobj = RunningTest(self)
 
+	def _finalize(self):
+		""" Finalize the object, ensuring pkg_setup() will be called. """
+		if self.phase_funcs['pkg_setup']:
+			self.phase_funcs['pkg_setup'].insert(0, 'pms-test-dbus_pkg_setup')
+
 	def check_dbus_result(self, output, merged):
 		"""
 		Check whether the <output> sent through D-Bus matches expected test



^ permalink raw reply related	[flat|nested] 5+ messages in thread
* [gentoo-commits] proj/pms-test-suite:master commit in: PMSTestSuite/library/standard/, PMSTestSuite/library/standard/basic/
@ 2011-06-17 14:28 Michał Górny
  0 siblings, 0 replies; 5+ messages in thread
From: Michał Górny @ 2011-06-17 14:28 UTC (permalink / raw
  To: gentoo-commits

commit:     e9d3a675ab2e8aa3438e6918ffda30f18fed1992
Author:     Michał Górny <mgorny <AT> gentoo <DOT> org>
AuthorDate: Fri Jun 17 13:50:41 2011 +0000
Commit:     Michał Górny <mgorny <AT> gentoo <DOT> org>
CommitDate: Fri Jun 17 13:50:41 2011 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/pms-test-suite.git;a=commit;h=e9d3a675

Add a D-Bus variant of dependency test case.

---
 PMSTestSuite/library/standard/basic/depend.py |   11 ++++----
 PMSTestSuite/library/standard/dbus_case.py    |   33 +++++++++++++++++++++++++
 2 files changed, 38 insertions(+), 6 deletions(-)

diff --git a/PMSTestSuite/library/standard/basic/depend.py b/PMSTestSuite/library/standard/basic/depend.py
index ef832a0..c91a107 100644
--- a/PMSTestSuite/library/standard/basic/depend.py
+++ b/PMSTestSuite/library/standard/basic/depend.py
@@ -2,8 +2,7 @@
 # (c) 2011 Michał Górny <mgorny@gentoo.org>
 # Released under the terms of the 2-clause BSD license.
 
-from PMSTestSuite.library.standard.dbus_case import DBusEbuildTestCase
-from PMSTestSuite.library.depend_case import EbuildDependencyTestCase
+from PMSTestSuite.library.standard.dbus_case import DBusEbuildTestCase, DBusEbuildDependencyTestCase
 
 class EbuildToucher(DBusEbuildTestCase):
 	""" Touched file installer (for dependency tests). """
@@ -24,26 +23,26 @@ _EOF_'''
 			'newbin mytrue.sh pms-test-suite-%s || die' % self.pv
 		)
 
-class DependTest(EbuildDependencyTestCase):
+class DependTest(DBusEbuildDependencyTestCase):
 	""" DEPEND fulfilling test. """
 
 	relevant_eapis = (0,)
 	depend_classes = [EbuildToucher]
 
 	def __init__(self, *args, **kwargs):
-		EbuildDependencyTestCase.__init__(self, *args, **kwargs)
+		DBusEbuildDependencyTestCase.__init__(self, *args, **kwargs)
 		self.phase_funcs['src_compile'].append(
 			'pms-test-suite-%s || die' % self.depend_objs[0].pv
 		)
 		
-class RDependTest(EbuildDependencyTestCase):
+class RDependTest(DBusEbuildDependencyTestCase):
 	""" RDEPEND fulfilling test. """
 
 	relevant_eapis = (0,)
 	rdepend_classes = [EbuildToucher]
 
 	def __init__(self, *args, **kwargs):
-		EbuildDependencyTestCase.__init__(self, *args, **kwargs)
+		DBusEbuildDependencyTestCase.__init__(self, *args, **kwargs)
 		self.phase_funcs['pkg_postinst'].append(
 			'pms-test-suite-%s || die' % self.rdepend_objs[0].pv
 		)

diff --git a/PMSTestSuite/library/standard/dbus_case.py b/PMSTestSuite/library/standard/dbus_case.py
index 970c897..d67c11b 100644
--- a/PMSTestSuite/library/standard/dbus_case.py
+++ b/PMSTestSuite/library/standard/dbus_case.py
@@ -5,6 +5,8 @@
 import dbus.service
 
 from PMSTestSuite.library.case import EbuildTestCase
+from PMSTestSuite.library.depend_case import EbuildDependencyTestCase
+
 from PMSTestSuite.dbus_handler import DBusHandler, dbus_interface_name, dbus_object_prefix
 
 dbus_handler = DBusHandler()
@@ -103,3 +105,34 @@ class DBusEbuildTestCase(EbuildTestCase):
 	def check_result(self, pm):
 		return self.dbus_started \
 			and self.check_dbus_result('\n'.join(self.dbus_output), pm)
+
+class DBusEbuildDependencyTestCase(EbuildDependencyTestCase):
+	""" D-Bus capable dependency test case. """
+
+	inherits = ['pms-test-dbus']
+
+	def __init__(self, *args, **kwargs):
+		""" Initialize the test case and the D-Bus object for it. """
+		EbuildDependencyTestCase.__init__(self, *args, **kwargs)
+		self._dbusobj = RunningTest(self)
+
+	def _finalize(self):
+		""" Finalize the object, ensuring pkg_setup() will be called. """
+		if self.phase_funcs['pkg_setup']:
+			self.phase_funcs['pkg_setup'].insert(0, 'pms-test-dbus_pkg_setup')
+
+	def check_dbus_result(self, output, pm):
+		"""
+		Check whether the <output> sent through D-Bus matches expected test
+		output.
+
+		Return True if it does, False otherwise.
+
+		The default implementation simply checks whether the test was merged
+		alike EbuildDependencyTestCase.check_result().
+		"""
+		return EbuildDependencyTestCase.check_result(self, pm)
+
+	def check_result(self, pm):
+		return self.dbus_started \
+			and self.check_dbus_result('\n'.join(self.dbus_output), pm)



^ permalink raw reply related	[flat|nested] 5+ messages in thread
* [gentoo-commits] proj/pms-test-suite:master commit in: PMSTestSuite/library/standard/, PMSTestSuite/library/standard/basic/
@ 2011-06-14 12:35 Michał Górny
  0 siblings, 0 replies; 5+ messages in thread
From: Michał Górny @ 2011-06-14 12:35 UTC (permalink / raw
  To: gentoo-commits

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

Add an RDEPEND test.

---
 PMSTestSuite/library/standard/__init__.py     |    3 ++-
 PMSTestSuite/library/standard/basic/depend.py |   12 ++++++++++++
 2 files changed, 14 insertions(+), 1 deletions(-)

diff --git a/PMSTestSuite/library/standard/__init__.py b/PMSTestSuite/library/standard/__init__.py
index 23b4895..baa8a02 100644
--- a/PMSTestSuite/library/standard/__init__.py
+++ b/PMSTestSuite/library/standard/__init__.py
@@ -15,7 +15,8 @@ class StandardTestLibrary(TestLibrary):
 	test_names=[
 		'basic.phase_function_order.PhaseFunctionOrderTest',
 		'basic.doins_fail.DoInsFailureTest',
-		'basic.depend.DependTest'
+		'basic.depend.DependTest',
+		'basic.depend.RDependTest'
 	]
 
 	def get_common_files(self):

diff --git a/PMSTestSuite/library/standard/basic/depend.py b/PMSTestSuite/library/standard/basic/depend.py
index 171b6f0..ef832a0 100644
--- a/PMSTestSuite/library/standard/basic/depend.py
+++ b/PMSTestSuite/library/standard/basic/depend.py
@@ -35,3 +35,15 @@ class DependTest(EbuildDependencyTestCase):
 		self.phase_funcs['src_compile'].append(
 			'pms-test-suite-%s || die' % self.depend_objs[0].pv
 		)
+		
+class RDependTest(EbuildDependencyTestCase):
+	""" RDEPEND fulfilling test. """
+
+	relevant_eapis = (0,)
+	rdepend_classes = [EbuildToucher]
+
+	def __init__(self, *args, **kwargs):
+		EbuildDependencyTestCase.__init__(self, *args, **kwargs)
+		self.phase_funcs['pkg_postinst'].append(
+			'pms-test-suite-%s || die' % self.rdepend_objs[0].pv
+		)



^ permalink raw reply related	[flat|nested] 5+ messages in thread
* [gentoo-commits] proj/pms-test-suite:master commit in: PMSTestSuite/library/standard/, PMSTestSuite/library/standard/basic/
@ 2011-06-03 17:36 Michał Górny
  0 siblings, 0 replies; 5+ messages in thread
From: Michał Górny @ 2011-06-03 17:36 UTC (permalink / raw
  To: gentoo-commits

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

Support using DBusEbuildTestCase for no-output tests.

D-Bus is used there to ensure the tests are actually run.

---
 PMSTestSuite/library/standard/basic/doins_fail.py  |    6 +++---
 .../library/standard/basic/phase_function_order.py |    2 +-
 PMSTestSuite/library/standard/dbus_case.py         |   14 +++++++++++++-
 3 files changed, 17 insertions(+), 5 deletions(-)

diff --git a/PMSTestSuite/library/standard/basic/doins_fail.py b/PMSTestSuite/library/standard/basic/doins_fail.py
index acd254b..841c02b 100644
--- a/PMSTestSuite/library/standard/basic/doins_fail.py
+++ b/PMSTestSuite/library/standard/basic/doins_fail.py
@@ -2,9 +2,9 @@
 # (c) 2011 Michał Górny <mgorny@gentoo.org>
 # Released under the terms of the 2-clause BSD license.
 
-from PMSTestSuite.library.case import EbuildTestCase
+from PMSTestSuite.library.standard.dbus_case import DBusEbuildTestCase
 
-class DoInsFailureTest(EbuildTestCase):
+class DoInsFailureTest(DBusEbuildTestCase):
 	relevant_eapis = (0, 4)
 
 	ebuild_vars = {
@@ -18,7 +18,7 @@ class DoInsFailureTest(EbuildTestCase):
 		]
 	}
 
-	def check_result(self, res):
+	def check_dbus_result(self, output, res):
 		# expect success in EAPI 0
 		# and failure in EAPI 4
 		return (res == (self.eapi == 0))

diff --git a/PMSTestSuite/library/standard/basic/phase_function_order.py b/PMSTestSuite/library/standard/basic/phase_function_order.py
index 4bc9104..64ce3aa 100644
--- a/PMSTestSuite/library/standard/basic/phase_function_order.py
+++ b/PMSTestSuite/library/standard/basic/phase_function_order.py
@@ -15,7 +15,7 @@ class PhaseFunctionOrderTest(DBusEbuildTestCase):
 	phase_funcs = dict([(x, ["pms-test_append_result %s" % x])
 		for x in phase_func_names])
 
-	def check_output(self, output):
+	def check_dbus_result(self, output, res):
 		if self.eapi < 2:
 			expect = """pkg_setup
 src_unpack

diff --git a/PMSTestSuite/library/standard/dbus_case.py b/PMSTestSuite/library/standard/dbus_case.py
index 610a673..e69b646 100644
--- a/PMSTestSuite/library/standard/dbus_case.py
+++ b/PMSTestSuite/library/standard/dbus_case.py
@@ -47,6 +47,18 @@ class DBusEbuildTestCase(EbuildTestCase):
 		EbuildTestCase.__init__(self, *args, **kwargs)
 		self._dbusobj = RunningTest(self)
 
+	def check_dbus_result(self, output, merged):
+		"""
+		Check whether the <output> sent through D-Bus matches expected test
+		output, and whether <merged> matches expected test result.
+
+		Return True if it does, False otherwise.
+
+		The default implementation uses self.expect_failure like the default
+		check_result() of EbuildTestCase.
+		"""
+		return (merged != self.expect_failure)
+
 	def check_result(self, res):
 		return self.dbus_started \
-			and self.check_output('\n'.join(self.dbus_output))
+			and self.check_dbus_result('\n'.join(self.dbus_output), res)



^ permalink raw reply related	[flat|nested] 5+ messages in thread
* [gentoo-commits] proj/pms-test-suite:master commit in: PMSTestSuite/library/standard/, PMSTestSuite/library/standard/basic/
@ 2011-06-03  5:51 Michał Górny
  0 siblings, 0 replies; 5+ messages in thread
From: Michał Górny @ 2011-06-03  5:51 UTC (permalink / raw
  To: gentoo-commits

commit:     2e28e0a910592fed0a0483c75e8362901dac982d
Author:     Michał Górny <mgorny <AT> gentoo <DOT> org>
AuthorDate: Fri Jun  3 05:50:56 2011 +0000
Commit:     Michał Górny <mgorny <AT> gentoo <DOT> org>
CommitDate: Fri Jun  3 05:50:56 2011 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/pms-test-suite.git;a=commit;h=2e28e0a9

Add a doins failure handling test.

Failing doins should return a non-zero exit code in EAPI < 4, and die in
EAPI 4.

---
 PMSTestSuite/library/standard/__init__.py         |    3 +-
 PMSTestSuite/library/standard/basic/doins_fail.py |   24 +++++++++++++++++++++
 2 files changed, 26 insertions(+), 1 deletions(-)

diff --git a/PMSTestSuite/library/standard/__init__.py b/PMSTestSuite/library/standard/__init__.py
index 24971b6..96021d2 100644
--- a/PMSTestSuite/library/standard/__init__.py
+++ b/PMSTestSuite/library/standard/__init__.py
@@ -10,5 +10,6 @@ class ExampleLibrary(TestLibrary):
 	"""
 
 	test_names=[
-		'basic.phase_function_order.PhaseFunctionOrderTest'
+		'basic.phase_function_order.PhaseFunctionOrderTest',
+		'basic.doins_fail.DoInsFailureTest'
 	]

diff --git a/PMSTestSuite/library/standard/basic/doins_fail.py b/PMSTestSuite/library/standard/basic/doins_fail.py
new file mode 100644
index 0000000..acd254b
--- /dev/null
+++ b/PMSTestSuite/library/standard/basic/doins_fail.py
@@ -0,0 +1,24 @@
+#	vim:fileencoding=utf-8
+# (c) 2011 Michał Górny <mgorny@gentoo.org>
+# Released under the terms of the 2-clause BSD license.
+
+from PMSTestSuite.library.case import EbuildTestCase
+
+class DoInsFailureTest(EbuildTestCase):
+	relevant_eapis = (0, 4)
+
+	ebuild_vars = {
+		'DESCRIPTION': 'do*() failure handling test'
+	}
+
+	phase_funcs = {
+		'src_install': [
+			'doins testzor',
+			'[[ ${?} -ne 0 ]] || die "doins exitcode = 0!"'
+		]
+	}
+
+	def check_result(self, res):
+		# expect success in EAPI 0
+		# and failure in EAPI 4
+		return (res == (self.eapi == 0))



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

end of thread, other threads:[~2011-06-17 14:28 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-06-14  8:32 [gentoo-commits] proj/pms-test-suite:master commit in: PMSTestSuite/library/standard/, PMSTestSuite/library/standard/basic/ Michał Górny
  -- strict thread matches above, loose matches on Subject: below --
2011-06-17 14:28 Michał Górny
2011-06-14 12:35 Michał Górny
2011-06-03 17:36 Michał Górny
2011-06-03  5:51 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