2 # Copyright (C) 2006-2007, Parrot Foundation.
8 use Test::More tests => 10;
10 use lib ( "$FindBin::Bin/../..", "$FindBin::Bin/../../lib", "$FindBin::Bin/../../../lib", );
11 use_ok('Parrot::Pmc2c::Pmc2cMain');
13 ok( -f "$FindBin::Bin/../../../Makefile", "Makefile located" );
14 ok( -f "$FindBin::Bin/../../../myconfig", "myconfig located" );
15 ok( -f "$FindBin::Bin/../../../lib/Parrot/PMC.pm", "lib/Parrot/PMC.pm located" );
18 @files = glob("$FindBin::Bin/../../../src/pmc/*");
20 if ( $f =~ m/.*\.(.*)$/ ) {
26 # In src/pmc, we should have only .pmc files (81+ of them), 1 .num file,
27 # and >= .h files none of whose names may begin 'pmc_' (lest they be left over
28 # from a previous build).
29 my $suffixqty = scalar( keys %sfx );
30 ok( ( ( 2 <= $suffixqty ) and ( $suffixqty <= 3 ) ), "only 2 or 3 file suffixes in src/pmc" );
32 ok( $sfx{'num'}, ".num suffix correctly located" );
33 ok( $sfx{'pmc'}, ".pmc suffix correctly located" );
35 my $pmc_leftovers = 0;
36 foreach my $f (@files) {
37 $pmc_leftovers++ if $f =~ m/^pmc_.*\.h$/;
39 is( $pmc_leftovers, 0, "No left-over 'pmc_*.h' files in src/pmc/" );
42 pass("No .h files in src/pmc/");
45 my $message = <<END_OF_MESSAGE;
48 The files in this directory test the publicly callable methods of
49 Parrot::Pmc2c::Pmc2cMain. By doing so, they test the functionality
50 of the pmc2c.pl utility.
52 Since pmc2c.pl is invoked many times during 'make', tests of its
53 functionality can give meaningful results only if you run them
54 when your file system under the top-level Parrot directory is in
55 a 'pre-make' state, i.e., you have run 'perl Configure.pl' but
56 have *not* yet run 'make'. These tests should pass if run at
57 that point in the build process, but some will necessarily fail
58 if 'make' has already been executed. Hence, they should not be
59 included in the set of tests run by 'make test'.
61 In short, these are tests of Parrot::Pmc2c::Pmc2cMain but are *not*
62 tests of Parrot itself.
66 pass("Completed all tests in $0");
68 ################### DOCUMENTATION ###################
72 00-qualify.t - Is this the right point to test Parrot build tools?
76 % prove t/tools/pmc2cutils/00-qualify.t
80 The files in this directory test the publicly callable methods of
81 F<lib/Parrot/Pmc2c/Pmc2cMain.pm>. By doing so, they test the functionality
82 of the F<pmc2c.pl> utility. That functionality has largely been extracted
83 into the methods of F<Pmc2cMain.pm>.
85 Since F<pmc2c.pl> is invoked during C<make>, tests of its functionality can
86 give meaningful results only if they take into consideration the status of the
87 file structure at particular points in the build process:
93 after F<Configure.pl> has run but before F<make> has run;
97 at various points while F<make> is running; or
101 once F<make> has completed.
105 The tests in F<00-qualify.t> attempt to confirm that you are at the first of
106 these three stages. It tests for the presence or absence of certain files to
107 form a judgment as to whether F<Configure.pl> has been run (it should have
108 been) and whether F<make> has been run (it should I<not> have been). The
109 tests make certain assumptions about what files should be present or not --
110 assumptions which may be invalid if the Parrot build process changes in the
119 Parrot::Pmc2c, F<pmc2c.pl>.
125 # cperl-indent-level: 4
128 # vim: expandtab shiftwidth=4: