Ticket #401: trac101-t-tools.patch
File trac101-t-tools.patch, 11.1 KB (added by rurban, 13 years ago) |
---|
-
MANIFEST
3716 3716 t/tools/ops2pm/samples/core_ops.orig [] 3717 3717 t/tools/ops2pm/samples/ops_num.orig [] 3718 3718 t/tools/ops2pm/samples/pic_ops.orig [] 3719 t/tools/parrot_config.t [] 3719 3720 t/tools/parrot_debugger.t [] 3721 t/tools/pbc_disassemble.t [] 3722 t/tools/pbc_info.t [] 3720 3723 t/tools/pbc_merge.t [] 3724 t/tools/pdump.t [] 3721 3725 t/tools/pmc2c.t [] 3722 3726 t/tools/pmc2cutils/00-qualify.t [] 3723 3727 t/tools/pmc2cutils/01-pmc2cutils.t [] -
t/tools/parrot_debugger.t
22 22 =head1 REQUIREMENTS 23 23 24 24 This test script requires you to build parrot_debugger, by typing 25 "make parrot_ debugger" (using a suitable make tool for your platform).25 "make parrot_utils" (using a suitable make tool for your platform). 26 26 If this requirement has not been met, all tests will be skipped. 27 27 28 28 =cut … … 32 32 use lib qw(lib); 33 33 34 34 use Test::More; 35 use IO::File ;35 use IO::File (); 36 36 use Parrot::Config; 37 37 use File::Spec; 38 38 … … 42 42 $path_to_pdb = File::Spec->catfile( ".", "parrot_debugger" ); 43 43 my $exefile = $path_to_pdb . $PConfig{exe}; 44 44 unless ( -f $exefile ) { 45 plan skip_all => "parrot_debugger hasn't been built ";45 plan skip_all => "parrot_debugger hasn't been built. Run make parrot_utils"; 46 46 exit(0); 47 47 } 48 48 } … … 101 101 my $output = join( '', <$f> ); 102 102 103 103 local $Test::Builder::Level = $Test::Builder::Level + 1; 104 unlink ($codefn, $stdinfn, $stdoutfn); 104 105 like( $output, $check, $diag ); 105 106 } 106 107 -
t/tools/pbc_disassemble.t
1 #! perl 2 # Copyright (C) 2007-2008, The Perl Foundation. 3 # $Id: pbc_disassemble.t 34223 2008-12-22 03:24:34Z petdance $ 4 5 =head1 NAME 6 7 t/tools/pbc_disassemble.t - test the Parrot Debugger 8 9 =head1 SYNOPSIS 10 11 % prove t/tools/pbc_disassemble.t 12 13 =head1 DESCRIPTION 14 15 Tests the C<pbc_disassemble> tool by providing it with a number of source 16 files, and running through it with various commands. 17 18 We never actually check the I<full> output of pbc_disassemble. We simply check 19 several smaller components to avoid a test file that is far too unwieldy. 20 21 22 =head1 REQUIREMENTS 23 24 This test script requires you to build pbc_disassemble, by typing 25 "make parrot_utils" (using a suitable make tool for your platform). 26 If this requirement has not been met, all tests will be skipped. 27 28 =cut 29 30 use strict; 31 use warnings; 32 use lib qw(lib); 33 34 use Test::More; 35 use IO::File (); 36 use Parrot::Config; 37 use File::Spec; 38 39 my $path; 40 my $parrot = File::Spec->catfile( ".", $PConfig{test_prog} ); 41 42 BEGIN { 43 $path = File::Spec->catfile( ".", "pbc_disassemble" ); 44 my $exefile = $path . $PConfig{exe}; 45 unless ( -f $exefile ) { 46 plan skip_all => "pbc_disassemble hasn't been built. Run make parrot_utils"; 47 exit(0); 48 } 49 plan tests => 2; 50 } 51 52 output_like( <<PIR, "pir", [ qr/set_n_nc/, qr/print_n/], 'pbc_disassemble'); 53 .sub main :main 54 \$N3 = 3.14159 55 print \$N3 56 print "\\n" 57 .end 58 PIR 59 60 =head1 HELPER SUBROUTINES 61 62 =head2 output_like 63 64 output_like(<<PASM, "pasm", "some output", "running $file"); 65 66 Takes 3-4 arguments: a file to run, 67 the filename-extension of the file (probably "pir" or "pasm"), 68 an arrayref or single regex string to match within pbc_disassemble's output, 69 and the optional test diagnostic. 70 71 =cut 72 73 my $testno = 0; 74 75 sub output_like { 76 my ( $file, $ext, $check, $diag ) = @_; 77 $testno++; 78 my $codefn = "$0.$testno.$ext"; 79 my $pbcfn = "$0.$testno.pbc"; 80 my $stdoutfn = "$0.$testno.stdout"; 81 my $f = IO::File->new(">$codefn"); 82 $f->print($file); 83 $f->close(); 84 system("$parrot -o $pbcfn $codefn 2>&1"); 85 system("$path $pbcfn >$stdoutfn 2>&1"); 86 $f = IO::File->new($stdoutfn); 87 88 my $output = join( '', <$f> ); 89 90 local $Test::Builder::Level = $Test::Builder::Level + 1; 91 unlink ($codefn, $pbcfn, $stdoutfn); 92 if (ref $check eq 'ARRAY') { 93 for my $chk (@$check) { 94 like( $output, $chk, $diag ); 95 $testno++; 96 } 97 } else { 98 like( $output, $check, $diag ); 99 } 100 } 101 102 =head1 TODO 103 104 =over 4 105 106 =item 107 108 Flesh it out. This is a bare bones proof of concept. 109 Add tests for all of the commands. 110 111 =back 112 113 =cut 114 115 # Local Variables: 116 # mode: cperl 117 # cperl-indent-level: 4 118 # fill-column: 100 119 # End: 120 # vim: expandtab shiftwidth=4: -
t/tools/pbc_info.t
Property changes on: t/tools/pbc_disassemble.t ___________________________________________________________________ Added: svn:executable + *
1 #! perl 2 # Copyright (C) 2007-2008, The Perl Foundation. 3 # $Id: pbc_info.t 34223 2008-12-22 03:24:34Z petdance $ 4 5 =head1 NAME 6 7 t/tools/pbc_info.t - test the Parrot Dumper 8 9 =head1 SYNOPSIS 10 11 % prove t/tools/pbc_info.t 12 13 =head1 DESCRIPTION 14 15 Tests the C<pbc_info> tool by providing it with a number of source 16 files, and running through it with various commands. 17 18 We never actually check the I<full> output of pbc_info. We simply check 19 several smaller components to avoid a test file that is far too unwieldy. 20 21 22 =head1 REQUIREMENTS 23 24 This test script requires you to build pbc_info, by typing 25 "make parrot_utils" (using a suitable make tool for your platform). 26 If this requirement has not been met, all tests will be skipped. 27 28 =cut 29 30 use strict; 31 use warnings; 32 use lib qw(lib); 33 34 use Test::More; 35 use IO::File (); 36 use Parrot::Config; 37 use File::Spec; 38 39 my $path; 40 my $parrot = File::Spec->catfile( ".", $PConfig{test_prog} ); 41 42 BEGIN { 43 $path = File::Spec->catfile( ".", "pbc_info" ); 44 my $exefile = $path . $PConfig{exe}; 45 unless ( -f $exefile ) { 46 plan skip_all => "pbc_info hasn't been built. Run make parrot_utils"; 47 exit(0); 48 } 49 plan tests => 4; 50 } 51 52 output_like( <<PIR, "pir", [qr/FIXUP_t/, qr/PIC_idx/, qr/CONSTANT_t/, qr/BYTECODE_t/], 'pbc_info'); 53 .sub main :main 54 \$N3 = 3.14159 55 print \$N3 56 print "\\n" 57 .end 58 PIR 59 60 =head1 HELPER SUBROUTINES 61 62 =head2 output_like 63 64 output_like(<<PASM, "pasm", "some output", "running $file"); 65 66 Takes 3-4 arguments: a file to run, 67 the filename-extension of the file (probably "pir" or "pasm"), 68 an arrayref or single regex string to match within pbc_info's output, 69 and the optional test diagnostic. 70 71 =cut 72 73 my $testno = 0; 74 75 sub output_like { 76 my ( $file, $ext, $check, $diag ) = @_; 77 $testno++; 78 my $codefn = "$0.$testno.$ext"; 79 my $pbcfn = "$0.$testno.pbc"; 80 my $stdoutfn = "$0.$testno.stdout"; 81 my $f = IO::File->new(">$codefn"); 82 $f->print($file); 83 $f->close(); 84 system("$parrot -o $pbcfn $codefn 2>&1"); 85 system("$path $pbcfn >$stdoutfn 2>&1"); 86 $f = IO::File->new($stdoutfn); 87 88 my $output = join( '', <$f> ); 89 90 local $Test::Builder::Level = $Test::Builder::Level + 1; 91 unlink ($codefn, $pbcfn, $stdoutfn); 92 if (ref $check eq 'ARRAY') { 93 for my $chk (@$check) { 94 like( $output, $chk, $diag ); 95 $testno++; 96 } 97 } else { 98 like( $output, $check, $diag ); 99 } 100 } 101 102 =head1 TODO 103 104 =over 4 105 106 =item 107 108 Flesh it out. This is a bare bones proof of concept. 109 Add tests for all of the commands. 110 111 =back 112 113 =cut 114 115 # Local Variables: 116 # mode: cperl 117 # cperl-indent-level: 4 118 # fill-column: 100 119 # End: 120 # vim: expandtab shiftwidth=4: -
t/tools/pdump.t
Property changes on: t/tools/pbc_info.t ___________________________________________________________________ Added: svn:executable + *
1 #! perl 2 # Copyright (C) 2007-2008, The Perl Foundation. 3 # $Id: pdump.t 34223 2008-12-22 03:24:34Z petdance $ 4 5 =head1 NAME 6 7 t/tools/pdump.t - test the Parrot Dumper 8 9 =head1 SYNOPSIS 10 11 % prove t/tools/pdump.t 12 13 =head1 DESCRIPTION 14 15 Tests the C<pdump> tool by providing it with a number of source 16 files, and running through it with various commands. 17 18 We never actually check the I<full> output of pdump. We simply check 19 several smaller components to avoid a test file that is far too unwieldy. 20 21 22 =head1 REQUIREMENTS 23 24 This test script requires you to build pdump, by typing 25 "make parrot_utils" (using a suitable make tool for your platform). 26 If this requirement has not been met, all tests will be skipped. 27 28 =cut 29 30 use strict; 31 use warnings; 32 use lib qw(lib); 33 34 use Test::More; 35 use IO::File (); 36 use Parrot::Config; 37 use File::Spec; 38 39 my $path; 40 my $parrot = File::Spec->catfile( ".", $PConfig{test_prog} ); 41 42 BEGIN { 43 $path = File::Spec->catfile( ".", "pdump" ); 44 my $exefile = $path . $PConfig{exe}; 45 unless ( -f $exefile ) { 46 plan skip_all => "pdump hasn't been built. Run make parrot_utils"; 47 exit(0); 48 } 49 plan tests => 2; 50 } 51 52 output_like( <<PIR, "pir", [qr/'PFC_STRING'/, qr/PFC_PMC/], ''); 53 .sub main :main 54 \$N3 = 3.14159 55 print \$N3 56 print "\\n" 57 .end 58 PIR 59 60 =head1 HELPER SUBROUTINES 61 62 =head2 output_like 63 64 output_like(<<PASM, "pasm", "some output", "running $file"); 65 66 Takes 3-4 arguments: a file to run, 67 the filename-extension of the file (probably "pir" or "pasm"), 68 an arrayref or single regex string to match within pdump's output, 69 and the optional test diagnostic. 70 71 =cut 72 73 my $testno = 0; 74 75 sub output_like { 76 my ( $file, $ext, $check, $diag ) = @_; 77 $testno++; 78 my $codefn = "$0.$testno.$ext"; 79 my $pbcfn = "$0.$testno.pbc"; 80 my $stdoutfn = "$0.$testno.stdout"; 81 my $f = IO::File->new(">$codefn"); 82 $f->print($file); 83 $f->close(); 84 system("$parrot -o $pbcfn $codefn 2>&1"); 85 system("$path $pbcfn >$stdoutfn 2>&1"); 86 $f = IO::File->new($stdoutfn); 87 88 my $output = join( '', <$f> ); 89 90 local $Test::Builder::Level = $Test::Builder::Level + 1; 91 unlink ($codefn, $pbcfn, $stdoutfn); 92 if (ref $check eq 'ARRAY') { 93 for my $chk (@$check) { 94 like( $output, $chk, $diag ); 95 $testno++; 96 } 97 } else { 98 like( $output, $check, $diag ); 99 } 100 } 101 102 =head1 TODO 103 104 =over 4 105 106 =item 107 108 Flesh it out. This is a bare bones proof of concept. 109 Add tests for all of the commands. 110 111 =back 112 113 =cut 114 115 # Local Variables: 116 # mode: cperl 117 # cperl-indent-level: 4 118 # fill-column: 100 119 # End: 120 # vim: expandtab shiftwidth=4: