aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichał Górny <mgorny@gentoo.org>2012-01-02 21:28:44 +0100
committerMichał Górny <mgorny@gentoo.org>2012-01-02 21:55:41 +0100
commitefe9fbbe65d0114724b99e016a931902618cc9c7 (patch)
tree49423fe0276c89bbc63df8202e15925408928d46
parentFill in the actual name in COPYING. (diff)
downloadpms-test-suite-efe9fbbe65d0114724b99e016a931902618cc9c7.tar.gz
pms-test-suite-efe9fbbe65d0114724b99e016a931902618cc9c7.tar.bz2
pms-test-suite-efe9fbbe65d0114724b99e016a931902618cc9c7.zip
Integrate D-Bus code into the main eclass.
-rw-r--r--pmstestsuite/library/standard/__init__.py9
-rw-r--r--pmstestsuite/library/standard/banned_commands.py8
-rw-r--r--pmstestsuite/library/standard/dbus_case.py38
-rw-r--r--pmstestsuite/library/standard/depend.py4
-rw-r--r--pmstestsuite/library/standard/deprecated_vars.py6
-rw-r--r--pmstestsuite/library/standard/phase_function_order.py4
-rw-r--r--pmstestsuite/library/standard/special_vars.py7
-rw-r--r--pmstestsuite/library/standard/variable_scope.py4
-rw-r--r--pmstestsuite/repository/pms_eclass.py33
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():