Openembedded Core Discussions
 help / color / mirror / Atom feed
* [PATCH] Install Python test suite and run it as ptest.
@ 2013-07-17  0:09 Tudor Florea
  2013-07-18  9:51 ` Paul Eggleton
  2013-07-19 15:10 ` [PATCH v2] python: Add ptest Tudor Florea
  0 siblings, 2 replies; 4+ messages in thread
From: Tudor Florea @ 2013-07-17  0:09 UTC (permalink / raw)
  To: openembedded-core


Signed-off-by: Tudor Florea <tudor.florea@enea.com>
---
 .../python/python/fix-makefile-for-ptest.patch     |   33 ++++++++++++++++++++
 meta/recipes-devtools/python/python/run-ptest      |    5 +++
 meta/recipes-devtools/python/python_2.7.3.bb       |   10 ++++++
 3 files changed, 48 insertions(+)
 create mode 100644 meta/recipes-devtools/python/python/fix-makefile-for-ptest.patch
 create mode 100644 meta/recipes-devtools/python/python/run-ptest

diff --git a/meta/recipes-devtools/python/python/fix-makefile-for-ptest.patch b/meta/recipes-devtools/python/python/fix-makefile-for-ptest.patch
new file mode 100644
index 0000000..c349e74
--- /dev/null
+++ b/meta/recipes-devtools/python/python/fix-makefile-for-ptest.patch
@@ -0,0 +1,33 @@
+Add 'buildtest' and 'runtest' targets to Makefile, to build and run tests
+cross-compiled.
+
+Signed-off-by: Tudor Florea <tudor.florea@enea.com>
+Upstream-Status: Pending
+---
+diff -ruN a/Makefile.pre.in b/Makefile.pre.in
+--- a/Makefile.pre.in	2013-06-27 10:44:11.033840532 +0200
++++ b/Makefile.pre.in	2013-06-27 10:44:39.572635273 +0200
+@@ -709,14 +709,19 @@
+ # generated bytecode.  This is sometimes a very shy bug needing a lot of
+ # sample data.
+ 
+-TESTOPTS=	-l $(EXTRATESTOPTS)
++TESTOPTS=	-l -v $(EXTRATESTOPTS)
+ TESTPROG=	$(srcdir)/Lib/test/regrtest.py
+-TESTPYTHON=	$(RUNSHARED) ./$(BUILDPYTHON) -Wd -3 -E -tt $(TESTPYTHONOPTS)
+-test:		all platform
+-		-find $(srcdir)/Lib -name '*.py[co]' -print | xargs rm -f
++TESTPYTHON=	$(RUNSHARED) $(BUILDPYTHON) -Wd -3 -E -tt $(TESTPYTHONOPTS)
++test:		build-test
++		$(MAKE) runtest-TESTS
++
++runtest-TESTS:
++		-find $(srcdir) -name '*.py[co]' -print | xargs rm -f
+ 		-$(TESTPYTHON) $(TESTPROG) $(TESTOPTS)
+ 		$(TESTPYTHON) $(TESTPROG) $(TESTOPTS)
+ 
++build-test:	all platform
++
+ testall:	all platform
+ 		-find $(srcdir)/Lib -name '*.py[co]' -print | xargs rm -f
+ 		$(TESTPYTHON) $(srcdir)/Lib/compileall.py
diff --git a/meta/recipes-devtools/python/python/run-ptest b/meta/recipes-devtools/python/python/run-ptest
new file mode 100644
index 0000000..89a769f
--- /dev/null
+++ b/meta/recipes-devtools/python/python/run-ptest
@@ -0,0 +1,5 @@
+#!/bin/sh
+#
+#This script is used to run python test suites
+
+make -f /usr/lib/python/ptest/Makefile -k runtest-TESTS srcdir=/usr/lib/python2.7 TESTPROG=/usr/lib/python2.7/test/regrtest.py | sed -e '/\.\.\. ok/ s/^/PASS: /g' -e '/\.\.\. [ERROR|FAIL]/ s/^/FAIL: /g' -e '/\.\.\. skipped/ s/^/SKIP: /g' -e 's/ \.\.\. ok//g' -e 's/ \.\.\. ERROR//g' -e 's/ \.\.\. FAIL//g' -e 's/ \.\.\. skipped//g'
diff --git a/meta/recipes-devtools/python/python_2.7.3.bb b/meta/recipes-devtools/python/python_2.7.3.bb
index 59d189d..7d8cb43 100644
--- a/meta/recipes-devtools/python/python_2.7.3.bb
+++ b/meta/recipes-devtools/python/python_2.7.3.bb
@@ -28,6 +28,8 @@ SRC_URI += "\
   file://builddir.patch \
   file://python-2.7.3-CVE-2012-2135.patch \
   file://gcc-4.8-fix-configure-Wformat.patch \
+  file://fix-makefile-for-ptest.patch \
+  file://run-ptest \
 "
 
 S = "${WORKDIR}/Python-${PV}"
