Times are:
make quicktest, after caching output: 23 seconds
make test: 175 seconds
make quicktest could screw up if:
- you ctrl-c it, or make test (although I haven't had problems with that
yet) during the compilation process at just the right time
- you do anything to invalidate existing .pbc files, such as rearranging
ops. not sure what else could trigger this.
I still find it extremely useful, in spite of these limitations on its
usage. The patch is included below.
Mike Lambert
Index: Makefile.in
===================================================================
RCS file: /cvs/public/parrot/Makefile.in,v
retrieving revision 1.140
diff -u -r1.140 Makefile.in
--- Makefile.in 16 Mar 2002 14:38:25 -0000 1.140
+++ Makefile.in 21 Mar 2002 22:48:56 -0000
@@ -403,6 +403,11 @@
.test_dummy_j:
$(PERL) t/harness -j
+quicktest: $(TEST_PROG) assemble.pl .quicktest_dummy
+
+.quicktest_dummy:
+ $(PERL) t/harness quick
+
mopstest: $(TEST_PROG) examples/assembly/mops.pbc
$(TEST_PROG) examples/assembly/mops.pbc
Index: lib/Parrot/Test.pm
===================================================================
RCS file: /cvs/public/parrot/lib/Parrot/Test.pm,v
retrieving revision 1.18
diff -u -r1.18 Test.pm
--- lib/Parrot/Test.pm 4 Mar 2002 02:32:54 -0000 1.18
+++ lib/Parrot/Test.pm 21 Mar 2002 22:49:01 -0000
@@ -64,12 +64,27 @@
my $t = $0; $t =~ s/\.t$/$count\.$_/; $t
} ( qw(pasm pbc out) );
- open ASSEMBLY, "> $as_f" or die "Unable to open '$as_f'";
- binmode ASSEMBLY;
- print ASSEMBLY $assembly;
- close ASSEMBLY;
+ my $can_skip_compile = $ENV{PARROT_QUICKTEST};
+ if ($can_skip_compile)
+ {
+ open INASSEMBLY, "$as_f" or $can_skip_compile = 0;
+ if ($can_skip_compile) {
+ local $/ = undef;
+ my $inassembly = <INASSEMBLY>;
+ close INASSEMBLY;
+ $can_skip_compile = 0 if ($assembly ne $inassembly);
+ $can_skip_compile = 0 if (not -e $by_f);
+ }
+ }
- _run_command( "$PConfig{perl} assemble.pl $as_f --output $by_f" );
+ if (!$can_skip_compile) {
+ open ASSEMBLY, "> $as_f" or die "Unable to open '$as_f'";
+ binmode ASSEMBLY;
+ print ASSEMBLY $assembly;
+ close ASSEMBLY;
+
+ _run_command( "$PConfig{perl} assemble.pl $as_f --output $by_f" );
+ }
$TEST_PROG_ARGS = "" unless defined $TEST_PROG_ARGS;
_run_command( "./$PConfig{test_prog} ${TEST_PROG_ARGS} $by_f", 'STDOUT' =>
$out_f, 'STDERR' => $out_f);
@@ -86,9 +101,7 @@
my $pass = $Builder->$meth( $prog_output, $output, $desc );
unless($ENV{POSTMORTEM}) {
- foreach my $i ( $as_f, $by_f, $out_f ) {
- unlink $i;
- }
+ unlink $out_f;
}
return $pass;
Index: t/harness
===================================================================
RCS file: /cvs/public/parrot/t/harness,v
retrieving revision 1.9
diff -u -r1.9 harness
--- t/harness 31 Jan 2002 19:03:34 -0000 1.9
+++ t/harness 21 Mar 2002 22:49:01 -0000
@@ -14,6 +14,9 @@
getopts('jP', \%opts);
$ENV{TEST_PROG_ARGS} = join(' ', map { "-$_" } keys %opts );
+$ENV{PARROT_QUICKTEST} = grep $_ eq 'quick', @ARGV;
+@ARGV = grep $_ ne 'quick', @ARGV;
+
# Pass in a list of tests to run on the command line, else run all the tests.
my @tests = @ARGV ? @ARGV : map { glob( "t/$_/*.t" ) } ( qw(op pmc) );
runtests(@tests);