From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from pigeon.gentoo.org ([208.92.234.80] helo=lists.gentoo.org) by finch.gentoo.org with esmtp (Exim 4.60) (envelope-from ) id 1Qphog-0005dD-1Z for garchives@archives.gentoo.org; Sat, 06 Aug 2011 14:25:30 +0000 Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id CB46C21C160; Sat, 6 Aug 2011 14:25:02 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) by pigeon.gentoo.org (Postfix) with ESMTP id 8A31021C186 for ; Sat, 6 Aug 2011 14:25:02 +0000 (UTC) Received: from pelican.gentoo.org (unknown [66.219.59.40]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id 03F741B402A for ; Sat, 6 Aug 2011 14:25:02 +0000 (UTC) Received: from localhost.localdomain (localhost [127.0.0.1]) by pelican.gentoo.org (Postfix) with ESMTP id 3B84980048 for ; Sat, 6 Aug 2011 14:25:00 +0000 (UTC) From: "Michał Górny" To: gentoo-commits@lists.gentoo.org Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Michał Górny" Message-ID: <752f45f2cb79d9805b71d69d771a259b100724f3.mgorny@gentoo> Subject: [gentoo-commits] proj/pms-test-suite:master commit in: pmstestsuite/library/, pmstestsuite/ X-VCS-Repository: proj/pms-test-suite X-VCS-Files: pmstestsuite/cli.py pmstestsuite/library/__init__.py pmstestsuite/library/case.py X-VCS-Directories: pmstestsuite/library/ pmstestsuite/ X-VCS-Committer: mgorny X-VCS-Committer-Name: Michał Górny X-VCS-Revision: 752f45f2cb79d9805b71d69d771a259b100724f3 Date: Sat, 6 Aug 2011 14:25:00 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: quoted-printable X-Archives-Salt: X-Archives-Hash: 44aecc23df9c5b11bff5257f88aa659a commit: 752f45f2cb79d9805b71d69d771a259b100724f3 Author: Micha=C5=82 G=C3=B3rny gentoo org> AuthorDate: Sat Aug 6 13:49:41 2011 +0000 Commit: Micha=C5=82 G=C3=B3rny gentoo org> CommitDate: Sat Aug 6 13:51:35 2011 +0000 URL: http://git.overlays.gentoo.org/gitweb/?p=3Dproj/pms-test-suit= e.git;a=3Dcommit;h=3D752f45f2 Support running tests in undefined-behavior EAPIs. --- pmstestsuite/cli.py | 5 ++++- pmstestsuite/library/__init__.py | 6 ++++-- pmstestsuite/library/case.py | 15 ++++++++++++--- 3 files changed, 20 insertions(+), 6 deletions(-) diff --git a/pmstestsuite/cli.py b/pmstestsuite/cli.py index 401e83d..2b746ae 100644 --- a/pmstestsuite/cli.py +++ b/pmstestsuite/cli.py @@ -79,6 +79,9 @@ class PMSTestSuiteCLI(object): opt.add_option('-T', '--thorough', dest=3D'thorough', help=3D'Run tests thoroughly (i.e. in all possible variants)', action=3D'store_true', default=3DFalse) + opt.add_option('-U', '--unsupported-eapis', dest=3D'undefined', + help=3D'Run tests in undefined-behavior EAPIs as well', + action=3D'store_true', default=3DFalse) opt.add_option('-v', '--verbose', dest=3D'verbose', help=3D'Report test results verbosely (even if they succeed)', action=3D'store_true', default=3DFalse) @@ -150,7 +153,7 @@ class PMSTestSuiteCLI(object): =20 try: self.test_library =3D load_library(opts.library_name, - thorough =3D opts.thorough) + thorough =3D opts.thorough, undefined =3D opts.undefined) except (ImportError, TypeError) as e: opt.error('Test library load failed: %s' % e) =20 diff --git a/pmstestsuite/library/__init__.py b/pmstestsuite/library/__in= it__.py index c286d22..473e9b0 100644 --- a/pmstestsuite/library/__init__.py +++ b/pmstestsuite/library/__init__.py @@ -65,7 +65,8 @@ class TestLibrary(ABCObject): modname =3D '%s.%s' % (self.modname, modname) mod =3D __import__(modname, {}, {}, [clsname], 0) cls =3D getattr(mod, clsname) - for i in cls.inst_all(thorough =3D self.thorough): + for i in cls.inst_all(thorough =3D self.thorough, + undefined =3D self.undefined): self.tests.append(i) yield i =20 @@ -77,9 +78,10 @@ class TestLibrary(ABCObject): =20 return len(self.tests) =20 - def __init__(self, modname, thorough =3D False): + def __init__(self, modname, thorough =3D False, undefined =3D False): self.modname =3D modname self.thorough =3D thorough + self.undefined =3D undefined =20 def limit_tests(self, limitations): if self.tests is not None: diff --git a/pmstestsuite/library/case.py b/pmstestsuite/library/case.py index 538a050..55dfa43 100644 --- a/pmstestsuite/library/case.py +++ b/pmstestsuite/library/case.py @@ -16,7 +16,7 @@ phase_func_names =3D [ =20 """ Names of all phase functions supported in EAPIs. """ =20 -known_eapis =3D (0, 1, 2, 3, 4) +known_eapis =3D frozenset((0, 1, 2, 3, 4)) =20 """ All known EAPIs. """ =20 @@ -205,7 +205,7 @@ class TestCase(ABCObject): =20 def _append_assert(self, a, undefined =3D False): all_eapis =3D itertools.chain.from_iterable(self.supported_eapis) - if undefined: + if undefined or self.eapi not in all_eapis: a._undefined =3D True =20 self.assertions.append(a) @@ -371,7 +371,7 @@ class EbuildTestCase(TestCase): return (known_eapis,) =20 @classmethod - def inst_all(cls, thorough =3D False): + def inst_all(cls, thorough =3D False, undefined =3D False): """ Instantiate the test case, choosing a single EAPI from each EAPI group listed in L{supported_eapis}. If thorough mode is enabled, all EAPIs @@ -379,11 +379,20 @@ class EbuildTestCase(TestCase): =20 @param thorough: whether to use the thorough mode @type thorough: bool + @param undefined: whether to run tests on undefined-behavior EAPIs + @type undefined: bool @return: an iterable over test case instances @rtype: generator(L{EbuildTestCase}) """ =20 supported_eapis =3D cls._eval_prop(cls.supported_eapis) + + if undefined: + all_supp_eapis =3D set(itertools.chain.from_iterable(supported_eapis)= ) + remaining =3D known_eapis - all_supp_eapis + if remaining: + supported_eapis =3D tuple(supported_eapis) + (tuple(remaining),) + if thorough: eapis =3D itertools.chain.from_iterable(supported_eapis) else: