2 # Copyright (C) 2009, Parrot Foundation.
7 t/tools/pbc_dump.t - test the Parrot Bytecode (PBC) Dumper
11 % prove t/tools/pbc_dump.t
15 Tests the C<pbc_dump> tool by providing it with a number of source
16 files, and running through it with various commands.
18 We never actually check the I<full> output of pbc_dump. We simply check
19 several smaller components to avoid a test file that is far too unwieldy.
24 This test script requires you to build pbc_dump, 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.
43 $path = File::Spec->catfile( ".", "pbc_dump" );
44 my $exefile = $path . $PConfig{exe};
45 unless ( -f $exefile ) {
46 plan skip_all => "pbc_dump hasn't been built. Run make parrot_utils";
52 dump_output_like( <<PIR, "pir", [qr/FIXUP_t/, qr/CONSTANT_t/, qr/BYTECODE_t/], 'pbc_dump basic sanity');
58 dump_output_like( <<PIR, "pir", qr/HEADER\s*=>\s*\[.*wordsize.*byteorder.*floattype.*parrot-version.*bytecode-version.*UUID.*\]/ms, 'pbc_dump HEADER sanity');
64 dump_output_like( <<PIR, "pir", qr/DIRECTORY\s*=>\s*\[.*offs.*op_count.*itype.*id.*size.*segments/ms, 'pbc_dump DIRECTORY sanity');
70 dump_output_like( <<PIR, "pir", qr/BYTECODE_t.*=>.*\[.*offs.*op_count.*itype.*id.*size.*mappings/ms, 'pbc_dump BYTECODE sanity');
76 =head1 HELPER SUBROUTINES
78 =head2 dump_output_like
80 dump_output_like(<<PASM, "pasm", "some output", "running $file");
82 Takes 3-4 arguments: a file to run,
83 the filename-extension of the file (probably "pir" or "pasm"),
84 an arrayref or single regex string to match within pbc_dump's output,
85 and the optional test diagnostic.
89 sub dump_output_like {
90 pbc_postprocess_output_like($path, @_ );
95 # cperl-indent-level: 4
98 # vim: expandtab shiftwidth=4: