httpd-test-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ge...@apache.org
Subject cvs commit: httpd-test/perl-framework/Apache-Test/lib/Apache Test.pm TestConfigC.pm TestSSLCA.pm
Date Thu, 08 Jan 2004 17:15:37 GMT
geoff       2004/01/08 09:15:37

  Modified:    perl-framework/Apache-Test/lib/Apache Test.pm TestConfigC.pm
                        TestSSLCA.pm
  Log:
  fix have_apache_version(), have_min_apache_version(), and
  have_min_module_version() to use proper numeric version strings
  in comparisons.
  
  Revision  Changes    Path
  1.73      +13 -4     httpd-test/perl-framework/Apache-Test/lib/Apache/Test.pm
  
  Index: Test.pm
  ===================================================================
  RCS file: /home/cvs/httpd-test/perl-framework/Apache-Test/lib/Apache/Test.pm,v
  retrieving revision 1.72
  retrieving revision 1.73
  diff -u -r1.72 -r1.73
  --- Test.pm	22 Dec 2003 19:51:02 -0000	1.72
  +++ Test.pm	8 Jan 2004 17:15:37 -0000	1.73
  @@ -225,8 +225,7 @@
       # have_module requires the perl module
       return 0 unless have_module($module);
   
  -    my $has_version = $module->VERSION || 0;
  -    return 1 if $has_version >= $version;
  +    return 1 if eval { $module->VERSION($version) };
   
       push @SkipReasons, "$module version $version or higher is required";
       return 0;
  @@ -264,7 +263,7 @@
       my $cfg = Apache::Test::config();
       (my $current) = $cfg->{server}->{version} =~ m:^Apache/(\d\.\d+\.\d+):;
   
  -    if ($current lt $wanted) {
  +    if (normalize_vstring($current) < normalize_vstring($wanted)) {
           push @SkipReasons,
             "apache version $wanted or higher is required," .
             " this is version $current";
  @@ -280,7 +279,7 @@
       my $cfg = Apache::Test::config();
       (my $current) = $cfg->{server}->{version} =~ m:^Apache/(\d\.\d+\.\d+):;
   
  -    if ($current ne $wanted) {
  +    if (normalize_vstring($current) != normalize_vstring($wanted)) {
           push @SkipReasons,
             "apache version $wanted or higher is required," .
             " this is version $current";
  @@ -370,6 +369,16 @@
   sub under_construction {
       push @SkipReasons, "This test is under construction";
       return 0;
  +}
  +
  +# normalize Apache-sytle version strings (2.0.48, 0.9.4)
  +# for easy numeric comparison.  note that 2.1 and 2.1.0
  +# are considered equivalent.
  +sub normalize_vstring {
  +
  +    my @digits = shift =~ m/(\d+)\.?(\d*)\.?(\d*)/;
  +
  +    return join '', map { sprintf("%03d", $_ || 0) } @digits;
   }
   
   package Apache::TestToString;
  
  
  
  1.24      +2 -1      httpd-test/perl-framework/Apache-Test/lib/Apache/TestConfigC.pm
  
  Index: TestConfigC.pm
  ===================================================================
  RCS file: /home/cvs/httpd-test/perl-framework/Apache-Test/lib/Apache/TestConfigC.pm,v
  retrieving revision 1.23
  retrieving revision 1.24
  diff -u -r1.23 -r1.24
  --- TestConfigC.pm	15 Dec 2003 14:08:08 -0000	1.23
  +++ TestConfigC.pm	8 Jan 2004 17:15:37 -0000	1.24
  @@ -40,7 +40,8 @@
           my $wanted = $1;
           (my $current) = $self->{server}->{version} =~ m:^Apache/(\d\.\d+\.\d+):;
   
  -        if ($current lt $wanted) {
  +        if (Apache::Test::normalize_vstring($current) < 
  +            Apache::Test::normalize_vstring($wanted)) {
               my $reason = "requires Apache version $wanted";
               $self->{cmodules_disabled}->{$mod} = $reason;
               notice "$mod $reason, skipping.";
  
  
  
  1.15      +3 -1      httpd-test/perl-framework/Apache-Test/lib/Apache/TestSSLCA.pm
  
  Index: TestSSLCA.pm
  ===================================================================
  RCS file: /home/cvs/httpd-test/perl-framework/Apache-Test/lib/Apache/TestSSLCA.pm,v
  retrieving revision 1.14
  retrieving revision 1.15
  diff -u -r1.14 -r1.15
  --- TestSSLCA.pm	12 Aug 2003 19:26:41 -0000	1.14
  +++ TestSSLCA.pm	8 Jan 2004 17:15:37 -0000	1.15
  @@ -38,7 +38,9 @@
   my $passout = "-passout pass:$pass";
   
   # in 0.9.7 s/Email/emailAddress/ in DN
  -my $email_field = $version lt "0.9.7" ? "Email" : "emailAddress";
  +my $email_field = Apache::Test::normalize_vstring($version) <
  +                  Apache::Test::normalize_vstring("0.9.7") ? 
  +                  "Email" : "emailAddress";
   
   my $ca_dn = {
       asf => {
  
  
  

Mime
View raw message