[svn:parrot] r36553 - in trunk: docs/project t/native_pbc tools/dev

rurban at svn.parrot.org rurban at svn.parrot.org
Tue Feb 10 18:02:28 UTC 2009


Author: rurban
Date: Tue Feb 10 18:02:28 2009
New Revision: 36553
URL: https://trac.parrot.org/parrot/changeset/36553

Log:
[cage] Fix TT #254 and RT #47940
* Update release_manager_guide.pod for tools/dev/mk_native_pbc.
* Fix t/native_pbc tests
* Enhance tools/dev/mk_native_pbc to check the current 
  platform and create the correct tests automatically.

Modified:
   trunk/docs/project/release_manager_guide.pod
   trunk/t/native_pbc/integer.t
   trunk/t/native_pbc/number.t
   trunk/t/native_pbc/string.t
   trunk/tools/dev/mk_native_pbc

Modified: trunk/docs/project/release_manager_guide.pod
==============================================================================
--- trunk/docs/project/release_manager_guide.pod	Tue Feb 10 17:57:31 2009	(r36552)
+++ trunk/docs/project/release_manager_guide.pod	Tue Feb 10 18:02:28 2009	(r36553)
@@ -106,11 +106,18 @@
 
 =item g
 
-Run C<perl tools/dev/pbc_header.pl --upd t/native_pbc/*.pbc>
+Coordinate 4-5 platforms to run C<tools/dev/mk_native_pbc>
+to update the native tests. Esp. when the PBC freeze state changed,
+when the tests fail. This happens quite frequently.
+You'd need 32-bit and 64-bit, little-endian and big-endian platforms.
+linux-gcc x86_64 or solaris, plus and darwin/ppc and irix are usually enough.
+C<svn commit> the changed F<t/native_pbc/*.pbc> files.
+
+If not possible, run at least
+C<perl tools/dev/pbc_header.pl --upd t/native_pbc/*.pbc>
 to update version and fingerprint in the native tests.
-Please check with C<prove t/native_pbc/*.t>.
 
-NOTE: Due to frequent PBC changes, these tests are currently skipped.
+Please check with C<prove t/native_pbc/*.t>.
 
 =item h
 

Modified: trunk/t/native_pbc/integer.t
==============================================================================
--- trunk/t/native_pbc/integer.t	Tue Feb 10 17:57:31 2009	(r36552)
+++ trunk/t/native_pbc/integer.t	Tue Feb 10 18:02:28 2009	(r36553)
@@ -8,7 +8,7 @@
 use Test::More;
 use Parrot::Config;
 
-use Parrot::Test tests => 3;
+use Parrot::Test tests => 4;
 
 =head1 NAME
 
@@ -22,11 +22,25 @@
 
 Tests word-size/float-type/endian-ness for different architectures.
 
+These tests usually only work on releases, not on svn checkouts
+and if every release has updated native pbc test files.
+
+See F<tools/dev/mk_native_pbc> to create the platform-specific native pbcs.
+
+=head1 PLATFORMS
+
+  _1   i386 32 bit opcode_t, 32 bit intval   (linux-gcc-ix86, freebsd-gcc, cygwin)
+  _2   i386 32 bit opcode_t, 32 bit intval, long double (linux-gcc-ix86)
+  _3   PPC BE 32 bit opcode_t, 32 bit intval (darwin-ppc)
+  _4   x86_64 double float 64 bit opcode_t   (linux-gcc-x86_64, solaris-cc-64int)
+  _5   big-endian 64-bit                     (irix or similar)
+
 =cut
 
 =begin comment
 
-See t/native_pbc/number.t for additional comments
+See t/native_pbc/number.t for additional comments.
+See tools/dev/mk_native_pbc to create the platform-specific native pbcs.
 
 Test files on different architectures are generated by:
 
@@ -63,11 +77,22 @@
 #         dirformat = 1
 # ]
 TODO: {
-local $TODO = "Known problem on 64bit with reading 32bit dirs. See TT #254"
-  if $PConfig{ptrsize} == 8;
+    local $TODO;
+    if ($PConfig{ptrsize} == 8) {
+        $TODO = "Known problem on 64bit with reading 32bit dirs. See TT #254"
+    } elsif ($PConfig{DEVEL}) {
+        $TODO = "devel versions are not guaranteed to succeed";
+    }
 
 pbc_output_is( undef, '270544960', "i386 32 bit opcode_t, 32 bit intval" )
     or diag "May need to regenerate t/native_pbc/integer_1.pbc; read test file";
+}
+
+TODO: {
+local $TODO = "devel versions are not guaranteed to succeed"
+  if $PConfig{DEVEL};
+pbc_output_is( undef, '270544960', "i386 32 bit opcode_t, 32 bit intval long double" )
+    or diag "May need to regenerate t/native_pbc/integer_2.pbc; read test file";
 
 # darwin/ppc:
 # HEADER => [
@@ -79,9 +104,9 @@
 #         no endianize, no opcode, no numval transform
 #         dirformat = 1
 # ]
+
 pbc_output_is(undef, '270544960', "PPC BE 32 bit opcode_t, 32 bit intval")
-    or diag "May need to regenerate t/native_pbc/integer_2.pbc; read test file";
-}
+    or diag "May need to regenerate t/native_pbc/integer_3.pbc; read test file";
 
 # any ordinary 64-bit intel unix:
 # HEADER => [
@@ -93,12 +118,15 @@
 #         no endianize, no opcode, no numval transform
 #         dirformat = 1
 # ]
-pbc_output_is( undef, '270544960', "x86_64 double float 64 bit opcode_t" )
-    or diag "May need to regenerate t/native_pbc/integer_3.pbc; read test file";
+
+pbc_output_is(undef, '270544960', "i86_64 LE 64 bit opcode_t, 64 bit intval")
+    or diag "May need to regenerate t/native_pbc/integer_4.pbc; read test file";
 
 # Formerly following tests had been set up:
-# pbc_output_is(undef, '270544960', "little-endian 64-bit tru64");
-# pbc_output_is(undef, '270544960', "big-endian 64-bit irix");
+# pbc_output_is(undef, '270544960', "big-endian 64-bit (irix)");
+#    or diag "May need to regenerate t/native_pbc/integer_5.pbc; read test file";
+
+}
 
 # Local Variables:
 #   mode: cperl

Modified: trunk/t/native_pbc/number.t
==============================================================================
--- trunk/t/native_pbc/number.t	Tue Feb 10 17:57:31 2009	(r36552)
+++ trunk/t/native_pbc/number.t	Tue Feb 10 18:02:28 2009	(r36553)
@@ -8,7 +8,7 @@
 use Test::More;
 use Parrot::Config;
 
-use Parrot::Test skip_all => "Ongoing work in TT #254";
+use Parrot::Test tests => 4;
 
 =head1 NAME
 
@@ -22,6 +22,19 @@
 
 Tests word-size/float-type/endian-ness for different architectures.
 
+These tests usually only work on releases, not on svn checkouts
+and if every release has updated native pbc test files.
+
+See F<tools/dev/mk_native_pbc> to create the platform-specific native pbcs.
+
+=head1 PLATFORMS
+
+  _1   i386 32 bit opcode_t, 32 bit intval   (linux-gcc-ix86, freebsd-gcc, cygwin)
+  _2   i386 32 bit opcode_t, 32 bit intval, long double (linux-gcc-ix86)
+  _3   PPC BE 32 bit opcode_t, 32 bit intval (darwin-ppc)
+  _4   x86_64 double float 64 bit opcode_t   (linux-gcc-x86_64, solaris-cc-64int)
+  _5   big-endian 64-bit                     (irix or similar)
+
 =cut
 
 =begin comment
@@ -93,12 +106,21 @@
 #         dirformat = 1
 # ]
 TODO: {
-local $TODO = "Known problem on 64bit with reading 32bit dirs. See TT #254"
-  if $PConfig{ptrsize} == 8;
+    local $TODO;
+    if ($PConfig{ptrsize} == 8) {
+        $TODO = "Known problem on 64bit with reading 32bit dirs. See TT #254"
+    } elsif ($PConfig{DEVEL}) {
+        $TODO = "devel versions are not guaranteed to succeed";
+    }
 
 pbc_output_is( undef, $output, "i386 double float 32 bit opcode_t" )
     or diag "May need to regenerate t/native_pbc/number_1.pbc; read test file";
 
+pbc_output_is( undef, $output, "i386 long double float 32 bit opcode_t")
+    or diag "May need to regenerate t/native_pbc/number_2.pbc; read test file";
+
+}
+
 # darwin/ppc:
 # HEADER => [
 #         wordsize  = 4   (interpreter's wordsize/INTVAL = 4/4)
@@ -109,9 +131,13 @@
 #         no endianize, no opcode, no numval transform
 #         dirformat = 1
 # ]
+
+TODO: {
+local $TODO = "devel versions are not guaranteed to succeed"
+  if $PConfig{DEVEL};
+
 pbc_output_is(undef, $output, "PPC double float 32 bit BE opcode_t")
-    or diag "May need to regenerate t/native_pbc/number_2.pbc; read test file";
-}
+    or diag "May need to regenerate t/native_pbc/number_3.pbc; read test file";
 
 # any ordinary 64-bit intel unix:
 # HEADER => [
@@ -123,18 +149,15 @@
 #         no endianize, no opcode, no numval transform
 #         dirformat = 1
 # ]
-TODO: {
-local $TODO = "Known problem on 64bit double-float gentoo-amd64, but not solaris-64int. See TT #254"
-  if $PConfig{ptrsize} == 8;
 
-pbc_output_is(undef, $output, "x86_64 double float 64 bit opcode_t")
-    or diag "May need to regenerate t/native_pbc/number_3.pbc; read test file";
-}
+pbc_output_is(undef, $output, "i86_64 LE 64 bit opcode_t, 64 bit intval")
+    or diag "May need to regenerate t/native_pbc/number_4.pbc; read test file";
 
-# Formerly there were tests for:
-# pbc_output_is(undef, <<OUTPUT, "i386 long double float 32 bit opcode_t"); #_2
-# pbc_output_is(undef, <<OUTPUT, "little-endian 64-bit tru64");             #_4
-# pbc_output_is(undef, <<OUTPUT, "big-endian 64-bit irix");                 #_5
+# Formerly there were also a test for:
+# pbc_output_is(undef, $output, "big-endian 64-bit irix")
+#   or diag "May need to regenerate t/native_pbc/number_5.pbc; read test file";
+
+}
 
 # Local Variables:
 #   mode: cperl

Modified: trunk/t/native_pbc/string.t
==============================================================================
--- trunk/t/native_pbc/string.t	Tue Feb 10 17:57:31 2009	(r36552)
+++ trunk/t/native_pbc/string.t	Tue Feb 10 18:02:28 2009	(r36553)
@@ -6,7 +6,9 @@
 use warnings;
 use lib qw( . lib ../lib ../../lib );
 use Test::More;
-use Parrot::Test skip_all => 'ongoing PBC format changes'; # tests => 1;
+use Parrot::Config;
+
+use Parrot::Test tests => 1;
 
 =head1 NAME
 
@@ -20,6 +22,19 @@
 
 Tests word-size/string/endian-ness for different architectures.
 
+These tests usually only work on releases, not on svn checkouts
+and if every release has updated native pbc test files.
+
+See F<tools/dev/mk_native_pbc> to create the platform-specific native pbcs.
+
+=head1 PLATFORMS
+
+  _1   i386 32 bit opcode_t, 32 bit intval   (linux-gcc-ix86, freebsd-gcc, cygwin)
+  _2   i386 32 bit opcode_t, 32 bit intval, long double (linux-gcc-ix86)
+  _3   PPC BE 32 bit opcode_t, 32 bit intval (darwin-ppc)
+  _4   x86_64 double float 64 bit opcode_t   (linux-gcc-x86_64, solaris-cc-64int)
+  _5   big-endian 64-bit                     (irix or similar)
+
 =cut
 
 =begin comment
@@ -49,8 +64,14 @@
 #         no endianize, no opcode, no numval transform
 #         dirformat = 1
 # ]
+TODO: {
+local $TODO = "devel versions are not guaranteed to succeed"
+  if $PConfig{DEVEL};
+
 pbc_output_is( undef, $output, "i386 32 bit opcode_t, 32 bit intval" );
 
+}
+
 # Local Variables:
 #   mode: cperl
 #   cperl-indent-level: 4

Modified: trunk/tools/dev/mk_native_pbc
==============================================================================
--- trunk/tools/dev/mk_native_pbc	Tue Feb 10 17:57:31 2009	(r36552)
+++ trunk/tools/dev/mk_native_pbc	Tue Feb 10 18:02:28 2009	(r36553)
@@ -1,32 +1,131 @@
 #!/bin/sh
 
-# generate t/native_pbc_{1,2}.pbc
-# this should be run on i386 systems to regenerate the first two
-# native tests
-# NOTE: This will need a perl compiled with long double support
+# sh tools/dev/mk_native_pbc [--noconf]
+#
+# generate t/native_pbc/_{1,2}.pbc
+# This should only be run on known systems to regenerate the native pbcs.
+# Better do not try that on mingw, use cygwin instead.
+#
+# NOTE:  For _2 this will need a compiler with long double support
 # NOTE2: Installing ccache speeds this process up considerably
+# NOTE3: Do not svn commit this on a devel release,
+#        update the VERSION and rm .parrot_current_rev
 
-# run it as:
-# $ sh tools/dev/mk_native_pbc
-
-make -s progclean
-make -s -C imcc clean
-perl Configure.pl --debugging --floatval="long double" --nomanicheck
-tail myconfig
-make -s
-./parrot -o n.pbc t/op/number_1.pasm
-mv n.pbc t/native_pbc/number_2.pbc
-
-make -s progclean
-make -s -C imcc clean
-perl Configure.pl --debugging --floatval=double --nomanicheck
+#  _1   i386 32 bit opcode_t, 32 bit intval   (linux-gcc-ix86, freebsd-gcc, cygwin)
+#  _2   i386 32 bit opcode_t, 32 bit intval, long double (linux-gcc-ix86)
+#  _3   PPC BE 32 bit opcode_t, 32 bit intval (darwin-ppc)
+#  _4   x86_64 double float 64 bit opcode_t   (linux-gcc-x86_64, solaris-cc-64int)
+#  _5   big-endian 64-bit                     (irix or similar)
+
+#tests:
+#parrot -o i.pbc -a - <<EOF
+#  print 0x10203040
+#  end
+#  EOF
+# t/op/number_1.pasm
+# t/op/string_133.pasm
+
+# check 32/64 bit, endianess, hugefloat
+N=
+enable_long_double=
+conf=
+exe=
+
+# unfortunately there are older perls around
+byteorder=$(perl -V:byteorder | perl -ne "s/byteorder='(\d+)';/\\1/; print")
+ptrsize=$(perl -V:ptrsize)
+
+if [ "$ptrsize" == "ptrsize='4';" ]
+then
+    if [ "$byteorder" == "1234" ]
+    then
+        N=1
+        if [ "$(perl -V:uselongdouble)" == "uselongdouble='define';" ]; then
+            enable_long_double=1
+            conf=" --floatval=double"
+        fi
+    else
+        if [ "$byteorder" == "4321" ]
+        then
+            N=3
+        else
+            if [ "$byteorder" == "12345678" \
+                 -a "$(perl -V:osname)" == "osname='cygwin';" ]
+            then
+                echo "detected cygwin use64bitint: ok"
+                N=1
+                exe=.exe
+            else
+                echo "unsupported perl -V:byteorder $byteorder"
+                exit 1
+            fi
+        fi
+    fi
+else
+    if [ "$ptrsize" == "ptrsize='8';" ]
+    then
+        if [ "$byteorder" == "12345678" ]
+        then
+            N=4
+        else
+            N=5
+        fi
+    else
+        echo "unsupported perl -V:ptrsize $ptrsize"
+        exit 1
+    fi
+fi
+
+if [ "$enable_long_double" == "1" ]; then
+    if [ "$1" != "--noconf" ]; then
+      make -s prog-clean
+      perl Configure.pl --debugging --floatval="long double" --nomanicheck
+    fi
+    tail myconfig
+    make -s || exit 1
+    [ -e t/op/number_1.pasm ] || perl t/harness t/op/number.t
+    [ -e t/op/string_133.pasm ] || perl t/harness t/op/string.t
+    ./parrot -o t/native_pbc/integer_2.pbc -a - <<EOF
+print 0x10203040
+end
+EOF
+    [ $? -le 0 ] && echo "t/native_pbc/integer_2.pbc updated"
+    ./parrot -o t/native_pbc/number_2.pbc t/op/number_1.pasm && echo "t/native_pbc/number_2.pbc updated"
+    ./parrot -o t/native_pbc/string_2.pbc t/op/string_133.pasm  && echo "t/native_pbc/string_2.pbc updated"
+
+    make pbc_dump$exe
+    ./pbc_dump -h t/native_pbc/number_2.pbc
+fi
+
+if [ "$1" != "--noconf" ]; then
+    make -s prog-clean
+    perl Configure.pl --debugging $conf --nomanicheck
+fi
 tail myconfig
-make -s
-./parrot -o n.pbc t/op/number_1.pasm
-mv n.pbc t/native_pbc/number_1.pbc
-
-make pbc_dump
-./pbc_dump -h t/native_pbc/number_1.pbc
-./pbc_dump -h t/native_pbc/number_2.pbc
+make -s || exit 1
 
-perl t/harness t/native_pbc/number.t
+[ -e t/op/number_1.pasm ] || perl t/harness t/op/number.t
+[ -e t/op/string_133.pasm ] || perl t/harness t/op/string.t
+./parrot -o t/native_pbc/integer_${N}.pbc -a - <<EOF
+print 0x10203040
+end
+EOF
+[ $? -le 0 ] && echo "t/native_pbc/integer_${N}.pbc updated"
+./parrot -o t/native_pbc/number_${N}.pbc t/op/number_1.pasm && echo "t/native_pbc/number_${N}.pbc updated"
+./parrot -o t/native_pbc/string_${N}.pbc t/op/string_133.pasm  && echo "t/native_pbc/string_${N}.pbc updated"
+
+make pbc_dump$exe
+./pbc_dump -h t/native_pbc/number_${N}.pbc
+
+perl t/harness t/native_pbc/integer.t && \
+    perl t/harness t/native_pbc/number.t && \
+    perl t/harness t/native_pbc/string.t
+
+echo ""
+if [ -e .parrot_current_rev ]
+then
+    echo "Do not commit these native_pbcs on devel versions, it must be a release candidate!"
+else
+    cd t/native_pbc
+    echo svn commit -m'native_pbc platform updates'
+fi


More information about the parrot-commits mailing list