All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] python3: Add ptest support
@ 2014-03-07  0:54 Paul Barker
  2014-03-07  0:54 ` Paul Barker
  0 siblings, 1 reply; 6+ messages in thread
From: Paul Barker @ 2014-03-07  0:54 UTC (permalink / raw)
  To: openembedded-core

This is my first attempt at doing anything ptest related so probably needs a
detailed check.

About 6 out of 350+ test suites fail, compared to 2 or 3 failing on my desktop.
I doubt we'll be able to get a perfect run out of python3 with all tests passing
but I'm not sure where or how to document that.

I'm also not sure where to document that the python3 test suites won't run with
only 256 MB of RAM allocated on the target system. 

I think enabling ptest support is still helpful so I'm sending the patch for
review.

Paul Barker (1):
  python3: Add ptest support

 meta/recipes-devtools/python/python3/run-ptest | 56 ++++++++++++++++++++++++++
 meta/recipes-devtools/python/python3_3.3.3.bb  | 12 ++++++
 2 files changed, 68 insertions(+)
 create mode 100644 meta/recipes-devtools/python/python3/run-ptest

-- 
1.9.0



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

* [PATCH] python3: Add ptest support
  2014-03-07  0:54 [PATCH] python3: Add ptest support Paul Barker
@ 2014-03-07  0:54 ` Paul Barker
  2014-03-10 18:15   ` Saul Wold
  0 siblings, 1 reply; 6+ messages in thread
From: Paul Barker @ 2014-03-07  0:54 UTC (permalink / raw)
  To: openembedded-core

A run-ptest script written in python is added which defines a new TestRunner
subclass which prints test results in the required ptest format and then
executes python's built-in testsuite using this new TestRunner subclass.

The built-in testsuite is included in the python standard library and we ensure
we have the complete library by adding ${PN}-modules and ${PN}-misc to the
RDEPENDS for the ptest package. We also require libgcc for pthread support.

Tested on qemux86. Several tests fail and many skip; further investigation
should be done to check that the current status is acceptable. In addition, the
testsuite causes an out-of-memory crash when qemu is configured with 256 MB of
RAM. The testsuite completes without crashing with 1 GB RAM.

Signed-off-by: Paul Barker <paul@paulbarker.me.uk>
---
 meta/recipes-devtools/python/python3/run-ptest | 56 ++++++++++++++++++++++++++
 meta/recipes-devtools/python/python3_3.3.3.bb  | 12 ++++++
 2 files changed, 68 insertions(+)
 create mode 100644 meta/recipes-devtools/python/python3/run-ptest

diff --git a/meta/recipes-devtools/python/python3/run-ptest b/meta/recipes-devtools/python/python3/run-ptest
new file mode 100644
index 0000000..bd3ea11
--- /dev/null
+++ b/meta/recipes-devtools/python/python3/run-ptest
@@ -0,0 +1,56 @@
+#! /usr/bin/env python3
+
+from test import support
+from test import regrtest
+import unittest
+import sys
+
+# Define a test result class which outputs results in the desired format.
+class ptestResult(unittest.TestResult):
+    def __init__(self, runner):
+        super(ptestResult, self).__init__()
+        self.runner = runner
+
+    def addError(self, test, err):
+        super(ptestResult, self).addError(test, err)
+        self.runner.write("ERROR: %s: %s\n" % (str(test), str(err[1])))
+
+    def addSuccess(self, test):
+        super(ptestResult, self).addSuccess(test)
+        self.runner.write("PASS: %s\n" % str(test))
+
+    def addFailure(self, test, err):
+        super(ptestResult, self).addFailure(test, err)
+        self.runner.write("FAIL: %s: %s\n" % (str(test), str(err[1])))
+
+    def addSkip(self, test, reason):
+        super(ptestResult, self).addSkip(test, reason)
+        self.runner.write("SKIP: %s: %s\n" % (str(test), str(reason)))
+
+    def addExpectedFailure(self, test, err):
+        super(ptestResult, self).addExpectedFailure(test, err)
+        self.runner.write("XFAIL: %s\n" % (str(test)))
+
+    def addUnexpectedSuccess(self, test):
+        super(ptestResult, self).addUnexpectedSuccess(test)
+        self.runner.write("XPASS: %s\n" % str(test))
+
+# Define a test runner which uses the above output class.
+class ptestRunner:
+    def __init__(self, stream=sys.stderr):
+        self.stream = stream
+
+    def write(self, message):
+        self.stream.write(message)
+
+    def run(self, test):
+        result = ptestResult(self)
+        test(result)
+        return result
+
+# Replace the test runner in python's standard library 'test.support'.
+support.BasicTestRunner = ptestRunner
+
+# Run the python regression test suite - the replacement test runner will be
+# used.
+regrtest.main()
diff --git a/meta/recipes-devtools/python/python3_3.3.3.bb b/meta/recipes-devtools/python/python3_3.3.3.bb
index b6f6def..e405a25 100644
--- a/meta/recipes-devtools/python/python3_3.3.3.bb
+++ b/meta/recipes-devtools/python/python3_3.3.3.bb
@@ -35,6 +35,7 @@ SRC_URI += "\
             file://sysroot-include-headers.patch \
             file://unixccompiler.patch \
             file://avoid-ncursesw-include-path.patch \
+            file://run-ptest \
            "
 SRC_URI[md5sum] = "f3ebe34d4d8695bf889279b54673e10c"
 SRC_URI[sha256sum] = "e526e9b612f623888364d30cc9f3dfc34dcef39065c713bdbcddf47df84d8dcb"
@@ -209,6 +210,17 @@ FILES_${PN}-dbg += "${libdir}/python${PYTHON_MAJMIN}/lib-dynload/.debug"
 PACKAGES += "${PN}-misc"
 FILES_${PN}-misc = "${libdir}/python${PYTHON_MAJMIN}"
 
+#inherit ptest after "require python-${PYTHON_MAJMIN}-manifest.inc" so PACKAGES doesn't get overwritten
+inherit ptest
+
+# This must come after inherit ptest for the override to take effect
+do_install_ptest() {
+    install -m 0755 -d ${D}/${libdir}/python3/ptest
+    install -m 0755 ${S}/../run-ptest ${D}/${libdir}/${PN}/ptest
+}
+
+RDEPENDS_${PN}-ptest = "${PN}-modules ${PN}-misc libgcc"
+
 # catch manpage
 PACKAGES += "${PN}-man"
 FILES_${PN}-man = "${datadir}/man"
-- 
1.9.0



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

* Re: [PATCH] python3: Add ptest support
  2014-03-07  0:54 ` Paul Barker
