Re: [OE-core] [PATCH 1/1] perl-tests: convert to ptest

2013-05-21 Thread Björn Stenberg
Jesse Zhang wrote:
 Ok.. Here is the new commit.

Looks good to me.

Reviewed-by: Björn Stenberg b...@enea.com

-- 
Björn
___
Openembedded-core mailing list
Openembedded-core@lists.openembedded.org
http://lists.openembedded.org/mailman/listinfo/openembedded-core


Re: [OE-core] [PATCH 1/1] perl-tests: convert to ptest

2013-05-17 Thread Björn Stenberg
Jesse Zhang wrote:
 +--- a/t/TEST 2013-05-15 23:12:12.705104588 -0400
  b/t/TEST 2013-05-15 23:20:20.126104587 -0400

Is patching t/TEST better than simply using sed to transform the output?

I took a quick look at future versions and t/TEST is modified in both perl 
5.16.3 and 5.18.0-RC4. This means the patch will have to be manually updated 
for each of those version updates. And the patch cannot be upstreamed.

Unless there are clear advantages with patching t/TEST that I have overlooked, 
I suggest using sed in run-ptest instead.

-- 
Björn

___
Openembedded-core mailing list
Openembedded-core@lists.openembedded.org
http://lists.linuxtogo.org/cgi-bin/mailman/listinfo/openembedded-core


[OE-core] [PATCH 1/1] perl-tests: convert to ptest