@@ -119,6 +121,10 @@ do_install_append_class-nativesdk () {
 	create_wrapper ${D}${bindir}/python2.7 TERMINFO_DIRS='${sysconfdir}/terminfo:/etc/terminfo:/usr/share/terminfo:/usr/share/misc/terminfo:/lib/terminfo'
 }
 
+do_install_ptest() {
+	cp ${B}/Makefile ${D}${PTEST_PATH}
+}
+
 SSTATE_SCAN_FILES += "Makefile"
 PACKAGE_PREPROCESS_FUNCS += "py_package_preprocess"
 
@@ -149,6 +155,10 @@ FILES_${PN}-dbg += "${libdir}/python${PYTHON_MAJMIN}/lib-dynload/.debug"
 PACKAGES += "${PN}-misc"
 FILES_${PN}-misc = "${libdir}/python${PYTHON_MAJMIN}"
 
+RDEPENDS_${PN}-ptest = "${PN}-json ${PN}-crypt ${PN}-unittest ${PN}-difflib ${PN}-pprint ${PN}-shell ${PN}-tests ${PN}-misc ${PN}-netclient ${PN}-mailbox ${PN}-pkgutil ${PN}-profile ${PN}-compile ${PN}-pydoc ${PN}-robotparser ${PN}-netserver ${PN}-datetime ${PN}-compression ${PN}-mime ${PN}-audio ${PN}-db ${PN}-resource ${PN}-image ${PN}-subprocess ${PN}-doctest ${PN}-numbers ${PN}-html ${PN}-email ${PN}-distutils ${PN}-hotshot ${PN}-2to3 ${PN}-mmap ${PN}-terminal ${PN}-xmlrpc ${PN}-smtpd ${PN}-unixadmin ${PN}-compiler"
+#inherit ptest after "require python-${PYTHON_MAJMIN}-manifest.inc" so PACKAGES doesn't get overwritten
+inherit ptest
+
 # catch manpage
 PACKAGES += "${PN}-man"
 FILES_${PN}-man = "${datadir}/man"
-- 
1.7.10.4



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

* Re: [PATCH] Install Python test suite and run it as ptest.
  2013-07-17  0:09 [PATCH] Install Python test suite and run it as ptest Tudor Florea