@ 2014-03-10 18:15   ` Saul Wold
  2014-03-11 19:23     ` Paul Barker
  0 siblings, 1 reply; 6+ messages in thread
From: Saul Wold @ 2014-03-10 18:15 UTC (permalink / raw)
  To: Paul Barker, openembedded-core

On 03/06/2014 04:54 PM, Paul Barker wrote:
> A run-ptest script written in python is added which defines a new TestRunner
> subclass which prints test results in the required ptest format and then
> executes python's built-in testsuite using this new TestRunner subclass.
>
> The built-in testsuite is included in the python standard library and we ensure
> we have the complete library by adding ${PN}-modules and ${PN}-misc to the
> RDEPENDS for the ptest package. We also require libgcc for pthread support.
>
> Tested on qemux86. Several tests fail and many skip; further investigation
> should be done to check that the current status is acceptable. In addition, the
> testsuite causes an out-of-memory crash when qemu is configured with 256 MB of
> RAM. The testsuite completes without crashing with 1 GB RAM.
>
> Signed-off-by: Paul Barker <paul@paulbarker.me.uk>
> ---
>   meta/recipes-devtools/python/python3/run-ptest | 56 ++++++++++++++++++++++++++
>   meta/recipes-devtools/python/python3_3.3.3.bb  | 12 ++++++
>   2 files changed, 68 insertions(+)
>   create mode 100644 meta/recipes-devtools/python/python3/run-ptest
>
> diff --git a/meta/recipes-devtools/python/python3/run-ptest b/meta/recipes-devtools/python/python3/run-ptest
> new file mode 100644
> index 0000000..bd3ea11
> --- /dev/null
> +++ b/meta/recipes-devtools/python/python3/run-ptest
> @@ -0,0 +1,56 @@
> +#! /usr/bin/env python3
> +
> +from test import support
> +from test import regrtest
> +import unittest
> +import sys
> +
> +# Define a test result class which outputs results in the desired format.
> +class ptestResult(unittest.TestResult):
> +    def __init__(self, runner):
> +        super(ptestResult, self).__init__()
> +        self.runner = runner
> +
> +    def addError(self, test, err):
> +        super(ptestResult, self).addError(test, err)
> +        self.runner.write("ERROR: %s: %s\n" % (str(test), str(err[1])))
> +
> +    def addSuccess(self, test):
> +        super(ptestResult, self).addSuccess(test)
> +        self.runner.write("PASS: %s\n" % str(test))
> +
> +    def addFailure(self, test, err):
> +        super(ptestResult, self).addFailure(test, err)
> +        self.runner.write("FAIL: %s: %s\n" % (str(test), str(err[1])))
> +
> +    def addSkip(self, test, reason):
> +        super(ptestResult, self).addSkip(test, reason)
> +        self.runner.write("SKIP: %s: %s\n" % (str(test), str(reason)))
> +
> +    def addExpectedFailure(self, test, err):
> +        super(ptestResult, self).addExpectedFailure(test, err)
> +        self.runner.write("XFAIL: %s\n" % (str(test)))
> +
> +    def addUnexpectedSuccess(self, test):
> +        super(ptestResult, self).addUnexpectedSuccess(test)
> +        self.runner.write("XPASS: %s\n" % str(test))
> +
> +# Define a test runner which uses the above output class.
> +class ptestRunner:
> +    def __init__(self, stream=sys.stderr):
> +        self.stream = stream
> +
> +    def write(self, message):
> +        self.stream.write(message)
> +
> +    def run(self, test):
> +        result = ptestResult(self)
> +        test(result)
> +        return result
> +
> +# Replace the test runner in python's standard library 'test.support'.
> +support.BasicTestRunner = ptestRunner
> +
> +# Run the python regression test suite - the replacement test runner will be
> +# used.
> +regrtest.main()
> diff --git a/meta/recipes-devtools/python/python3_3.3.3.bb b/meta/recipes-devtools/python/python3_3.3.3.bb
> index b6f6def..e405a25 100644
> --- a/meta/recipes-devtools/python/python3_3.3.3.bb
> +++ b/meta/recipes-devtools/python/python3_3.3.3.bb
> @@ -35,6 +35,7 @@ SRC_URI += "\
>               file://sysroot-include-headers.patch \
>               file://unixccompiler.patch \
>               file://avoid-ncursesw-include-path.patch \
> +            file://run-ptest \
>              "
>   SRC_URI[md5sum] = "f3ebe34d4d8695bf889279b54673e10c"
>   SRC_URI[sha256sum] = "e526e9b612f623888364d30cc9f3dfc34dcef39065c713bdbcddf47df84d8dcb"
> @@ -209,6 +210,17 @@ FILES_${PN}-dbg += "${libdir}/python${PYTHON_MAJMIN}/lib-dynload/.debug"
>   PACKAGES += "${PN}-misc"
>   FILES_${PN}-misc = "${libdir}/python${PYTHON_MAJMIN}"
>
> +#inherit ptest after "require python-${PYTHON_MAJMIN}-manifest.inc" so PACKAGES doesn't get overwritten
> +inherit ptest
> +