2013-05-16 Thread Jesse Zhang
[YOCTO #4292]

Replace PERL_TEST_DIR with PTEST_PATH, and rename tests with ptest
in various places. Add a run-ptest script. Also add a patch to change
the output format.

Signed-off-by: Jesse Zhang sen.zh...@windriver.com
---
 .../perl/perl-5.14.3/ptest-format.patch| 69 ++
 meta/recipes-devtools/perl/perl-5.14.3/run-ptest   |  2 +
 meta/recipes-devtools/perl/perl-ptest.inc  | 50 
 meta/recipes-devtools/perl/perl-tests.inc  | 36 ---
 meta/recipes-devtools/perl/perl_5.14.3.bb  |  2 +-
 5 files changed, 122 insertions(+), 37 deletions(-)
 create mode 100644 meta/recipes-devtools/perl/perl-5.14.3/ptest-format.patch
 create mode 100644 meta/recipes-devtools/perl/perl-5.14.3/run-ptest
 create mode 100644 meta/recipes-devtools/perl/perl-ptest.inc
 delete mode 100644 meta/recipes-devtools/perl/perl-tests.inc

diff --git a/meta/recipes-devtools/perl/perl-5.14.3/ptest-format.patch 
b/meta/recipes-devtools/perl/perl-5.14.3/ptest-format.patch
new file mode 100644
index 000..3910269
--- /dev/null
+++ b/meta/recipes-devtools/perl/perl-5.14.3/ptest-format.patch
@@ -0,0 +1,69 @@
+Change test output to ptest format
+
+Change from
+
+testnameok
+testnamefailrue
+testnameskipped
+
+to
+
+PASS: testname
+FAIL: testname
+SKIP: testname
+
+Upstream-Status: Pending
+
+Signed-off-by: Jesse Zhang sen.zh...@windriver.com
+
+--- a/t/TEST   2013-05-15 23:12:12.705104588 -0400
 b/t/TEST   2013-05-15 23:20:20.126104587 -0400
+@@ -511,7 +511,6 @@
+ }
+ my $maxlen = 0;
+ foreach (@::path_to_name{@tests}) {
+-  s/\.\w+\z/./;
+   my $len = length ;
+   $maxlen = $len if $len  $maxlen;
+ }
+@@ -540,12 +539,12 @@
+   next;
+   }
+   }
+-  my $te = $::path_to_name{$test} . '.'
+-  x ($dotdotdot - length($::path_to_name{$test}));
++  my $testname = $::path_to_name{$test};
++  my $te = $testname . '.' x ($dotdotdot - length($testname));
+ 
+   if ($^O ne 'VMS') {  # defer printing on VMS due to piping bug
+-  print $te;
+-  $te = '';
++  #print $te;
++  #$te = '';
+   }
+ 
+ (local $Valgrind_Log = $test.valgrind-current) =~ s/^.*\///;
+@@ -718,7 +717,8 @@
+   }
+ 
+   if (defined $failure) {
+-  print ${te}$failure\n;
++  print FAIL: $testname\n;
++  print $failure\n;
+   $::bad_files = $::bad_files + 1;
+   if ($test =~ /^base/) {
+   die Failed a basic test ($test) -- cannot continue.\n;
+@@ -734,11 +734,11 @@
+   else {
+   $elapsed = ;
+   }
+-  print ${te}ok$elapsed\n;
++  print PASS: $testname\n;
+   $good_files = $good_files + 1;
+   }
+   else {
+-  print ${te}skipped\n;
++  print SKIP: $testname\n;
+   $tested_files = $tested_files - 1;
+   }
+   }
diff --git a/meta/recipes-devtools/perl/perl-5.14.3/run-ptest 
b/meta/recipes-devtools/perl/perl-5.14.3/run-ptest
new file mode 100644
index 000..28935e1
--- /dev/null
+++ b/meta/recipes-devtools/perl/perl-5.14.3/run-ptest
@@ -0,0 +1,2 @@
+#!/bin/sh
+cd t  ./TEST
diff --git a/meta/recipes-devtools/perl/perl-ptest.inc 
b/meta/recipes-devtools/perl/perl-ptest.inc
new file mode 100644
index 000..5d61743
--- /dev/null
+++ b/meta/recipes-devtools/perl/perl-ptest.inc
@@ -0,0 +1,50 @@
+inherit ptest
+
+SRC_URI += file://run-ptest \
+file://ptest-format.patch \
+   
+
+do_install_ptest () {
+   mkdir -p ${D}${PTEST_PATH}
+   cp -pv TestInit.pm MANIFEST config.sh ${D}${PTEST_PATH}/
+
+   tar -cf - t/ | ( cd ${D}${PTEST_PATH}  tar -xf - )
+   ln -sf ${bindir}/perl ${D}${PTEST_PATH}/t/
+   ln -sf ${libdir}/perl/${PV} ${D}${PTEST_PATH}/lib
+
+   for dir in `find ext/ dist/ cpan/ -maxdepth 2 -type d -name t ` ; do
+   tar -cf - $dir | ( cd ${D}${PTEST_PATH}  tar -xf - )
+   done
+   for file in `find ext dist cpan -name \*.t -o -name \test.pl`;  do
+   tar -cf - $file | ( cd ${D}${PTEST_PATH}  tar -xf - )
+   done
+
+   # Tweaks to make tests pass
+   cp -pv lib/unicore/TestProp.pl ${D}${libdir}/perl/${PV}/unicore/
+   # Put all *.t files from the lib dir in the ptest package
+   pushd lib
+   for file in `find -name \*.t`; do
+   tar -cf - $file | ( cd ${D}${libdir}/perl/${PV}  tar -xf - )
+   done
+   popd
+
+   mkdir -p ${D}${libdir}/perl/${PV}/XS
+   cp -pv lib/XS/APItest.pm ${D}${libdir}/perl/${PV}/XS/
+   cp -pv lib/XS/Typemap.pm ${D}${libdir}/perl/${PV}/XS/
+   mkdir -p ${D}${libdir}/perl/${PV}/auto/XS/APItest
+   cp -pv lib/auto/XS/APItest/APItest.so 
${D}${libdir}/perl/${PV}/auto/XS/APItest/
+   mkdir -p ${D}${libdir}/perl/${PV}/auto/XS/Typemap
+   cp -pv lib/auto/XS/Typemap/Typemap.so 

Re: [OE-core] [PATCH 1/1] perl-tests: convert to ptest

2013-05-15 Thread Jesse Zhang
On 05/14/2013 08:58 PM, Björn Stenberg wrote:
 Jesse Zhang wrote:
 +++ b/meta/recipes-devtools/perl/perl-5.14.3/run-ptest
 @@ -0,0 +1,2 @@
 +#!/bin/sh
 +cd t  ./TEST
 
 run-ptest also needs to parse the output and reformat results into the 
 standard ptest/automake format, such as PASS: foo, FAIL: foo and SKIP: 
 foo.

How verbose should the output be? The TEST script actually does its own
analyzing and summarizing of the test results. Do we want the summary
only or all the details? Do you want the detailed output converted to
ptest format too?

For example,

# ./TEST 
t/base/condok
t/base/if..ok
t/base/lex.ok
t/base/num.ok

# ./TEST -v
t/base/cond1..4
ok 1
ok 2
ok 3
ok 4
ok
t/base/if..1..2
ok 1
ok 2
ok
t/base/lex.1..57
#1  :x: eq :x:
ok 1

The output from the actual test case conforms to the TAP format (not
sure about the top-level TEST). If you have an analysis tool, why not
support one more widely used format? I can't see much value in forcing
one format everywhere.

jesse

___
Openembedded-core mailing list
Openembedded-core@lists.openembedded.org
http://lists.linuxtogo.org/cgi-bin/mailman/listinfo/openembedded-core


[OE-core] [PATCH 1/1] perl-tests: convert to ptest

2013-05-14 Thread Jesse Zhang
[YOCTO #4292]

Replace PERL_TEST_DIR with PTEST_PATH. Also add a run-ptest script and
rename tests with ptest in various places.

Signed-off-by: Jesse Zhang sen.zh...@windriver.com
---
 meta/recipes-devtools/perl/perl-5.14.3/run-ptest   |  2 ++
 .../perl/{perl-tests.inc = perl-ptest.inc}| 30 +++---
 meta/recipes-devtools/perl/perl_5.14.3.bb  |  2 +-
 3 files changed, 18 insertions(+), 16 deletions(-)
 create mode 100644 meta/recipes-devtools/perl/perl-5.14.3/run-ptest
 rename meta/recipes-devtools/perl/{perl-tests.inc = perl-ptest.inc} (48%)

diff --git a/meta/recipes-devtools/perl/perl-5.14.3/run-ptest 
b/meta/recipes-devtools/perl/perl-5.14.3/run-ptest
new file mode 100644
index 000..28935e1
--- /dev/null
+++ b/meta/recipes-devtools/perl/perl-5.14.3/run-ptest
@@ -0,0 +1,2 @@
+#!/bin/sh
+cd t  ./TEST
diff --git a/meta/recipes-devtools/perl/perl-tests.inc 
b/meta/recipes-devtools/perl/perl-ptest.inc
similarity index 48%
rename from meta/recipes-devtools/perl/perl-tests.inc
rename to meta/recipes-devtools/perl/perl-ptest.inc
index b97b467..a3b19f8 100644
--- a/meta/recipes-devtools/perl/perl-tests.inc
+++ b/meta/recipes-devtools/perl/perl-ptest.inc
@@ -1,19 +1,20 @@
-PACKAGES += perl-tests
-PERL_TEST_DIR = /opt/perl-tests
+inherit ptest
 
-do_install_append () {
-   mkdir -p ${D}${PERL_TEST_DIR}
-   cp -pv TestInit.pm MANIFEST config.sh ${D}${PERL_TEST_DIR}/
+SRC_URI += file://run-ptest
 
-   tar -cf - t/ | ( cd ${D}${PERL_TEST_DIR}  tar -xf - )
-   ln -sf ${bindir}/perl ${D}${PERL_TEST_DIR}/t/
-   ln -sf ${libdir}/perl/${PV} ${D}${PERL_TEST_DIR}/lib
+do_install_ptest () {
+   mkdir -p ${D}${PTEST_PATH}
+   cp -pv TestInit.pm MANIFEST config.sh ${D}${PTEST_PATH}/
+
+   tar -cf - t/ | ( cd ${D}${PTEST_PATH}  tar -xf - )
+   ln -sf ${bindir}/perl ${D}${PTEST_PATH}/t/
+   ln -sf ${libdir}/perl/${PV} ${D}${PTEST_PATH}/lib
 
for dir in `find ext/ dist/ cpan/ -maxdepth 2 -type d -name t ` ; do
-   tar -cf - $dir | ( cd ${D}${PERL_TEST_DIR}  tar -xf - )
+   tar -cf - $dir | ( cd ${D}${PTEST_PATH}  tar -xf - )
done
for file in `find ext dist cpan -name \*.t -o -name \test.pl`;  do
-   tar -cf - $file | ( cd ${D}${PERL_TEST_DIR}  tar -xf - )
+   tar -cf - $file | ( cd ${D}${PTEST_PATH}  tar -xf - )
done
 
# Tweaks to make tests pass
@@ -27,10 +28,9 @@ do_install_append () {
cp -pv lib/auto/XS/APItest/APItest.so 
${D}${libdir}/perl/${PV}/auto/XS/APItest/
mkdir -p ${D}${libdir}/perl/${PV}/auto/XS/Typemap
cp -pv lib/auto/XS/Typemap/Typemap.so 
${D}${libdir}/perl/${PV}/auto/XS/Typemap/
-   cp -pv cpan/Digest-MD5/README ${D}${PERL_TEST_DIR}/cpan/Digest-MD5/
-   cp -pv cpan/Digest-MD5/MD5.xs ${D}${PERL_TEST_DIR}/cpan/Digest-MD5/
+   cp -pv cpan/Digest-MD5/README ${D}${PTEST_PATH}/cpan/Digest-MD5/
+   cp -pv cpan/Digest-MD5/MD5.xs ${D}${PTEST_PATH}/cpan/Digest-MD5/
 }
 
-FILES_${PN}-tests = ${PERL_TEST_DIR} \
- ${libdir}/perl/${PV}/AnyDBM_File.t
-RDEPENDS_${PN}-tests = ${PN}-modules ${PN}-doc ${PN}-misc
+FILES_${PN}-ptest += ${libdir}/perl/${PV}/AnyDBM_File.t
+RDEPENDS_${PN}-ptest += ${PN}-modules ${PN}-doc ${PN}-misc
diff --git a/meta/recipes-devtools/perl/perl_5.14.3.bb 
b/meta/recipes-devtools/perl/perl_5.14.3.bb
index 72efc63..9915042 100644
--- a/meta/recipes-devtools/perl/perl_5.14.3.bb
+++ b/meta/recipes-devtools/perl/perl_5.14.3.bb
@@ -324,7 +324,7 @@ RPROVIDES_perl-lib = perl-lib
 require perl-rdepends_${PV}.inc
 require perl-rprovides.inc
 require perl-rprovides_${PV}.inc
-include perl-tests.inc
+require perl-ptest.inc
 
 SSTATE_SCAN_FILES += *.pm *.pod *.h *.pl *.sh
 
-- 
1.7.11.7


___
Openembedded-core mailing list
Openembedded-core@lists.openembedded.org
http://lists.linuxtogo.org/cgi-bin/mailman/listinfo/openembedded-core


Re: [OE-core] [PATCH 1/1] perl-tests: convert to ptest

2013-05-14 Thread Björn Stenberg
Jesse Zhang wrote:
 +++ b/meta/recipes-devtools/perl/perl-5.14.3/run-ptest
 @@ -0,0 +1,2 @@
 +#!/bin/sh
 +cd t  ./TEST

run-ptest also needs to parse the output and reformat results into the standard 
ptest/automake format, such as PASS: foo, FAIL: foo and SKIP: foo.

-- 
Björn

___
Openembedded-core mailing list
Openembedded-core@lists.openembedded.org
http://lists.linuxtogo.org/cgi-bin/mailman/listinfo/openembedded-core