You are viewing a plain text version of this content. The canonical link for it is here.
Posted to modperl-cvs@perl.apache.org by st...@apache.org on 2003/03/13 03:12:49 UTC
cvs commit: modperl-2.0/t/response/TestCompat apache_util.pm
stas 2003/03/12 18:12:49
Modified: t/response/TestCompat apache_util.pm
Log:
rework the test to actually run the sub-test for validate_password on
platforms that we know C crypt() works on
Revision Changes Path
1.2 +13 -8 modperl-2.0/t/response/TestCompat/apache_util.pm
Index: apache_util.pm
===================================================================
RCS file: /home/cvs/modperl-2.0/t/response/TestCompat/apache_util.pm,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- apache_util.pm 15 Aug 2002 09:35:11 -0000 1.1
+++ apache_util.pm 13 Mar 2003 02:12:49 -0000 1.2
@@ -22,10 +22,16 @@
42_000_000_000 => "40054M",
);
+# list of platforms on which C (not Perl) crypt() is supported
+# XXX: add other platforms that are known to have crypt
+my %crypt_supported = map {$_ => 1} qw(linux);
+
+my $crypt_ok = $crypt_supported{lc $^O} ? 1 : 0;
+
sub handler {
my $r = shift;
- plan $r, tests => 13;
+ plan $r, tests => 13 + $crypt_ok*2;
$r->send_http_header('text/plain');
@@ -73,13 +79,12 @@
ok t_cmp($time, $ptime, "Apache::Util::parsedate");
- # note these are not actually part of the tests since i think on
- # platforms where crypt is not supported, these tests will fail.
- # but at least we can look with t/TEST -v
- my $hash = "aX9eP53k4DGfU";
- t_cmp(1, Apache::Util::validate_password("dougm", $hash));
- t_cmp(0, Apache::Util::validate_password("mguod", $hash));
-
+ if ($crypt_ok) {
+ # not all platforms support C-level crypt
+ my $hash = "aX9eP53k4DGfU";
+ ok t_cmp(1, Apache::Util::validate_password("dougm", $hash));
+ ok t_cmp(0, Apache::Util::validate_password("mguod", $hash));
+ }
OK;
}