Seems like there is an issue with the multi-lib build.

ERROR: QA Issue: lib32-python3: Files/directories were installed but not 
shipped
   /usr/lib/python3
   /usr/lib/python3/ptest
NOTE: recipe lib32-pulseaudio-4.0-r0: task do_package_write_rpm: Started

Sau!


> +# This must come after inherit ptest for the override to take effect
> +do_install_ptest() {
> +    install -m 0755 -d ${D}/${libdir}/python3/ptest
> +    install -m 0755 ${S}/../run-ptest ${D}/${libdir}/${PN}/ptest
> +}
> +
> +RDEPENDS_${PN}-ptest = "${PN}-modules ${PN}-misc libgcc"
> +
>   # catch manpage
>   PACKAGES += "${PN}-man"
>   FILES_${PN}-man = "${datadir}/man"
>


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

* Re: [PATCH] python3: Add ptest support
  2014-03-10 18:15   ` Saul Wold
@ 2014-03-11 19:23     ` Paul Barker
  2014-03-11 21:27       ` Tudor Florea
  0 siblings, 1 reply; 6+ messages in thread
From: Paul Barker @ 2014-03-11 19:23 UTC (permalink / raw)
  To: Saul Wold; +Cc: openembedded-core

On 10 March 2014 18:15, Saul Wold <sgw@linux.intel.com> wrote:
> On 03/06/2014 04:54 PM, Paul Barker wrote:
>>
>> A run-ptest script written in python is added which defines a new
>> TestRunner
>> subclass which prints test results in the required ptest format and then
>> executes python's built-in testsuite using this new TestRunner subclass.
>>
>> The built-in testsuite is included in the python standard library and we
>> ensure
>> we have the complete library by adding ${PN}-modules and ${PN}-misc to the
>> RDEPENDS for the ptest package. We also require libgcc for pthread
>> support.
>>
>> Tested on qemux86. Several tests fail and many skip; further investigation
>> should be done to check that the current status is acceptable. In
>> addition, the
>> testsuite causes an out-of-memory crash when qemu is configured with 256
>> MB of
>> RAM. The testsuite completes without crashing with 1 GB RAM.
>>
>> Signed-off-by: Paul Barker <paul@paulbarker.me.uk>
>> ---
>> <snip>
>
> Seems like there is an issue with the multi-lib build.
>
> ERROR: QA Issue: lib32-python3: Files/directories were installed but not
> shipped
>   /usr/lib/python3
>   /usr/lib/python3/ptest
> NOTE: recipe lib32-pulseaudio-4.0-r0: task do_package_write_rpm: Started
>
> Sau!
>
>
>
>> +# This must come after inherit ptest for the override to take effect
>> +do_install_ptest() {
>> +    install -m 0755 -d ${D}/${libdir}/python3/ptest
>> +    install -m 0755 ${S}/../run-ptest ${D}/${libdir}/${PN}/ptest
>> +}

Should I be using something other than ${libdir} here? I can see
${PTEST_PATH} used in the do_install_ptest function for python2,
should I be using that instead?

As I think I noted elsewhere, this is the first ptest related patch
I've done so I don't really know much beyond what's documented at
https://wiki.yoctoproject.org/wiki/Ptest.

Cheers,

-- 
Paul Barker

Email: paul@paulbarker.me.uk
http://www.paulbarker.me.uk


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

* Re: [PATCH] python3: Add ptest support
  2014-03-11 19:23     ` Paul Barker
