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: basic/
Date: Tue, 31 May 2011 18:10:12 +0000 (UTC)	[thread overview]
Message-ID: <10e744b9f4bd7caad60c323fd23ba71fceb4e2a1.mgorny@gentoo> (raw)

commit:     10e744b9f4bd7caad60c323fd23ba71fceb4e2a1
Author:     Michał Górny <mgorny <AT> gentoo <DOT> org>
AuthorDate: Tue May 17 19:09:42 2011 +0000
Commit:     Michał Górny <mgorny <AT> gentoo <DOT> org>
CommitDate: Tue May 31 18:00:21 2011 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/pms-test-suite.git;a=commit;h=10e744b9

Add a Python library format example.

---
 basic/phase-function-order.py |   73 +++++++++++++++++++++++++++++++++++++++++
 1 files changed, 73 insertions(+), 0 deletions(-)

diff --git a/basic/phase-function-order.py b/basic/phase-function-order.py
new file mode 100644
index 0000000..59307f9
--- /dev/null
+++ b/basic/phase-function-order.py
@@ -0,0 +1,73 @@
+# Example Python implementation
+
+# XXX: will be implemented in core suite and imported here
+class EbuildTest(object):
+	phase_funcs = dict([(func, []) for func in (
+		'pkg_pretend', 'pkg_setup', 'src_unpack', 'src_prepare',
+		'src_configure', 'src_compile', 'src_install',
+		'pkg_preinst', 'pkg_postinst'
+		)])
+
+class PhaseFunctionOrderTest(EbuildTest):
+	relevant_eapis = (0, 2, 4)
+
+	DESCRIPTION = 'Phase function execution order test'
+
+	def __init__(self):
+		for func in self.phase_funcs.keys():
+			self.phase_funcs[func].append("pms-test_append_result %s" % func)
+
+	def check_output(self, output):
+		if self.EAPI < 2:
+			expect = """pkg_setup
+src_unpack
+src_compile
+src_install
+pkg_preinst
+pkg_postinst"""
+		elif self.EAPI < 4:
+			expect = """pkg_setup
+src_unpack
+src_prepare
+src_compile
+src_configure
+src_install
+pkg_preinst
+pkg_postinst"""
+		else:
+			expect = """pkg_pretend
+pkg_setup
+src_unpack
+src_prepare
+src_compile
+src_configure
+src_install
+pkg_preinst
+pkg_postinst"""
+
+		return (output == expect)
+
+# (test code)
+test = PhaseFunctionOrderTest()
+
+test.EAPI=1
+real_output="""pkg_setup
+src_unpack
+src_compile
+src_install
+pkg_preinst
+pkg_postinst"""
+print(test.check_output(real_output)) # expect True
+
+test.EAPI=2
+print(test.check_output(real_output)) # expect False
+
+real_output="""pkg_setup
+src_unpack
+src_prepare
+src_compile
+src_configure
+src_install
+pkg_preinst
+pkg_postinst"""
+print(test.check_output(real_output)) # expect True



             reply	other threads:[~2011-05-31 18:10 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-05-31 18:10 Michał Górny [this message]
  -- strict thread matches above, loose matches on Subject: below --
2011-05-31 18:10 [gentoo-commits] proj/pms-test-suite:master commit in: basic/ Michał Górny
2011-05-31 18:10 Michał Górny
2011-05-31 18:10 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=10e744b9f4bd7caad60c323fd23ba71fceb4e2a1.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