Author: jkeenan
Date: Mon Apr 30 16:42:42 2007
New Revision: 18362
Added:
branches/reconfigure/t/configure/17-revision.t (contents, props changed)
branches/reconfigure/t/configure/18-revision_no_DEVELOPING.t (contents,
props changed)
branches/reconfigure/t/postconfigure/02-revision.t (contents, props
changed)
branches/reconfigure/t/postconfigure/03-revision_no_DEVELOPING.t
(contents, props changed)
Modified:
branches/reconfigure/lib/Parrot/Pmc2c/Utils.pm
branches/reconfigure/lib/Parrot/Revision.pm
branches/reconfigure/tools/build/pmc2c.pl
Log:
1. Eliminate unused code from lib/Parrot/Revision.pm.
2. Add 4 test files for Parrot::Revision. 2 of these are run
pre-Configure.pl; 2 are run post-Configure.pl.
3. Eliminate 'no-body' option from tools/build/pmc2c.pl and corresponding
'nobody' code from lib/Parrot/Pmc2c/Utils.pm.
Modified: branches/reconfigure/lib/Parrot/Pmc2c/Utils.pm
==============================================================================
--- branches/reconfigure/lib/Parrot/Pmc2c/Utils.pm (original)
+++ branches/reconfigure/lib/Parrot/Pmc2c/Utils.pm Mon Apr 30 16:42:42 2007
@@ -80,7 +80,7 @@
unshift @{ $allargsref->{include} },
( ".", "$FindBin::Bin/../..", "$FindBin::Bin/../../src/pmc/" );
- foreach my $opt qw(nobody nolines debug verbose) {
+ foreach my $opt qw(nolines debug verbose) {
if ( !defined $allargsref->{opt}{$opt} ) {
$allargsref->{opt}{$opt} = 0;
}
@@ -669,7 +669,6 @@
my ( $flag, $type, $methodname, $parameters ) = ( $2, $3, $4, $5 );
my $attrs = parse_method_attrs($6);
my ( $methodblock, $remainder_part ) = extract_balanced($classblock);
- $methodblock = "" if $opt->{nobody};
my $method_hash = {
meth => $methodname,
Modified: branches/reconfigure/lib/Parrot/Revision.pm
==============================================================================
--- branches/reconfigure/lib/Parrot/Revision.pm (original)
+++ branches/reconfigure/lib/Parrot/Revision.pm Mon Apr 30 16:42:42 2007
@@ -28,7 +28,6 @@
sub __get_revision {
return 0 unless ( -e 'DEVELOPING' );
- my $ent = ".svn/entries";
my $revision;
@@ -40,14 +39,14 @@
}
}
elsif ( defined $svn_entries and -r $svn_entries ) {
- open FH, '<', $svn_entries
+ open my $FH, '<', $svn_entries
or die "Unable to open file ($svn_entries). Aborting. Error
returned was: $!";
- while (<FH>) {
+ while (<$FH>) {
/^ *committed-rev=.(\d+)./ or next;
$revision = $1;
last;
}
- close FH;
+ close $FH;
}
elsif ( my @svk_info = qx/svk info 2>$nul/ and $? == 0 ) {
if ( my ($line) = grep /(?:file|svn|https?)\b/, @svk_info ) {
@@ -58,7 +57,7 @@
# convert /svk/trunk to //svk/trunk or /depot/svk/trunk
my ($depot_root) = map { m{Depot Path: (/[^/]*)} } @svk_info;
- $depot_root ||= '/';
+ $depot_root ||= q{/};
$source_depot = $depot_root . $source_depot;
if ( my @svk_info = qx/svk info $source_depot/ and $? == 0 ) {
if ( my ($line) = grep /(?:file|svn|https?)\b/, @svk_info
) {
Added: branches/reconfigure/t/configure/17-revision.t
==============================================================================
--- (empty file)
+++ branches/reconfigure/t/configure/17-revision.t Mon Apr 30 16:42:42 2007
@@ -0,0 +1,68 @@
+#! perl
+# Copyright (C) 2007, The Perl Foundation.
+# $Id$
+# 17-revision.t
+
+use strict;
+use warnings;
+
+use Test::More tests => 7;
+use Carp;
+use_ok( 'Cwd' );
+use_ok( 'File::Copy' );
+use_ok( 'File::Temp', qw| tempdir | );
+use lib qw( . lib ../lib ../../lib );
+use Parrot::Revision;
+
+my ($current, $config);
+
+# Case 1: DEVELOPING exists; Parrot::Config not yet available.
+my $reason =
+ 'Either file DEVELOPING does not exist or configuration has completed (as
evidenced by existence of Parrot::Config::Generated';
+SKIP: {
+ skip $reason, 3 if (
+ (not -e 'DEVELOPING')
+ or
+ ( -e q{lib/Parrot/Config/Generated.pm} )
+ );
+ $current = $Parrot::Revision::current;
+ like($current, qr/^\d+$/, "current revision is all numeric");
+ $config = $Parrot::Revision::config;
+ like($config, qr/^\d+$/, "current revision is all numeric");
+ is($current, $config, "current and config are identical");
+} # end SKIP block
+
+pass("Completed all tests in $0");
+
+################### DOCUMENTATION ###################
+
+=head1 NAME
+
+17-revision.t - test Parrot::Revision
+
+=head1 SYNOPSIS
+
+ % prove t/configure/17-revision.t
+
+=head1 DESCRIPTION
+
+The files in this directory test functionality used by F<Configure.pl>.
+
+The tests in this file test Parrot::Revision (F<lib/Parrot/Revision.pm>).
+
+=head1 AUTHOR
+
+James E Keenan
+
+=head1 SEE ALSO
+
+Parrot::Configure, F<Configure.pl>.
+
+=cut
+
+# Local Variables:
+# mode: cperl
+# cperl-indent-level: 4
+# fill-column: 100
+# End:
+# vim: expandtab shiftwidth=4:
Added: branches/reconfigure/t/configure/18-revision_no_DEVELOPING.t
==============================================================================
--- (empty file)
+++ branches/reconfigure/t/configure/18-revision_no_DEVELOPING.t Mon Apr
30 16:42:42 2007
@@ -0,0 +1,76 @@
+#! perl
+# Copyright (C) 2007, The Perl Foundation.
+# $Id$
+# 18-revision_no_DEVELOPING.t
+
+use strict;
+use warnings;
+
+use Test::More tests => 10;
+use Carp;
+use_ok( 'Cwd' );
+use_ok( 'File::Copy' );
+use_ok( 'File::Temp', qw| tempdir | );
+use lib qw( . lib ../lib ../../lib );
+
+my ($current, $config);
+
+# Case 2: DEVELOPING's non-existence is faked; Parrot::Config not yet
available. #'
+my $cwd = cwd();
+my $reason =
+ 'Either file DEVELOPING does not exist or configuration has completed (as
evidenced by existence of Parrot::Config::Generated';
+
+SKIP: {
+ skip $reason, 6 if (
+ (not -e 'DEVELOPING')
+ or
+ ( -e q{lib/Parrot/Config/Generated.pm} )
+ );
+ ok(move('DEVELOPING', 'xDEVELOPING'), "temporarily renaming DEVELOPING");
+ require Parrot::Revision;
+ no warnings qw(once);
+ $current = $Parrot::Revision::current;
+ like($current, qr/^\d+$/, "current revision is all numeric");
+ $config = $Parrot::Revision::config;
+ use warnings;
+ like($config, qr/^\d+$/, "current revision is all numeric");
+ is($current, $config, "current and config are identical");
+ is($current, 0, 'current is zero as expected');
+ ok(move('xDEVELOPING', 'DEVELOPING'), "restoring DEVELOPING");
+}
+
+# Case 3: DEVELOPING exists; Parrot::Config available.
+pass("Completed all tests in $0");
+
+################### DOCUMENTATION ###################
+
+=head1 NAME
+
+18-revision_no_DEVELOPING.t - test Parrot::Revision
+
+=head1 SYNOPSIS
+
+ % prove t/configure/18-revision_no_DEVELOPING.t
+
+=head1 DESCRIPTION
+
+The files in this directory test functionality used by F<Configure.pl>.
+
+The tests in this file test Parrot::Revision (F<lib/Parrot/Revision.pm>).
+
+=head1 AUTHOR
+
+James E Keenan
+
+=head1 SEE ALSO
+
+Parrot::Configure, F<Configure.pl>.
+
+=cut
+
+# Local Variables:
+# mode: cperl
+# cperl-indent-level: 4
+# fill-column: 100
+# End:
+# vim: expandtab shiftwidth=4:
Added: branches/reconfigure/t/postconfigure/02-revision.t
==============================================================================
--- (empty file)
+++ branches/reconfigure/t/postconfigure/02-revision.t Mon Apr 30 16:42:42 2007
@@ -0,0 +1,70 @@
+#! perl
+# Copyright (C) 2007, The Perl Foundation.
+# $Id$
+# 02-revision.t
+
+use strict;
+use warnings;
+
+use Test::More tests => 7;
+use Carp;
+use_ok( 'Cwd' );
+use_ok( 'File::Copy' );
+use_ok( 'File::Temp', qw| tempdir | );
+use lib qw( . lib ../lib ../../lib );
+use Parrot::Revision;
+
+my ($current, $config);
+
+# Case 1: DEVELOPING exists; Parrot::Config available.
+my $reason =
+ 'Either file DEVELOPING does not exist or configuration has not completed
(as evidenced by non-existence of Parrot::Config::Generated';
+SKIP: {
+ skip $reason, 3 if (
+ (not -e 'DEVELOPING')
+ or
+ (not -e q{lib/Parrot/Config/Generated.pm} )
+ );
+ $current = $Parrot::Revision::current;
+ like($current, qr/^\d+$/, "current revision is all numeric");
+ $config = $Parrot::Revision::config;
+ like($config, qr/^\d+$/, "current revision is all numeric");
+ is($current, $config, "current and config are identical");
+} # end SKIP block
+
+pass("Completed all tests in $0");
+
+################### DOCUMENTATION ###################
+
+=head1 NAME
+
+02-revision.t - test Parrot::Revision
+
+=head1 SYNOPSIS
+
+ % prove t/postconfigure/02-revision.t
+
+=head1 DESCRIPTION
+
+The files in this directory test functionality used by F<Configure.pl>.
+
+The tests in this file test aspects of Parrot::Revision
+(F<lib/Parrot/Revision.pm>) which presume that configuration has been
+completed.
+
+=head1 AUTHOR
+
+James E Keenan
+
+=head1 SEE ALSO
+
+Parrot::Configure, F<Configure.pl>.
+
+=cut
+
+# Local Variables:
+# mode: cperl
+# cperl-indent-level: 4
+# fill-column: 100
+# End:
+# vim: expandtab shiftwidth=4:
Added: branches/reconfigure/t/postconfigure/03-revision_no_DEVELOPING.t
==============================================================================
--- (empty file)
+++ branches/reconfigure/t/postconfigure/03-revision_no_DEVELOPING.t Mon Apr
30 16:42:42 2007
@@ -0,0 +1,76 @@
+#! perl
+# Copyright (C) 2007, The Perl Foundation.
+# $Id$
+# 03-revision_no_DEVELOPING.t
+
+use strict;
+use warnings;
+
+use Test::More tests => 10;
+use Carp;
+use_ok( 'Cwd' );
+use_ok( 'File::Copy' );
+use_ok( 'File::Temp', qw| tempdir | );
+use lib qw( . lib ../lib ../../lib );
+
+my ($current, $config);
+
+# Case 2: DEVELOPING's non-existence is faked; Parrot::Config available. #'
+my $cwd = cwd();
+my $reason =
+ 'Either file DEVELOPING does not exist or configuration has not completed
(as evidenced by non-existence of Parrot::Config::Generated';
+
+SKIP: {
+ skip $reason, 6 if (
+ (not -e 'DEVELOPING')
+ or
+ (not -e q{lib/Parrot/Config/Generated.pm} )
+ );
+ ok(move('DEVELOPING', 'xDEVELOPING'), "temporarily renaming DEVELOPING");
+ require Parrot::Revision;
+ no warnings qw(once);
+ $current = $Parrot::Revision::current;
+ like($current, qr/^\d+$/, "current revision is all numeric");
+ is($current, 0,
+ "If DEVELOPING does not exist (release version), \$current is set to
zero.");
+ $config = $Parrot::Revision::config;
+ use warnings;
+ like($config, qr/^\d+$/, "current revision is all numeric");
+ isnt($current, $config, "current and config differ");
+ ok(move('xDEVELOPING', 'DEVELOPING'), "restoring DEVELOPING");
+}
+
+pass("Completed all tests in $0");
+
+################### DOCUMENTATION ###################
+
+=head1 NAME
+
+03-revision_no_DEVELOPING.t - test Parrot::Revision
+
+=head1 SYNOPSIS
+
+ % prove t/postconfigure/03-revision_no_DEVELOPING.t
+
+=head1 DESCRIPTION
+
+The files in this directory test functionality used by F<Configure.pl>.
+
+The tests in this file test Parrot::Revision (F<lib/Parrot/Revision.pm>).
+
+=head1 AUTHOR
+
+James E Keenan
+
+=head1 SEE ALSO
+
+Parrot::Configure, F<Configure.pl>.
+
+=cut
+
+# Local Variables:
+# mode: cperl
+# cperl-indent-level: 4
+# fill-column: 100
+# End:
+# vim: expandtab shiftwidth=4:
Modified: branches/reconfigure/tools/build/pmc2c.pl
==============================================================================
--- branches/reconfigure/tools/build/pmc2c.pl (original)
+++ branches/reconfigure/tools/build/pmc2c.pl Mon Apr 30 16:42:42 2007
@@ -20,7 +20,6 @@
"dump" => \$action{dump},
"c|gen-c" => \$action{gen_c},
"tree" => \$action{tree},
- "no-body" => \$opt{nobody},
"no-lines" => \$opt{nolines},
"debug+" => \$opt{debug},
"verbose+" => \$opt{verbose},
@@ -115,9 +114,6 @@
Omit source line info
-=item C<--no-body>
-
-Emit an empty body in the dump. This may be useful for debugging.
=item C<--include=/path/to/pmc>
@@ -331,11 +327,9 @@
=cut
-__END__
# Local Variables:
# mode: cperl
# cperl-indent-level: 4
# fill-column: 100
# End:
# vim: expandtab shiftwidth=4:
-# %opt = map { $_ => 0 } qw(nobody nolines debug verbose);