@ 2014-03-11 21:27       ` Tudor Florea
  2014-03-12 13:38         ` Paul Barker
  0 siblings, 1 reply; 6+ messages in thread
From: Tudor Florea @ 2014-03-11 21:27 UTC (permalink / raw)
  To: Paul Barker; +Cc: openembedded-core



>On 10 March 2014 18:15, Saul Wold <sgw@linux.intel.com> wrote:
>> On 03/06/2014 04:54 PM, Paul Barker wrote:
>>>
>>> A run-ptest script written in python is added which defines a new
>>> TestRunner
>>> subclass which prints test results in the required ptest format and then
>>> executes python's built-in testsuite using this new TestRunner subclass.
>>> <snip>
>>
>> Seems like there is an issue with the multi-lib build.
>>
>> ERROR: QA Issue: lib32-python3: Files/directories were installed but not
>> shipped
>>   /usr/lib/python3
>>   /usr/lib/python3/ptest
>> NOTE: recipe lib32-pulseaudio-4.0-r0: task do_package_write_rpm: Started
>>
>> Sau!
>>
>>
>>
>>> +# This must come after inherit ptest for the override to take effect
>>> +do_install_ptest() {
>>> +    install -m 0755 -d ${D}/${libdir}/python3/ptest
>>> +    install -m 0755 ${S}/../run-ptest ${D}/${libdir}/${PN}/ptest
>>> +}
>
> Should I be using something other than ${libdir} here? I can see
> ${PTEST_PATH} used in the do_install_ptest function for python2,
> should I be using that instead?
> 
> As I think I noted elsewhere, this is the first ptest related patch
> I've done so I don't really know much beyond what's documented at
> https://wiki.yoctoproject.org/wiki/Ptest.

