Ticket #357: tt357-better_native_pbc_t.patch
File tt357-better_native_pbc_t.patch, 27.3 KB (added by rurban, 13 years ago) |
---|
-
lib/Parrot/BuildUtil.pm
old new 12 12 13 13 =head1 DESCRIPTION 14 14 15 This package holds three subroutines: C<parrot_version()>, C<slurp_file>,16 and C<generated_file_header>. Subroutines are not exported--each must be17 requested by using a fully qualified name.15 This package holds pre-configure time subroutines, which are not exported 16 and should not require Parrot::Config. 17 Each must be requested by using a fully qualified name. 18 18 19 19 =head1 SUBROUTINES 20 20 … … 134 134 return $header; 135 135 } 136 136 137 1; 137 =item C<get_bc_version()> 138 138 139 =back 139 Return an array of ($bc_major, $bc_minor) from F<PBC_COMPAT>. 140 This is used in the native_pbc tests. 141 142 See also F<tools/dev/pbc_header.pl> and F<tools/build/pbcversion_h.pl>. 140 143 141 = head1 AUTHOR144 =cut 142 145 143 Gregor N. Purdy. Revised by James E Keenan. 146 sub get_bc_version { 147 my $compat_file = 'PBC_COMPAT'; 148 my ( $bc_major, $bc_minor ); 149 open my $IN, '<', $compat_file or die "Can't read $compat_file"; 150 while (<$IN>) { 151 if (/^(\d+)\.0*(\d+)/) { 152 ( $bc_major, $bc_minor ) = ( $1, $2 ); 153 last; 154 } 155 } 156 unless ( defined $bc_major && defined $bc_minor ) { 157 die "No bytecode version found in '$compat_file'."; 158 } 159 close $IN; 160 return ( $bc_major, $bc_minor ); 161 } 162 163 1; 164 165 =back 144 166 145 167 =cut 146 168 -
tools/build/pbcversion_h.pl
old new 21 21 use warnings; 22 22 use strict; 23 23 use lib 'lib'; 24 use Parrot::BuildUtil; 24 25 25 my ( $major, $minor ); 26 27 my $compat_file = 'PBC_COMPAT'; 28 open my $IN, '<', $compat_file or die "Can't read $compat_file"; 29 while (<$IN>) { 30 if (/^(\d+)\.0*(\d+)/) { 31 ( $major, $minor ) = ( $1, $2 ); 32 last; 33 } 34 } 35 close $IN; 26 my ( $major, $minor ) = Parrot::BuildUtil::get_bc_version(); 36 27 37 28 unless ( defined $major && defined $minor ) { 38 die "No bytecode version found in ' $compat_file'.";29 die "No bytecode version found in 'PBC_COMPAT'."; 39 30 } 40 31 41 32 print << "EOF"; 42 33 /* ex: set ro: 43 34 * !!!!!!! DO NOT EDIT THIS FILE !!!!!!! 44 35 * 45 * This file is generated automatically from ' $compat_file'36 * This file is generated automatically from 'PBC_COMPAT' 46 37 * by $0. 47 38 * 48 39 * Any changes made here will be lost! -
t/native_pbc/integer.t
old new 7 7 use lib qw( . lib ../lib ../../lib ); 8 8 use Test::More; 9 9 use Parrot::Config; 10 use Parrot::BuildUtil; 10 11 11 use Parrot::Test tests => 5;12 use Parrot::Test tests => 7; 12 13 13 14 =head1 NAME 14 15 … … 22 23 23 24 Tests word-size/float-type/endian-ness for different architectures. 24 25 25 These tests usually only work on releases, not on svn checkouts 26 and if every release has updated native pbc test files. 27 28 See F<tools/dev/mk_native_pbc> to create the platform-specific native pbcs. 26 These tests usually only work on updated native pbc test files. 27 See F<tools/dev/mk_native_pbc> to create the platform-specific 28 native pbcs. 29 29 30 30 =head1 PLATFORMS 31 31 32 _1 i386 32 bit opcode_t, 32 bit intval 33 (linux-gcc-i x86, freebsd-gcc, cygwin)32 _1 i386 32 bit opcode_t, 32 bit intval, 8 byte double 33 (linux-gcc-i386, freebsd-gcc, cygwin, ...) 34 34 35 _2 i386 32 bit opcode_t, 32 bit intval, 12 b itlong double36 (linux-gcc-i x86)35 _2 i386 32 bit opcode_t, 32 bit intval, 12 byte long double 36 (linux-gcc-i386 or cygwin with --floatval="long double") 37 37 38 _3 PPC BE 32 bit opcode_t, 32 bit intval 38 _3 PPC BE 32 bit opcode_t, 32 bit intval, 8 byte double 39 39 (darwin-ppc) 40 40 41 _4 x86_64 12-bit double 64 bit opcode_t 42 (linux-gcc-x86_64 -m96bit-long-double) 41 _4 x86_64 64 bit opcode_t, 64 bit intval, 8 byte double 42 (linux-gcc-x86_64 resp. amd64, solaris-cc-64int) 43 44 _5 x86_64 64 bit opcode_t, 64 bit intval, 16 byte long double 45 (linux-gcc-x86_64, solaris-cc-64int --floatval="long double") 43 46 44 _ 5 x86_64 16 bit long double 64 bit opcode_t45 ( linux-gcc-x86_64, solaris-cc-64int)47 _6 big-endian 64 bit opcode_t, 64 bit intval, 8 byte double 48 (Sparc64/Solaris, MIPS irix or similar) 46 49 47 _ 6 big-endian 64-bit48 ( MIPS irix or similar)50 _7 big-endian 64 bit opcode_t, 64 bit intval, 16 byte long double 51 (Sparc64/Solaris --floatval="long double") 49 52 50 53 =cut 51 54 … … 77 80 78 81 =cut 79 82 83 my @archtest = qw(4_le 4_le 4_be 4_le 8_le 8_be 8_be); 84 sub this_arch { 85 return $PConfig{intvalsize} 86 . "_" 87 . (substr($PConfig{byteorder},0,2) eq '12' ? "le" : "be"); 88 } 89 90 sub bc_version($) { 91 my $f = shift; 92 my $b; 93 open my $F, "<", "$f" or return "Can't open $f: $!"; 94 binmode $F; 95 seek $F, 14, 0; 96 read $F, $b, 8; 97 my ($bc_major, $bc_minor) = unpack "cc", $b; 98 return ($bc_major . "." . $bc_minor); 99 } 100 my ( $bc_major, $bc_minor ) = Parrot::BuildUtil::get_bc_version(); 101 my $bc = ($bc_major . "." . $bc_minor); 102 my $arch = this_arch(); 103 # all should pass 104 my $todo = {}; 105 my $skip = {}; 106 107 # expected result 108 my $output = '270544960'; 109 110 # test_pbc_integer(1, "i386 8-byte double float, 32 bit opcode_t"); 111 sub test_pbc_integer { 112 my $id = shift; 113 my $desc = shift; 114 my $file = "t/native_pbc/integer_$id.pbc"; 115 my $cvt = "$archtest[$id-1]=>$arch"; 116 my $skip_msg; 117 # check if this a platform where we can produce the needed file 118 if ($archtest[$id-1] eq $arch) { 119 $skip_msg = "Want to help? Regenerate $file " 120 . "with tools/dev/mk_native_pbc --noconf"; 121 } 122 else { 123 $skip_msg = "$file is outdated. " 124 . "Need $archtest[$id-1] platform."; 125 } 126 # check if skip or todo 127 SKIP: { 128 if ( $skip->{$id} ) { 129 skip "$cvt not yet implemented", 1 130 } 131 elsif ( $todo->{$id} ) { 132 skip $skip_msg, 1 133 if ($bc ne bc_version($file)); 134 pbc_output_is( undef, $output, "$cvt $desc", 135 todo => "$cvt yet untested, TT #357. " 136 . "Please report success." ); 137 } 138 else { 139 skip $skip_msg, 1 140 if ($bc ne bc_version($file)); 141 pbc_output_is( undef, $output, "$cvt $desc" ); 142 } 143 } 144 } 145 80 146 # execute the file t/native_pbc/integer_1.pbc 81 147 # 82 148 # any ordinary intel 386 linux, cygwin, mingw, MSWin32, ... … … 84 150 # wordsize = 4 (interpreter's wordsize/INTVAL = 4/4) 85 151 # byteorder = 0 (interpreter's byteorder = 0) 86 152 # floattype = 0 (interpreter's NUMVAL_SIZE = 8) 87 # parrot-version 0.9. 0, bytecode-version 3.34153 # parrot-version 0.9.1, bytecode-version 3.36 88 154 # UUID type = 0, UUID size = 0 89 155 # no endianize, no opcode, no numval transform 90 156 # dirformat = 1 91 157 # ] 92 TODO: { 93 local $TODO; 94 if ($PConfig{ptrsize} == 8) { 95 $TODO = "Known problem on 64bit with reading 32bit dirs. See TT #254" 96 } elsif ($PConfig{DEVEL}) { 97 $TODO = "devel versions are not guaranteed to succeed"; 98 } 158 test_pbc_integer(1, "i386 8-byte double float, 32 bit opcode_t, 4-byte int"); 99 159 100 pbc_output_is( undef, '270544960', "i386 32 bit opcode_t, 32 bit intval" ) 101 or diag "May need to regenerate t/native_pbc/integer_1.pbc; read test file"; 102 103 # adding --floatval='long double' 160 # adding --floatval="long double" --jitcapable=0 104 161 # HEADER => [ 105 162 # wordsize = 4 (interpreter's wordsize/INTVAL = 4/4) 106 163 # byteorder = 0 (interpreter's byteorder = 0) 107 164 # floattype = 1 (interpreter's NUMVAL_SIZE = 12) 108 # parrot-version 0.9. 0, bytecode-version 3.34165 # parrot-version 0.9.1, bytecode-version 3.36 109 166 # UUID type = 0, UUID size = 0 110 167 # no endianize, no opcode, no numval transform 111 168 # dirformat = 1 112 169 # ] 113 pbc_output_is( undef, '270544960', "i386 32 bit opcode_t, 32 bit intval 12-byte long double" ) 114 or diag "May need to regenerate t/native_pbc/integer_2.pbc; read test file"; 170 test_pbc_integer(2, "i386 12-byte double float, 32 bit opcode_t, 4-byte int"); 115 171 116 172 # darwin/ppc: 117 173 # HEADER => [ … … 123 179 # no endianize, no opcode, no numval transform 124 180 # dirformat = 1 125 181 # ] 126 127 pbc_output_is(undef, '270544960', "PPC BE 32 bit opcode_t, 32 bit intval") 128 or diag "May need to regenerate t/native_pbc/integer_3.pbc; read test file"; 129 130 } 131 132 TODO: { 133 local $TODO; 134 if ($PConfig{ptrsize} == 4) { 135 $TODO = "Known problem on 32bit with reading 64bit dirs. See TT #254" 136 # Unknown PMC type to thaw 0 137 } elsif ($PConfig{DEVEL}) { 138 $TODO = "devel versions are not guaranteed to succeed"; 139 } 182 test_pbc_integer(3, "PPC BE 32 bit opcode_t, 4-byte int"); 140 183 141 184 # any ordinary 64-bit intel unix: 142 185 # HEADER => [ 143 186 # wordsize = 8 (interpreter's wordsize/INTVAL = 8/8) 144 187 # byteorder = 0 (interpreter's byteorder = 0) 145 188 # floattype = 0 (interpreter's NUMVAL_SIZE = 8) 146 # parrot-version 0.9. 0, bytecode-version 3.34189 # parrot-version 0.9.1, bytecode-version 3.36 147 190 # UUID type = 0, UUID size = 0 148 191 # no endianize, no opcode, no numval transform 149 192 # dirformat = 1 150 193 # ] 194 test_pbc_integer(4, "i86_64 LE 64 bit opcode_t, 8-byte int, 8-byte double"); 151 195 152 pbc_output_is(undef, '270544960', "i86_64 LE 64 bit opcode_t, 64 bit intval") 153 or diag "May need to regenerate t/native_pbc/integer_4.pbc; read test file"; 154 155 # adding --floatval='long double' 196 # adding --floatval="long double" 156 197 # HEADER => [ 157 198 # wordsize = 8 (interpreter's wordsize/INTVAL = 8/8) 158 199 # byteorder = 0 (interpreter's byteorder = 0) … … 162 203 # no endianize, no opcode, no numval transform 163 204 # dirformat = 1 164 205 # ] 206 test_pbc_integer(5, "i86_64 LE 64 bit opcode_t, 8-byte int, 16-byte double"); 165 207 166 pbc_output_is(undef, '270544960', "i86_64 LE 64 bit opcode_t, 64 bit intval, 16-byte long double") 167 or diag "May need to regenerate t/native_pbc/integer_5.pbc; read test file"; 168 169 # Formerly following tests had been set up: 170 # pbc_output_is(undef, '270544960', "big-endian 64-bit (irix)"); 171 # or diag "May need to regenerate t/native_pbc/integer_6.pbc; read test file"; 208 # ppc/mips -m64 209 # HEADER => [ 210 # wordsize = 8 (interpreter's wordsize/INTVAL = 8/8) 211 # byteorder = 1 (interpreter's byteorder = 0) 212 # floattype = 0 (interpreter's NUMVAL_SIZE = 8) 213 # parrot-version 0.9.1, bytecode-version 3.35 214 # UUID type = 0, UUID size = 0 215 # *need* endianize, no opcode, no numval transform 216 # dirformat = 1 217 # ] 218 test_pbc_integer(6, "big-endian 64-bit, 8-byte int, 8-byte double"); 172 219 173 } 220 # ppc/mips -m64 --floatval="long double" 221 test_pbc_integer(7, "big-endian 64-bit, 8-byte int, 16-byte double"); 174 222 175 223 # Local Variables: 176 224 # mode: cperl -
t/native_pbc/number.t
old new 7 7 use lib qw( . lib ../lib ../../lib ); 8 8 use Test::More; 9 9 use Parrot::Config; 10 use Parrot::BuildUtil; 10 11 11 use Parrot::Test tests => 5;12 use Parrot::Test tests => 7; 12 13 13 14 =head1 NAME 14 15 … … 22 23 23 24 Tests word-size/float-type/endian-ness for different architectures. 24 25 25 These tests usually only work on releases, not on svn checkouts 26 and if every release has updated native pbc test files. 27 28 See F<tools/dev/mk_native_pbc> to create the platform-specific native pbcs. 26 These tests usually only work on updated native pbc test files. 27 See F<tools/dev/mk_native_pbc> to create the platform-specific 28 native pbcs. 29 29 30 30 =head1 PLATFORMS 31 31 32 _1 i386 32 bit opcode_t, 32 bit intval (linux-gcc-ix86, freebsd-gcc, cygwin) 33 _2 i386 32 bit opcode_t, 32 bit intval, 12 bit long double (linux-gcc-ix86) 34 _3 PPC BE 32 bit opcode_t, 32 bit intval (darwin-ppc) 35 _4 x86_64 12-bit double 64 bit opcode_t (linux-gcc-x86_64 -m96bit-long-double) 36 _5 x86_64 16 bit long double 64 bit opcode_t (linux-gcc-x86_64, solaris-cc-64int) 37 _6 big-endian 64-bit (MIPS irix or similar) 32 _1 i386 32 bit opcode_t, 32 bit intval, 8 byte double 33 (linux-gcc-i386, freebsd-gcc, cygwin, ...) 34 35 _2 i386 32 bit opcode_t, 32 bit intval, 12 byte long double 36 (linux-gcc-i386 or cygwin with --floatval="long double") 37 38 _3 PPC BE 32 bit opcode_t, 32 bit intval, 8 byte double 39 (darwin-ppc) 40 41 _4 x86_64 64 bit opcode_t, 64 bit intval, 8 byte double 42 (linux-gcc-x86_64 resp. amd64, solaris-cc-64int) 43 44 _5 x86_64 64 bit opcode_t, 64 bit intval, 16 byte long double 45 (linux-gcc-x86_64, solaris-cc-64int --floatval="long double") 46 47 _6 big-endian 64 bit opcode_t, 64 bit intval, 8 byte double 48 (Sparc64/Solaris, MIPS irix or similar) 49 50 _7 big-endian 64 bit opcode_t, 64 bit intval, 16 byte long double 51 (Sparc64/Solaris --floatval="long double") 38 52 39 53 =cut 40 54 55 # tt #357: need better testmatrix for coverage overview 56 # float conversion src: left-side (pbc) to dest: upper-side (platform) 57 # 1: tested ok, 0: fails (skip), ?: not yet tested (todo) 58 my $testmatrix = <<EOF; 59 8_le 12_le 16_le 8_be 16_be 60 8_le 1 1 ? ? ? 61 12_le 1 1 ? ? ? 62 16_le 1 1 1 ? ? 63 8_be 1 1 ? 1 ? 64 16_be 1 1 1 ? 1 65 EOF 66 41 67 =begin comment 42 68 43 69 # these are PBC files generated from t/op/number_1.pasm with … … 55 81 # - include the pbc_dump header info for reference 56 82 # - put the file into MANIFEST 57 83 # - add the file as binary (svn add) and commit it 58 # thanks -leo 84 # thanks -leo and reini 59 85 60 86 On test failures please add the output of 61 87 … … 65 91 66 92 =cut 67 93 94 # 8_le 12_le 16_le 8_be 16_be 95 #8_le 1 1 ? ? ? 96 #12_le 1 1 ? ? ? 97 #16_le 1 1 1 ? ? 98 #8_be 1 1 ? 1 ? 99 #16_be 1 1 1 ? 1 100 my $destarch = { '8_le' => [1,4], '12_le' => [2], '16_le' => [5], 101 '8_be' => [3,6], '16_be' => [7] }; 102 # the reverse: which tests for which arch 103 my @archtest = qw(8_le 12_le 8_be 8_le 16_le 8_be 16_be); 104 # @todo lists of tests for your architecture. 105 # e.g. for arch 8_le => tests (8_be) => todo (3 6) 106 sub generate_skip_list { 107 my $arch = shift; 108 my $check = shift; 109 my %skip; 110 my @lines = split /\n/, $testmatrix; 111 my @dest = split /\s+/, shift @lines; 112 shift @dest unless $dest[0]; 113 my $i = 0; 114 my %cols = map { $_ => $i++ } @dest; 115 my $col = $cols{$arch}; # the column for our arch 116 for my $s (@lines) { 117 my @s = split /\s+/, $s; 118 my $pbc = shift @s; 119 if ($s[$col] eq $check) { 120 for (@{$destarch->{$pbc}}) { $skip{$_}++ } 121 } 122 } 123 \%skip 124 } 125 # 16_le 126 sub this_arch { 127 return $PConfig{numvalsize} 128 . "_" 129 . (substr($PConfig{byteorder},0,2) eq '12' ? "le" : "be"); 130 } 131 132 sub bc_version($) { 133 my $f = shift; 134 my $b; 135 open my $F, "<", "$f" or return "Can't open $f: $!"; 136 binmode $F; 137 seek $F, 14, 0; 138 read $F, $b, 8; 139 my ($bc_major, $bc_minor) = unpack "cc", $b; 140 return ($bc_major . "." . $bc_minor); 141 } 142 my ( $bc_major, $bc_minor ) = Parrot::BuildUtil::get_bc_version(); 143 my $bc = ($bc_major . "." . $bc_minor); 144 my $arch = this_arch(); 145 my $todo = generate_skip_list($arch, '?'); 146 my $skip = generate_skip_list($arch, '0'); 147 68 148 my $output = << 'END_OUTPUT'; 69 149 1 70 150 4 … … 94 174 1.12589990684262e+15 95 175 END_OUTPUT 96 176 97 # execute t/native_pbc/number_1.pbc 177 # test_pbc_number(1, "i386 8-byte double float, 32 bit opcode_t"); 178 sub test_pbc_number { 179 my $id = shift; 180 my $desc = shift; 181 my $cvt = "$archtest[$id-1]=>$arch"; 182 my $skip_msg; 183 # check if this a platform where we can produce the needed file 184 if ($archtest[$id-1] eq $arch) { 185 $skip_msg = "Want to help? Regenerate t/native_pbc/number_$id.pbc " 186 . "with tools/dev/mk_native_pbc --noconf"; 187 } 188 else { 189 $skip_msg = "t/native_pbc/number_$id.pbc is outdated. " 190 . "Need $archtest[$id-1] platform."; 191 } 192 # check if skip or todo 193 SKIP: { 194 if ( $skip->{$id} ) { 195 skip "$cvt not yet implemented", 1 196 } 197 elsif ( $todo->{$id} ) { 198 skip $skip_msg, 1 199 if ($bc ne bc_version("t/native_pbc/number_$id.pbc")); 200 pbc_output_is( undef, $output, "$cvt $desc", 201 todo => "$cvt yet untested, TT #357. " 202 . "Please report success." ); 203 } 204 else { 205 skip $skip_msg, 1 206 if ($bc ne bc_version("t/native_pbc/number_$id.pbc")); 207 pbc_output_is( undef, $output, "$cvt $desc" ); 208 } 209 } 210 } 211 212 # execute t/native_pbc/number_*.pbc 98 213 # 99 214 # any ordinary intel 386 linux, cygwin, mingw, MSWin32, ... 100 215 # HEADER => [ 101 216 # wordsize = 4 (interpreter's wordsize/INTVAL = 4/4) 102 217 # byteorder = 0 (interpreter's byteorder = 0) 103 218 # floattype = 0 (interpreter's NUMVAL_SIZE = 8) 104 # parrot-version 0.9. 0, bytecode-version 3.34219 # parrot-version 0.9.1, bytecode-version 3.36 105 220 # UUID type = 0, UUID size = 0 106 221 # no endianize, no opcode, no numval transform 107 222 # dirformat = 1 108 223 # ] 109 TODO: { 110 local $TODO; 111 if ($PConfig{ptrsize} == 8) { 112 $TODO = "Known problem on 64bit with reading 32bit dirs. See TT #254" 113 } elsif ($PConfig{DEVEL}) { 114 $TODO = "devel versions are not guaranteed to succeed"; 115 } 116 117 pbc_output_is( undef, $output, "i386 double float 32 bit opcode_t" ) 118 or diag "May need to regenerate t/native_pbc/number_1.pbc; read test file"; 224 test_pbc_number(1, "i386 8-byte double float, 32 bit opcode_t"); 119 225 120 226 # HEADER => [ 121 227 # wordsize = 4 (interpreter's wordsize/INTVAL = 4/4) 122 228 # byteorder = 0 (interpreter's byteorder = 0) 123 229 # floattype = 1 (interpreter's NUMVAL_SIZE = 12) 124 # parrot-version 0.9. 0, bytecode-version 3.34230 # parrot-version 0.9.1, bytecode-version 3.36 125 231 # UUID type = 0, UUID size = 0 126 232 # no endianize, no opcode, no numval transform 127 233 # dirformat = 1 128 234 # ] 129 pbc_output_is( undef, $output, "i386 long double float 32 bit opcode_t") 130 or diag "May need to regenerate t/native_pbc/number_2.pbc; read test file"; 235 test_pbc_number(2, "i386 12-byte long double float, 32 bit opcode_t"); 131 236 132 237 # darwin/ppc: 133 238 # HEADER => [ … … 139 244 # no endianize, no opcode, no numval transform 140 245 # dirformat = 1 141 246 # ] 142 143 pbc_output_is(undef, $output, "PPC double float 32 bit BE opcode_t") 144 or diag "May need to regenerate t/native_pbc/number_3.pbc; read test file"; 145 } 146 147 TODO: { 148 local $TODO; 149 if ($PConfig{ptrsize} == 4) { 150 $TODO = "Known problem on 32bit with reading 64bit dirs. See TT #254" 151 # Unknown PMC type to thaw 0 152 } elsif ($PConfig{DEVEL}) { 153 $TODO = "devel versions are not guaranteed to succeed"; 154 } 247 test_pbc_number(3, "PPC double float 32 bit BE opcode_t"); 155 248 156 249 # any ordinary 64-bit intel unix: 157 250 # HEADER => [ 158 251 # wordsize = 8 (interpreter's wordsize/INTVAL = 8/8) 159 252 # byteorder = 0 (interpreter's byteorder = 0) 160 253 # floattype = 0 (interpreter's NUMVAL_SIZE = 8) 161 # parrot-version 0.9. 0, bytecode-version 3.34254 # parrot-version 0.9.1, bytecode-version 3.36 162 255 # UUID type = 0, UUID size = 0 163 256 # no endianize, no opcode, no numval transform 164 257 # dirformat = 1 165 258 # ] 259 test_pbc_number(4, "i86_64 LE 64 bit opcode_t, 8-byte double"); 166 260 167 pbc_output_is(undef, $output, "i86_64 LE 64 bit opcode_t, 64 bit intval") 168 or diag "May need to regenerate t/native_pbc/number_4.pbc; read test file"; 169 261 # i86_64 with floatval='long double' 170 262 # HEADER => [ 171 263 # wordsize = 8 (interpreter's wordsize/INTVAL = 8/8) 172 264 # byteorder = 0 (interpreter's byteorder = 0) … … 176 268 # no endianize, no opcode, no numval transform 177 269 # dirformat = 1 178 270 # ] 179 pbc_output_is(undef, $output, "i86_64 LE 64 bit opcode_t, 64 bit intval, long double") 180 or diag "May need to regenerate t/native_pbc/integer_5.pbc; read test file"; 271 test_pbc_number(5, "i86_64 LE 64 bit opcode_t, long double"); 181 272 182 # Formerly there were also a test for: 183 # pbc_output_is(undef, $output, "big-endian 64-bit irix") 184 # or diag "May need to regenerate t/native_pbc/number_6.pbc; read test file"; 273 # PowerPC64 -m64 274 # HEADER => [ 275 # wordsize = 8 (interpreter's wordsize/INTVAL = 8/8) 276 # byteorder = 1 (interpreter's byteorder = 0) 277 # floattype = 0 (interpreter's NUMVAL_SIZE = 8) 278 # parrot-version 0.9.1, bytecode-version 3.35 279 # UUID type = 0, UUID size = 0 280 # *need* endianize, no opcode, no numval transform 281 # dirformat = 1 282 # ] 283 test_pbc_number(6, "big-endian 64-bit, 8-byte double"); 185 284 186 } 285 # PowerPC64 --floatval="long double" 286 test_pbc_number(7, "big-endian 64-bit, 16-byte long double"); 187 287 188 288 # Local Variables: 189 289 # mode: cperl -
t/native_pbc/string.t
old new 7 7 use lib qw( . lib ../lib ../../lib ); 8 8 use Test::More; 9 9 use Parrot::Config; 10 use Parrot::BuildUtil; 10 11 11 12 use Parrot::Test tests => 1; 12 13 … … 20 21 21 22 =head1 DESCRIPTION 22 23 23 Tests word-size/string/endian-ness for different architectures. 24 Tests word-size/endian-ness for different architectures. 25 TODO: Test foreign charsets and encodings. 24 26 25 These tests usually only work on releases, not on svn checkouts 26 and if every release has updated native pbc test files. 27 28 See F<tools/dev/mk_native_pbc> to create the platform-specific native pbcs. 27 These tests usually only work on updated native pbc test files. 28 See F<tools/dev/mk_native_pbc> to create the platform-specific 29 native pbcs. 29 30 30 31 =head1 PLATFORMS 31 32 … … 34 35 _3 PPC BE 32 bit opcode_t, 32 bit intval (darwin-ppc) 35 36 _4 x86_64 double float 64 bit opcode_t (linux-gcc-x86_64, solaris-cc-64int) 36 37 _5 x86_64 16 bit long double 64 bit opcode_t (linux-gcc-x86_64, solaris-cc-64int) 37 _6 big-endian 64-bit (MIPS irix or similar) 38 _6 big-endian 64 bit opcode_t, 8 byte double (Sparc64/Solaris, MIPS irix) 39 _7 big-endian 64 bit opcode_t, 16 byte long double (Sparc64/Solaris, MIPS irix) 38 40 39 41 =cut 40 42 … … 47 49 48 50 =cut 49 51 52 sub bc_version($) { 53 my $f = shift; 54 my $b; 55 open my $F, "<", "$f" or return "Can't open $f: $!"; 56 binmode $F; 57 seek $F, 14, 0; 58 read $F, $b, 8; 59 my ($bc_major, $bc_minor) = unpack "cc", $b; 60 return ($bc_major . "." . $bc_minor); 61 } 62 my ( $bc_major, $bc_minor ) = Parrot::BuildUtil::get_bc_version(); 63 my $bc = ($bc_major . "." . $bc_minor); 64 50 65 my $output = << 'END_OUTPUT'; 51 a2c52 ÂÃÂ 53 ÂÃÂ 54 a2c 66 %Ec 67 Dw 68 ABCX 69 X 55 70 END_OUTPUT 56 71 57 72 # execute t/native_pbc/string_1.pbc … … 60 75 # wordsize = 4 (interpreter's wordsize/INTVAL = 4/4) 61 76 # byteorder = 0 (interpreter's byteorder = 0) 62 77 # floattype = 0 (interpreter's NUMVAL_SIZE = 8) 63 # parrot-version 0.9. 0, bytecode-version 3.3478 # parrot-version 0.9.1, bytecode-version 3.36 64 79 # UUID type = 0, UUID size = 0 65 80 # no endianize, no opcode, no numval transform 66 81 # dirformat = 1 67 82 # ] 68 TODO: { 69 local $TODO; 70 if ($PConfig{ptrsize} == 8) { 71 $TODO = "Known problem on 64bit with reading 32bit dirs. See TT #254" 72 } elsif ($PConfig{DEVEL}) { 73 $TODO = "devel versions are not guaranteed to succeed"; 74 } else { 75 $TODO = "currently broken. See TT #254"; 76 } 77 78 pbc_output_is( undef, $output, "i386 32 bit opcode_t, 32 bit intval" ); 79 80 #pbc_output_is( undef, $output, "i386 32 bit opcode_t, 32 bit intval 12-byte long double" ); 81 #pbc_output_is( undef, $output, "PPC BE 32 bit opcode_t, 32 bit intval" ); 82 #pbc_output_is( undef, $output, "i86_64 LE 64 bit opcode_t, 64 bit intval" ); 83 #pbc_output_is( undef, $output, "i86_64 LE 64 bit opcode_t, 64 bit intval, 16-byte long double" ); 84 #pbc_output_is( undef, $output, "64bit BE 64 bit opcode_t, 64 bit intval" ); 83 SKIP: { 84 skip "Need to regenerate t/native_pbc/string_1.pbc; read test file", 1 85 if ($bc ne bc_version("t/native_pbc/string_1.pbc")); 85 86 87 pbc_output_is( undef, $output, "i386 LE 32 bit opcode_t" ); 86 88 } 89 #pbc_output_is( undef, $output, "i386 LE 32 bit opcode_t, 12-byte long double" ); 90 #pbc_output_is( undef, $output, "PPC BE 32 bit opcode_t" ); 91 #pbc_output_is( undef, $output, "i86_64 LE 64 bit opcode_t" ); 92 #pbc_output_is( undef, $output, "i86_64 LE 64 bit opcode_t, 16-byte long double" ); 93 #pbc_output_is( undef, $output, "64bit BE 64 bit opcode_t" ); 87 94 88 95 # Local Variables: 89 96 # mode: cperl -
tools/dev/mk_native_pbc
old new 51 51 # try --floatval="long double" and see if that makes 12 52 52 enable_long_double=1 53 53 # force double on 2nd run not to default to long double 54 conf=" --floatval= 'double'"54 conf=" --floatval=double" 55 55 fi 56 56 else 57 57 if [ "$byteorder" == "4321" ] … … 83 83 # try --floatval="long double" and see if that makes 16 84 84 enable_long_double=1 85 85 # force double on 2nd run not to default to long double 86 conf=" --floatval= 'double'"86 conf=" --floatval=double" 87 87 else 88 88 N=5 89 echo "5: x86_64 double float64 bit opcode_t, 16-byte long double"89 echo "5: x86_64 64 bit opcode_t, 16-byte long double" 90 90 fi 91 91 else 92 N=6 93 echo "6: big-endian 64-bit" 92 if [ "$numvalsize" == "8" ] 93 then 94 N=6 95 echo "6: big-endian 64-bit" 96 # try --floatval="long double" and see if that makes 16 97 enable_long_double=1 98 # force double on 2nd run not to default to long double 99 conf=" --floatval=double" 100 else 101 N=7 102 echo "7: ppc/BE 64 bit opcode_t, 16-byte long double" 103 fi 94 104 fi 95 105 else 96 106 echo "unsupported ptrsize $ptrsize" -
t/op/string.t
old new 2358 2358 ok 10 2359 2359 OUTPUT 2360 2360 2361 # string_133.pasm, used for t/native_pbc/string.t 2361 2362 pasm_output_is( <<'CODE', <<'OUTPUT', 'bxors 2' ); 2362 2363 set S1, "a2c" 2363 2364 set S2, "Dw" … … 2450 2451 2451 2452 SKIP: { 2452 2453 skip( "No unicode yet", 1 ); 2454 # This was the previous test used for t/native_pbc/string.t 2453 2455 pasm_output_is( <<'CODE', <<'OUTPUT', 'bnots 2' ); 2454 2456 getstdout P0 2455 2457 push P0, "utf8"