public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-commits] proj/pms-test-suite-library:master commit in: basic/
@ 2011-05-17 18:45 Michał Górny
  0 siblings, 0 replies; 7+ messages in thread
From: Michał Górny @ 2011-05-17 18:45 UTC (permalink / raw
  To: gentoo-commits

commit:     2101c01409396bdf12db6e1415a228f3f388923e
Author:     Michał Górny <mgorny <AT> gentoo <DOT> org>
AuthorDate: Tue May 17 18:45:03 2011 +0000
Commit:     Michał Górny <mgorny <AT> gentoo <DOT> org>
CommitDate: Tue May 17 18:45:03 2011 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/pms-test-suite-library.git;a=commit;h=2101c014

Add an output check function and test code.

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

diff --git a/basic/phase-function-order.lua b/basic/phase-function-order.lua
index 6c5669b..90bf193 100644
--- a/basic/phase-function-order.lua
+++ b/basic/phase-function-order.lua
@@ -21,3 +21,61 @@ DESCRIPTION="Phase function execution order test"
 for func in pairs(phase_funcs) do
 	phase_funcs[func] = "pms-test_append_result " .. func
 end
+
+-- output check
+function check_output(output)
+	local expect
+
+	if EAPI < 2 then
+		expect = [[pkg_setup
+src_unpack
+src_compile
+src_install
+pkg_preinst
+pkg_postinst]]
+	elseif EAPI < 4 then
+		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]]
+	end
+
+	return (output == expect)
+end
+
+-- (test code)
+EAPI=1
+real_output=[[pkg_setup
+src_unpack
+src_compile
+src_install
+pkg_preinst
+pkg_postinst]]
+print(check_output(real_output)) -- expect true
+
+EAPI=2
+print(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(check_output(real_output)) -- expect true



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

* [gentoo-commits] proj/pms-test-suite-library:master commit in: basic/
@ 2011-05-17 19:15 Michał Górny
  0 siblings, 0 replies; 7+ messages in thread
From: Michał Górny @ 2011-05-17 19:15 UTC (permalink / raw
  To: gentoo-commits

commit:     d5c095938cbe524e92a03ad366c0aca62f35fdc3
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 17 19:09:42 2011 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/pms-test-suite-library.git;a=commit;h=d5c09593

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



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

* [gentoo-commits] proj/pms-test-suite-library:master commit in: basic/
@ 2011-05-18 16:56 Michał Górny
  0 siblings, 0 replies; 7+ messages in thread
From: Michał Górny @ 2011-05-18 16:56 UTC (permalink / raw
  To: gentoo-commits

commit:     5064ecb5c2ebd7cbfe4927991ec1320a6fcc09ee
Author:     Michał Górny <mgorny <AT> gentoo <DOT> org>
AuthorDate: Wed May 18 16:40:12 2011 +0000
Commit:     Michał Górny <mgorny <AT> gentoo <DOT> org>
CommitDate: Wed May 18 16:40:12 2011 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/pms-test-suite-library.git;a=commit;h=5064ecb5

Move ebuilds vars to a separate dict.

---
 basic/phase-function-order.lua |    4 +++-
 basic/phase-function-order.py  |    4 +++-
 2 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/basic/phase-function-order.lua b/basic/phase-function-order.lua
index 90bf193..291546c 100644
--- a/basic/phase-function-order.lua
+++ b/basic/phase-function-order.lua
@@ -15,7 +15,9 @@ phase_funcs={
 }
 
 -- ebuild vars
-DESCRIPTION="Phase function execution order test"
+ebuild_vars={
+	DESCRIPTION="Phase function execution order test"
+}
 
 -- phase functions
 for func in pairs(phase_funcs) do

diff --git a/basic/phase-function-order.py b/basic/phase-function-order.py
index 59307f9..01e71c9 100644
--- a/basic/phase-function-order.py
+++ b/basic/phase-function-order.py
@@ -11,7 +11,9 @@ class EbuildTest(object):
 class PhaseFunctionOrderTest(EbuildTest):
 	relevant_eapis = (0, 2, 4)
 
-	DESCRIPTION = 'Phase function execution order test'
+	ebuild_vars = {
+		'DESCRIPTION': 'Phase function execution order test'
+	}
 
 	def __init__(self):
 		for func in self.phase_funcs.keys():



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

* [gentoo-commits] proj/pms-test-suite-library:master commit in: basic/
@ 2011-05-18 16:56 Michał Górny
  0 siblings, 0 replies; 7+ messages in thread
From: Michał Górny @ 2011-05-18 16:56 UTC (permalink / raw
  To: gentoo-commits

commit:     145851a384e3c667d2285802ac4311aaf7c07d76
Author:     Michał Górny <mgorny <AT> gentoo <DOT> org>
AuthorDate: Wed May 18 16:56:06 2011 +0000
Commit:     Michał Górny <mgorny <AT> gentoo <DOT> org>
CommitDate: Wed May 18 16:56:06 2011 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/pms-test-suite-library.git;a=commit;h=145851a3

Add a bash example.

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

diff --git a/basic/phase-function-order.bash b/basic/phase-function-order.bash
new file mode 100644
index 0000000..a7eb927
--- /dev/null
+++ b/basic/phase-function-order.bash
@@ -0,0 +1,83 @@
+# internal use vars
+relevant_eapis=( 0 2 4 )
+
+# XXX: this should be declared by caller
+PHASE_FUNCS=(
+	pkg_pretend pkg_setup src_unpack src_prepare
+	src_configure src_compile src_install
+	pkg_preinst pkg_postinst
+)
+
+# ebuild vars
+DESCRIPTION="Phase function execution order test"
+
+# phase functions
+for func in ${PHASE_FUNCS[@]}; do
+	eval "
+${func}() {
+	pms-test_append_result ${func}
+}
+	"
+done
+
+# output check
+check_output() {
+	local output=${1}
+	local expect
+
+	if [[ ${EAPI} -lt 2 ]]; then
+		expect='pkg_setup
+src_unpack
+src_compile
+src_install
+pkg_preinst
+pkg_postinst'
+	elif [[ ${EAPI} -lt 4 ]]; then
+		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'
+	fi
+
+	[[ ${output} = ${expect} ]]
+}
+
+# (test code)
+EAPI=1
+real_output='pkg_setup
+src_unpack
+src_compile
+src_install
+pkg_preinst
+pkg_postinst'
+check_output "${real_output}"
+echo "${?} ?= 0 expected"
+
+EAPI=2
+check_output "${real_output}"
+echo "${?} ?= 1 expected"
+
+real_output='pkg_setup
+src_unpack
+src_prepare
+src_compile
+src_configure
+src_install
+pkg_preinst
+pkg_postinst'
+check_output "${real_output}"
+echo "${?} ?= 0 expected"



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

* [gentoo-commits] proj/pms-test-suite-library:master commit in: basic/
@ 2011-05-25 20:36 Michał Górny
  0 siblings, 0 replies; 7+ messages in thread
From: Michał Górny @ 2011-05-25 20:36 UTC (permalink / raw
  To: gentoo-commits

commit:     3267a2758f020089fc080eaa8c8e78c7b0945ca4
Author:     Michał Górny <mgorny <AT> gentoo <DOT> org>
AuthorDate: Wed May 25 20:22:36 2011 +0000
Commit:     Michał Górny <mgorny <AT> gentoo <DOT> org>
CommitDate: Wed May 25 20:22:36 2011 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/pms-test-suite-library.git;a=commit;h=3267a275

Remove old examples.

---
 basic/phase-function-order.bash |   83 ---------------------------------------
 basic/phase-function-order.lua  |   83 ---------------------------------------
 2 files changed, 0 insertions(+), 166 deletions(-)

diff --git a/basic/phase-function-order.bash b/basic/phase-function-order.bash
deleted file mode 100644
index a7eb927..0000000
--- a/basic/phase-function-order.bash
+++ /dev/null
@@ -1,83 +0,0 @@
-# internal use vars
-relevant_eapis=( 0 2 4 )
-
-# XXX: this should be declared by caller
-PHASE_FUNCS=(
-	pkg_pretend pkg_setup src_unpack src_prepare
-	src_configure src_compile src_install
-	pkg_preinst pkg_postinst
-)
-
-# ebuild vars
-DESCRIPTION="Phase function execution order test"
-
-# phase functions
-for func in ${PHASE_FUNCS[@]}; do
-	eval "
-${func}() {
-	pms-test_append_result ${func}
-}
-	"
-done
-
-# output check
-check_output() {
-	local output=${1}
-	local expect
-
-	if [[ ${EAPI} -lt 2 ]]; then
-		expect='pkg_setup
-src_unpack
-src_compile
-src_install
-pkg_preinst
-pkg_postinst'
-	elif [[ ${EAPI} -lt 4 ]]; then
-		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'
-	fi
-
-	[[ ${output} = ${expect} ]]
-}
-
-# (test code)
-EAPI=1
-real_output='pkg_setup
-src_unpack
-src_compile
-src_install
-pkg_preinst
-pkg_postinst'
-check_output "${real_output}"
-echo "${?} ?= 0 expected"
-
-EAPI=2
-check_output "${real_output}"
-echo "${?} ?= 1 expected"
-
-real_output='pkg_setup
-src_unpack
-src_prepare
-src_compile
-src_configure
-src_install
-pkg_preinst
-pkg_postinst'
-check_output "${real_output}"
-echo "${?} ?= 0 expected"

diff --git a/basic/phase-function-order.lua b/basic/phase-function-order.lua
deleted file mode 100644
index 291546c..0000000
--- a/basic/phase-function-order.lua
+++ /dev/null
@@ -1,83 +0,0 @@
--- internal use vars
-relevant_eapis={0,2,4}
-
--- XXX: this should be declared by caller
-phase_funcs={
-	pkg_pretend = '',
-	pkg_setup = '',
-	src_unpack = '',
-	src_prepare = '',
-	src_configure = '',
-	src_compile = '',
-	src_install = '',
-	pkg_preinst = '',
-	pkg_postinst = ''
-}
-
--- ebuild vars
-ebuild_vars={
-	DESCRIPTION="Phase function execution order test"
-}
-
--- phase functions
-for func in pairs(phase_funcs) do
-	phase_funcs[func] = "pms-test_append_result " .. func
-end
-
--- output check
-function check_output(output)
-	local expect
-
-	if EAPI < 2 then
-		expect = [[pkg_setup
-src_unpack
-src_compile
-src_install
-pkg_preinst
-pkg_postinst]]
-	elseif EAPI < 4 then
-		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]]
-	end
-
-	return (output == expect)
-end
-
--- (test code)
-EAPI=1
-real_output=[[pkg_setup
-src_unpack
-src_compile
-src_install
-pkg_preinst
-pkg_postinst]]
-print(check_output(real_output)) -- expect true
-
-EAPI=2
-print(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(check_output(real_output)) -- expect true



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

* [gentoo-commits] proj/pms-test-suite-library:master commit in: basic/
@ 2011-05-25 20:36 Michał Górny
  0 siblings, 0 replies; 7+ messages in thread
From: Michał Górny @ 2011-05-25 20:36 UTC (permalink / raw
  To: gentoo-commits

commit:     a5e11b969ee70046c6e8ac15ce2dac70ea2aa5fc
Author:     Michał Górny <mgorny <AT> gentoo <DOT> org>
AuthorDate: Wed May 25 20:35:07 2011 +0000
Commit:     Michał Górny <mgorny <AT> gentoo <DOT> org>
CommitDate: Wed May 25 20:35:07 2011 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/pms-test-suite-library.git;a=commit;h=a5e11b96

Adjust the phase function order test to the new API.

---
 basic/phase-function-order.py |   75 -----------------------------------------
 basic/phase_function_order.py |   47 +++++++++++++++++++++++++
 2 files changed, 47 insertions(+), 75 deletions(-)

diff --git a/basic/phase-function-order.py b/basic/phase-function-order.py
deleted file mode 100644
index 01e71c9..0000000
--- a/basic/phase-function-order.py
+++ /dev/null
@@ -1,75 +0,0 @@
-# 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)
-
-	ebuild_vars = {
-		'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

diff --git a/basic/phase_function_order.py b/basic/phase_function_order.py
new file mode 100644
index 0000000..7a9cc13
--- /dev/null
+++ b/basic/phase_function_order.py
@@ -0,0 +1,47 @@
+#	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 PhaseFunctionOrderTest(EbuildTestCase):
+	relevant_eapis = (0, 2, 4)
+
+	ebuild_vars = {
+		'DESCRIPTION': 'Phase function execution order test'
+	}
+
+	def __init__(self, *args, **kwargs):
+		for func in self.phase_funcs:
+			self.phase_funcs[func].append("pms-test_append_result %s" % func)
+		EbuildTestCase.__init__(self, *args, **kwargs)
+
+	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)



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

* [gentoo-commits] proj/pms-test-suite-library:master commit in: basic/
@ 2011-05-26  6:19 Michał Górny
  0 siblings, 0 replies; 7+ messages in thread
From: Michał Górny @ 2011-05-26  6:19 UTC (permalink / raw
  To: gentoo-commits

commit:     ec868c966605b4d333240c27ed86811c1d154406
Author:     Michał Górny <mgorny <AT> gentoo <DOT> org>
AuthorDate: Thu May 26 06:19:16 2011 +0000
Commit:     Michał Górny <mgorny <AT> gentoo <DOT> org>
CommitDate: Thu May 26 06:19:16 2011 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/pms-test-suite-library.git;a=commit;h=ec868c96

Fix mutating shared phase_funcs.

---
 basic/phase_function_order.py |    8 +++-----
 1 files changed, 3 insertions(+), 5 deletions(-)

diff --git a/basic/phase_function_order.py b/basic/phase_function_order.py
index 7a9cc13..80a1c4e 100644
--- a/basic/phase_function_order.py
+++ b/basic/phase_function_order.py
@@ -2,7 +2,7 @@
 # (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.case import EbuildTestCase, phase_func_names
 
 class PhaseFunctionOrderTest(EbuildTestCase):
 	relevant_eapis = (0, 2, 4)
@@ -11,10 +11,8 @@ class PhaseFunctionOrderTest(EbuildTestCase):
 		'DESCRIPTION': 'Phase function execution order test'
 	}
 
-	def __init__(self, *args, **kwargs):
-		for func in self.phase_funcs:
-			self.phase_funcs[func].append("pms-test_append_result %s" % func)
-		EbuildTestCase.__init__(self, *args, **kwargs)
+	phase_funcs = dict([(x, ["pms-test_append_result %s" % x])
+		for x in phase_func_names])
 
 	def check_output(self, output):
 		if self.eapi < 2:



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

end of thread, other threads:[~2011-05-26  6:23 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-05-25 20:36 [gentoo-commits] proj/pms-test-suite-library:master commit in: basic/ Michał Górny
  -- strict thread matches above, loose matches on Subject: below --
2011-05-26  6:19 Michał Górny
2011-05-25 20:36 Michał Górny
2011-05-18 16:56 Michał Górny
2011-05-18 16:56 Michał Górny
2011-05-17 19:15 Michał Górny
2011-05-17 18:45 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