I think you may have to add a line like 
FILES_${PN} += "/usr/lib/python3/ptest"
in the recipe (meta/recipes-devtools/python/python3_3.3.3.bb).
${PTEST_PATH} might be different than the above due to the use of suffix  ${PYTHON_MAJMIN}.
Alternatively you might they to install ptest stuff here: ${D}${libdir}/python${PYTHON_MAJMIN} 
Regards,
  Tudor

> Cheers,
> 
> -- 
> Paul Barker
> 



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

* Re: [PATCH] python3: Add ptest support
  2014-03-11 21:27       ` Tudor Florea
@ 2014-03-12 13:38         ` Paul Barker
  0 siblings, 0 replies; 6+ messages in thread
From: Paul Barker @ 2014-03-12 13:38 UTC (permalink / raw)
  To: Tudor Florea; +Cc: openembedded-core

On 11 March 2014 21:27, Tudor Florea <Tudor.Florea@enea.com> wrote:
>
>
>>On 10 March 2014 18:15, Saul Wold <sgw@linux.intel.com> wrote:
>>> On 03/06/2014 04:54 PM, Paul Barker wrote:
>>>>
>>>> A run-ptest script written in python is added which defines a new
>>>> TestRunner
>>>> subclass which prints test results in the required ptest format and then
>>>> executes python's built-in testsuite using this new TestRunner subclass.
>>>> <snip>
>>>
>>> Seems like there is an issue with the multi-lib build.
>>>
>>> ERROR: QA Issue: lib32-python3: Files/directories were installed but not
>>> shipped
>>>   /usr/lib/python3
>>>   /usr/lib/python3/ptest
>>> NOTE: recipe lib32-pulseaudio-4.0-r0: task do_package_write_rpm: Started
>>>
>>> Sau!
>>>
>>>
>>>
>>>> +# This must come after inherit ptest for the override to take effect
>>>> +do_install_ptest() {
>>>> +    install -m 0755 -d ${D}/${libdir}/python3/ptest
>>>> +    install -m 0755 ${S}/../run-ptest ${D}/${libdir}/${PN}/ptest
>>>> +}
>>
>> Should I be using something other than ${libdir} here? I can see
>> ${PTEST_PATH} used in the do_install_ptest function for python2,
>> should I be using that instead?
>>
>> As I think I noted elsewhere, this is the first ptest related patch
>> I've done so I don't really know much beyond what's documented at
>> https://wiki.yoctoproject.org/wiki/Ptest.
>
> I think you may have to add a line like
> FILES_${PN} += "/usr/lib/python3/ptest"
> in the recipe (meta/recipes-devtools/python/python3_3.3.3.bb).

No, this belongs in the -ptest package. I just don't know what I'm doing wrong.

> ${PTEST_PATH} might be different than the above due to the use of suffix  ${PYTHON_MAJMIN}.
> Alternatively you might they to install ptest stuff here: ${D}${libdir}/python${PYTHON_MAJMIN}

I think the path should be based on the package name (python3), not on
an internal identifier.

Thanks,

-- 
Paul Barker

Email: paul@paulbarker.me.uk
http://www.paulbarker.me.uk


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

end of thread, other threads:[~2014-03-12 13:38 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-03-07  0:54 [PATCH] python3: Add ptest support Paul Barker
2014-03-07  0:54 ` Paul Barker
2014-03-10 18:15   ` Saul Wold
2014-03-11 19:23     ` Paul Barker
2014-03-11 21:27       ` Tudor Florea
2014-03-12 13:38         ` Paul Barker

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.