python: Add ptest

Install python test suite and run it as ptest
(From OE-Core rev: a768047cb8fc00ecf13f4db08117c348a9312c47)

Signed-off-by: Tudor Florea <tudor.florea@enea.com>
Signed-off-by: Saul Wold <sgw@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
Tudor Florea 2013-07-19 17:10:59 +02:00 committed by Richard Purdie
parent 4f9c5a086a
commit de52f892db
3 changed files with 48 additions and 0 deletions

View File

@ -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

View File

@ -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'

View File

@ -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"