@ 2013-07-18  9:51 ` Paul Eggleton
  2013-07-18 22:20   ` Tudor Florea
  2013-07-19 15:10 ` [PATCH v2] python: Add ptest Tudor Florea
  1 sibling, 1 reply; 4+ messages in thread
From: Paul Eggleton @ 2013-07-18  9:51 UTC (permalink / raw)
  To: Tudor Florea; +Cc: openembedded-core

Hi Tudor,

On Wednesday 17 July 2013 02:09:32 Tudor Florea wrote:
>...
> +++ b/meta/recipes-devtools/python/python/run-ptest
> @@ -0,0 +1,5 @@
> +#!/bin/sh
> +#
> +#This script is used to run python test suites
> +
> +make -f /usr/lib/python/ptest/Makefile -k runtest-TESTS
> srcdir=/usr/lib/python2.7 TESTPROG=/usr/lib/python2.7/test/regrtest.py |
> sed -e '/\.\.\. ok/ s/^/PASS: /g' -e '/\.\.\. [ERROR|FAIL]/ s/^/FAIL: /g'
> -e '/\.\.\. skipped/ s/^/SKIP: /g' -e 's/ \.\.\. ok//g' -e 's/ \.\.\.
> ERROR//g' -e 's/ \.\.\. FAIL//g' -e 's/ \.\.\. skipped//g' 

The run-ptest script here has hardcoded /usr/lib/ for ${libdir} (which can and 
is changed in some distro configurations), we should ideally avoid this e.g. 
through use of sed in do_install after installing the file.

>...
> +RDEPENDS_${PN}-ptest = "${PN}-json ${PN}-crypt ${PN}-unittest ${PN}-difflib
> ${PN}-pprint ${PN}-shell ${PN}-tests ${PN}-misc ${PN}-netclient
> ${PN}-mailbox ${PN}-pkgutil ${PN}-profile ${PN}-compile ${PN}-pydoc
> ${PN}-robotparser ${PN}-netserver ${PN}-datetime ${PN}-compression
> ${PN}-mime ${PN}-audio ${PN}-db ${PN}-resource ${PN}-image ${PN}-subprocess
> ${PN}-doctest ${PN}-numbers ${PN}-html ${PN}-email ${PN}-distutils
> ${PN}-hotshot ${PN}-2to3 ${PN}-mmap ${PN}-terminal ${PN}-xmlrpc ${PN}-smtpd
> ${PN}-unixadmin ${PN}-compiler" 

Could the ptest package simply depend on ${PN}-modules rather than having an 
additional hardcoded list of modules packages? It looks like this could be 
replaced by:

RDEPENDS_${PN}-ptest = "${PN}-modules ${PN}-misc"

Cheers,
Paul

-- 

Paul Eggleton
Intel Open Source Technology Centre


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

* Re: [PATCH] Install Python test suite and run it as ptest.
  2013-07-18  9:51 ` Paul Eggleton
@ 2013-07-18 22:20   ` Tudor Florea
  0 siblings, 0 replies; 4+ messages in thread
From: Tudor Florea @ 2013-07-18 22:20 UTC (permalink / raw)
  To: Paul Eggleton; +Cc: openembedded-core@lists.openembedded.org

Hi Paul,
Thank you for review and tip.
I'll come up with V2 patch soon.
Regards,
  Tudor.

-----Original Message-----
From: Paul Eggleton [mailto:paul.eggleton@linux.intel.com] 
Sent: Thursday, July 18, 2013 10:51
To: Tudor Florea
Cc: openembedded-core@lists.openembedded.org
Subject: Re: [OE-core] [PATCH] Install Python test suite and run it as ptest.

Hi Tudor,

On Wednesday 17 July 2013 02:09:32 Tudor Florea wrote:
>...
> +++ b/meta/recipes-devtools/python/python/run-ptest
> @@ -0,0 +1,5 @@
> +#!/bin/sh
> +#
> +#This script is used to run python test suites
> +
> +make -f /usr/lib/python/ptest/Makefile -k runtest-TESTS
> srcdir=/usr/lib/python2.7 TESTPROG=/usr/lib/python2.7/test/regrtest.py |
> sed -e '/\.\.\. ok/ s/^/PASS: /g' -e '/\.\.\. [ERROR|FAIL]/ s/^/FAIL: /g'
> -e '/\.\.\. skipped/ s/^/SKIP: /g' -e 's/ \.\.\. ok//g' -e 's/ \.\.\.
> ERROR//g' -e 's/ \.\.\. FAIL//g' -e 's/ \.\.\. skipped//g' 

The run-ptest script here has hardcoded /usr/lib/ for ${libdir} (which can and 
is changed in some distro configurations), we should ideally avoid this e.g. 
through use of sed in do_install after installing the file.

>...
> +RDEPENDS_${PN}-ptest = "${PN}-json ${PN}-crypt ${PN}-unittest ${PN}-difflib
> ${PN}-pprint ${PN}-shell ${PN}-tests ${PN}-misc ${PN}-netclient
> ${PN}-mailbox ${PN}-pkgutil ${PN}-profile ${PN}-compile ${PN}-pydoc
> ${PN}-robotparser ${PN}-netserver ${PN}-datetime ${PN}-compression
> ${PN}-mime ${PN}-audio ${PN}-db ${PN}-resource ${PN}-image ${PN}-subprocess
> ${PN}-doctest ${PN}-numbers ${PN}-html ${PN}-email ${PN}-distutils
> ${PN}-hotshot ${PN}-2to3 ${PN}-mmap ${PN}-terminal ${PN}-xmlrpc ${PN}-smtpd
> ${PN}-unixadmin ${PN}-compiler" 

Could the ptest package simply depend on ${PN}-modules rather than having an 
additional hardcoded list of modules packages? It looks like this could be 
replaced by:

RDEPENDS_${PN}-ptest = "${PN}-modules ${PN}-misc"

Cheers,
Paul

-- 

Paul Eggleton
Intel Open Source Technology Centre


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

* [PATCH v2] python: Add ptest
  2013-07-17  0:09 [PATCH] Install Python test suite and run it as ptest Tudor Florea
  2013-07-18  9:51 ` Paul Eggleton
