[Codestriker-commits] CVS update: codestriker/test runtests.conf runtests.pl
Brought to you by:
sits
From: <si...@us...> - 2005-07-01 02:07:02
|
Created Codestriker topic at: http://codestriker.sourceforge.net/cgi-bin/codestriker.pl?topic=35710&action=view User: sits Date: 05/06/30 19:06:40 Modified: lib Codestriker.pm lib/Codestriker/Http Render.pm test runtests.conf runtests.pl Log: From Jason: Fix for the broken table tag, and added code to the test cases to verify that the correct modules are installed. Should be quick to get the test cases setup and running on a new system now. Index: Codestriker.pm =================================================================== RCS file: /cvsroot/codestriker/codestriker/lib/Codestriker.pm,v retrieving revision 1.76 retrieving revision 1.77 diff -u -r1.76 -r1.77 --- Codestriker.pm 9 Jun 2005 07:22:04 -0000 1.76 +++ Codestriker.pm 1 Jul 2005 02:06:20 -0000 1.77 @@ -27,7 +27,7 @@ ); # Version of Codestriker. -$Codestriker::VERSION = "1.9.0.beta2"; +$Codestriker::VERSION = "1.9.0.beta3"; # Default title to display on each Codestriker screen. $Codestriker::title = "Codestriker $Codestriker::VERSION"; Index: Render.pm =================================================================== RCS file: /cvsroot/codestriker/codestriker/lib/Codestriker/Http/Render.pm,v retrieving revision 1.51 retrieving revision 1.52 diff -u -r1.51 -r1.52 --- Render.pm 2 Jun 2005 11:31:00 -0000 1.51 +++ Render.pm 1 Jul 2005 02:06:22 -0000 1.52 @@ -976,6 +976,8 @@ "general_comment", undef); print " to topic."; print $query->p; + + print $query->start_table() ; } # Render the initial start of the coloured table, with an empty row setting Index: runtests.conf =================================================================== RCS file: /cvsroot/codestriker/codestriker/test/runtests.conf,v retrieving revision 1.3 retrieving revision 1.4 diff -u -r1.3 -r1.4 --- runtests.conf 21 Dec 2004 22:44:26 -0000 1.3 +++ runtests.conf 1 Jul 2005 02:06:39 -0000 1.4 @@ -1,11 +1,11 @@ # the full url to the codestriker.pl that you are testing. -$main_url = "http://localhost/codestriker/latest/codestriker/codestriker.pl"; +$main_url = "http://localhost/codestriker/codestriker.pl"; @email_adddress = ( 'jpr@clover','jpr2@clover','jpr3@clover' ); -$version = "1.8.5"; +$version = "1.9.0.beta2"; $check_help_links = 0; Index: runtests.pl =================================================================== RCS file: /cvsroot/codestriker/codestriker/test/runtests.pl,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- runtests.pl 8 Sep 2004 03:48:57 -0000 1.2 +++ runtests.pl 1 Jul 2005 02:06:39 -0000 1.3 @@ -8,6 +8,8 @@ my @test_files = <*.t>; +verify_installed_modules(); + # make sure that cleanuptesttopics.t runs last @test_files = sort { @@ -21,3 +23,98 @@ runtests(@test_files); exit(0); + + +sub verify_installed_modules +{ + # Indicate which modules are required for codestriker (this code is + # completely stolen more-or-less verbatim from Bugzilla) + my $modules = [ + { name => 'Test', version => '1.25' }, + { name => 'Test::Harness', version => '2.46' }, + { name => 'Test::More', version => '0.47' }, + { name => 'LWP::UserAgent', version => '2.024' }, + { name => 'Getopt::Long', version => '2.25' }, + { name => 'File::Copy', version => '2.03' }, + { name => 'Date::Calc', version => '5.3' }, + { name => 'HTML::TokeParser', version => '2.30' }, + { name => 'HTML::Form', version => '1.049' }, + { name => 'HTML::LinkExtractor', version => '0.13' }, + { name => 'HTML::Lint', version => '1.28' }, + { name => 'Compress::Zlib', version => '1.33' } + ]; + + my $problem = 0; + foreach my $module (@{$modules}) { + if ( have_vers($module->{name}, $module->{version}) == 0) { + $problem = 1; + } + } + + if ( $problem ) { + die "tests stopped, Missing modules\n"; + } + +} + +# This was originally clipped from the libnet Makefile.PL, adapted here to +# use the above vers_cmp routine for accurate version checking. +sub have_vers { + my ($pkg, $wanted) = @_; + my ($msg, $vnum, $vstr); + no strict 'refs'; + + eval { my $p; ($p = $pkg . ".pm") =~ s!::!/!g; require $p; }; + + $vnum = ${"${pkg}::VERSION"} || ${"${pkg}::Version"} || 0; + $vnum = -1 if $@; + + if ($vnum eq "-1") { # string compare just in case it's non-numeric + $vstr = "it is not installed"; + } + elsif (vers_cmp($vnum,"0") > -1) { + $vstr = "version v$vnum is installed"; + } + else { + $vstr = "unknown"; + } + + my $vok = (vers_cmp($vnum,$wanted) > -1); + + if (!$vok) { + printf("Module %15s needs v%s, however %s.\n",$pkg,$wanted,$vstr); + } + + return $vok; +} + + +# vers_cmp is adapted from Sort::Versions 1.3 1996/07/11 13:37:00 kjahds, +# which is not included with Perl by default, hence the need to copy it here. +# Seems silly to require it when this is the only place we need it... +sub vers_cmp { + if (@_ < 2) { die "not enough parameters for vers_cmp" } + if (@_ > 2) { die "too many parameters for vers_cmp" } + my ($a, $b) = @_; + my (@A) = ($a =~ /(\.|\d+|[^\.\d]+)/g); + my (@B) = ($b =~ /(\.|\d+|[^\.\d]+)/g); + my ($A,$B); + while (@A and @B) { + $A = shift @A; + $B = shift @B; + if ($A eq "." and $B eq ".") { + next; + } elsif ( $A eq "." ) { + return -1; + } elsif ( $B eq "." ) { + return 1; + } elsif ($A =~ /^\d+$/ and $B =~ /^\d+$/) { + return $A <=> $B if $A <=> $B; + } else { + $A = uc $A; + $B = uc $B; + return $A cmp $B if $A cmp $B; + } + } + @A <=> @B; +} |