httpd-test-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Stas Bekman <s...@stason.org>
Subject [patch] have_min_apache_version: 2.0.48-dev is not 2.0.48
Date Fri, 19 Sep 2003 19:47:26 GMT
Since  2.0.48-dev is not 2.0.48 I believe we should look at it as 2.0.47 in 
the tests? or should we not complicate things and have those who use -dev 
always keep up with the latest versions? I'm not sure if this should go in.

Index: Apache-Test/lib/Apache/Test.pm
===================================================================
RCS file: /home/cvs/httpd-test/perl-framework/Apache-Test/lib/Apache/Test.pm,v
retrieving revision 1.68
diff -u -r1.68 Test.pm
--- Apache-Test/lib/Apache/Test.pm      16 Sep 2003 07:38:13 -0000      1.68
+++ Apache-Test/lib/Apache/Test.pm      19 Sep 2003 19:43:14 -0000
@@ -259,12 +259,32 @@
      }
  }

+# since 2.0.48-dev is not 2.0.48, but more like 2.0.47
+# this returns the current apache version as is and the "real" one
+sub _apache_versions {
+    my $cfg = Apache::Test::config();
+
+    my $current = "";
+    my $real    = "";
+    if ($cfg->{server}->{version} =~ m:^Apache/((\d)\.(\d+)\.(\d+)(-dev)?):) {
+        $current = $1;
+        # 2.0.48-dev => 2.0.47
+        # 2.1.0-dev  => 2.0.999
+        # 2.1.1-dev  => 2.1.0
+        $real = $5
+            ? $4 > 0 ? ("$2.$3." . ($4-1)) : ( "$2." . ($3-1) . ".999")
+            : $current;
+    }
+
+warn "APACHE VERSION: $current, $real\n";
+    return ($current, $real);
+}
+
  sub have_min_apache_version {
      my $wanted = shift;
-    my $cfg = Apache::Test::config();
-    (my $current) = $cfg->{server}->{version} =~ m:^Apache/(\d\.\d+\.\d+):;
+    my ($current, $real) = _apache_versions();

-    if ($current lt $wanted) {
+    if ($real lt $wanted) {
          push @SkipReasons,
            "apache version $wanted or higher is required," .
            " this is version $current";
@@ -277,10 +297,9 @@

  sub have_apache_version {
      my $wanted = shift;
-    my $cfg = Apache::Test::config();
-    (my $current) = $cfg->{server}->{version} =~ m:^Apache/(\d\.\d+\.\d+):;
+    my ($current, $real) = _apache_versions();

-    if ($current ne $wanted) {
+    if ($real ne $wanted) {
          push @SkipReasons,
            "apache version $wanted or higher is required," .
            " this is version $current";


__________________________________________________________________
Stas Bekman            JAm_pH ------> Just Another mod_perl Hacker
http://stason.org/     mod_perl Guide ---> http://perl.apache.org
mailto:stas@stason.org http://use.perl.org http://apacheweek.com
http://modperlbook.org http://apache.org   http://ticketmaster.com


Mime
View raw message