@ 2013-07-19 15:10 ` Tudor Florea
  1 sibling, 0 replies; 4+ messages in thread
From: Tudor Florea @ 2013-07-19 15:10 UTC (permalink / raw)
  To: openembedded-core

Install python test suite and run it as ptest
Signed-off-by: Tudor Florea <tudor.florea@enea.com>
---
 .../python/python/fix-makefile-for-ptest.patch     |   33 ++++++++++++++++++++
 meta/recipes-devtools/python/python/run-ptest      |    5 +++
 meta/recipes-devtools/python/python_2.7.3.bb       |   10 ++++++
 3 files changed, 48 insertions(+)
 create mode 100644 meta/recipes-devtools/python/python/fix-makefile-for-ptest.patch
 create mode 100644 meta/recipes-devtools/python/python/run-ptest

diff --git a/meta/recipes-devtools/python/python/fix-makefile-for-ptest.patch b/meta/recipes-devtools/python/python/fix-makefile-for-ptest.patch
new file mode 100644
index 0000000..669112d
--- /dev/null
+++ b/meta/recipes-devtools/python/python/fix-makefile-for-ptest.patch
@@ -0,0 +1,33 @@
+Add 'build-test' and 'runtest-TESTS' targets to Makefile, to build and run tests
+cross-compiled.
+
+Signed-off-by: Tudor Florea <tudor.florea@enea.com>
+Upstream-Status: Pending
+---
+diff -ruN a/Makefile.pre.in b/Makefile.pre.in
+--- a/Makefile.pre.in	2013-06-27 10:44:11.033840532 +0200
++++ b/Makefile.pre.in	2013-06-27 10:44:39.572635273 +0200
+@@ -709,14 +709,19 @@
+ # generated bytecode.  This is sometimes a very shy bug needing a lot of
+ # sample data.
+ 
+-TESTOPTS=	-l $(EXTRATESTOPTS)
++TESTOPTS=	-l -v $(EXTRATESTOPTS)
+ TESTPROG=	$(srcdir)/Lib/test/regrtest.py
+-TESTPYTHON=	$(RUNSHARED) ./$(BUILDPYTHON) -Wd -3 -E -tt $(TESTPYTHONOPTS)
+-test:		all platform
+-		-find $(srcdir)/Lib -name '*.py[co]' -print | xargs rm -f
++TESTPYTHON=	$(RUNSHARED) $(BUILDPYTHON) -Wd -3 -E -tt $(TESTPYTHONOPTS)
++test:		build-test
++		$(MAKE) runtest-TESTS
++
++runtest-TESTS:
++		-find $(srcdir) -name '*.py[co]' -print | xargs rm -f
+ 		-$(TESTPYTHON) $(TESTPROG) $(TESTOPTS)
+ 		$(TESTPYTHON) $(TESTPROG) $(TESTOPTS)
+ 
++build-test:	all platform
++
+ testall:	all platform
+ 		-find $(srcdir)/Lib -name '*.py[co]' -print | xargs rm -f
+ 		$(TESTPYTHON) $(srcdir)/Lib/compileall.py
diff --git a/meta/recipes-devtools/python/python/run-ptest b/meta/recipes-devtools/python/python/run-ptest
new file mode 100644
index 0000000..a2f9eed
--- /dev/null
+++ b/meta/recipes-devtools/python/python/run-ptest
@@ -0,0 +1,5 @@
+#!/bin/sh
+#
+#This script is used to run python test suites
+
+make -f LIBDIR/python/ptest/Makefile -k runtest-TESTS srcdir=LIBDIR/python2.7 TESTPROG=LIBDIR/python2.7/test/regrtest.py | sed -e '/\.\.\. ok/ s/^/PASS: /g' -e '/\.\.\. [ERROR|FAIL]/ s/^/FAIL: /g' -e '/\.\.\. skipped/ s/^/SKIP: /g' -e 's/ \.\.\. ok//g' -e 's/ \.\.\. ERROR//g' -e 's/ \.\.\. FAIL//g' -e 's/ \.\.\. skipped//g'
diff --git a/meta/recipes-devtools/python/python_2.7.3.bb b/meta/recipes-devtools/python/python_2.7.3.bb
index 59d189d..2e35da6 100644
--- a/meta/recipes-devtools/python/python_2.7.3.bb
+++ b/meta/recipes-devtools/python/python_2.7.3.bb
@@ -28,6 +28,8 @@ SRC_URI += "\
   file://builddir.patch \
   file://python-2.7.3-CVE-2012-2135.patch \
   file://gcc-4.8-fix-configure-Wformat.patch \
+  file://fix-makefile-for-ptest.patch \
+  file://run-ptest \
 "
 
 S = "${WORKDIR}/Python-${PV}"
@@ -119,6 +121,11 @@ do_install_append_class-nativesdk () {
 	create_wrapper ${D}${bindir}/python2.7 TERMINFO_DIRS='${sysconfdir}/terminfo:/etc/terminfo:/usr/share/terminfo:/usr/share/misc/terminfo:/lib/terminfo'
 }
 
+do_install_ptest() {
+	cp ${B}/Makefile ${D}${PTEST_PATH}
+	sed -i s:LIBDIR:${libdir}:g ${D}${PTEST_PATH}/run-ptest
+}
+
 SSTATE_SCAN_FILES += "Makefile"
 PACKAGE_PREPROCESS_FUNCS += "py_package_preprocess"
 
@@ -148,6 +155,9 @@ FILES_${PN}-dbg += "${libdir}/python${PYTHON_MAJMIN}/lib-dynload/.debug"
 # catch all the rest (unsorted)
 PACKAGES += "${PN}-misc"
 FILES_${PN}-misc = "${libdir}/python${PYTHON_MAJMIN}"
+RDEPENDS_${PN}-ptest = "${PN}-modules ${PN}-misc"
+#inherit ptest after "require python-${PYTHON_MAJMIN}-manifest.inc" so PACKAGES doesn't get overwritten
+inherit ptest
 
 # catch manpage
 PACKAGES += "${PN}-man"
-- 
1.7.10.4



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

end of thread, other threads:[~2013-07-19 15:11 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-07-17  0:09 [PATCH] Install Python test suite and run it as ptest Tudor Florea
2013-07-18  9:51 ` Paul Eggleton
2013-07-18 22:20   ` Tudor Florea
2013-07-19 15:10 ` [PATCH v2] python: Add ptest Tudor Florea

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox