]> git.ipfire.org Git - thirdparty/bugzilla.git/commitdiff
Bug 286701: Tests fail compiling Bugzilla::DB::Pg.pm
authormkanat%kerio.com <>
Fri, 27 May 2005 03:07:35 +0000 (03:07 +0000)
committermkanat%kerio.com <>
Fri, 27 May 2005 03:07:35 +0000 (03:07 +0000)
Patch By Colin Ogilvie <colin.ogilvie@gmail.com> r=mkanat, a=justdave

t/001compile.t

index 30372484828686d58ebb28e07f765c34300a7173..5ea849ac18273f4046dcfb81e5eaa9248ce227cc 100644 (file)
@@ -32,6 +32,10 @@ use Support::Files;
 
 use Test::More tests => scalar(@Support::Files::testitems);
 
+# Need this to get the available driver information
+use DBI;
+my @DBI_drivers = DBI->available_drivers;
+
 # Bugzilla requires Perl 5.6.1 now.  Checksetup will tell you this if you run it, but
 # it tests it in a polite/passive way that won't make it fail at compile time.  We'll
 # slip in a compile-time failure if it's missing here so a tinderbox on 5.00503 won't
@@ -60,6 +64,16 @@ my $perlapp = "\"$^X\"";
 foreach my $file (@testitems) {
     $file =~ s/\s.*$//; # nuke everything after the first space (#comment)
     next if (!$file); # skip null entries
+
+    # Check that we have a DBI module to support the DB, if this is a database
+    # module (but not Schema)
+    if ($file =~ m#Bugzilla/DB/([^/]+)\.pm$# && $file ne "Bugzilla/DB/Schema.pm") {
+        if (!grep(lc($_) =~ /$1/i, @DBI_drivers)) {
+            ok(1,$file." - Skipping, as the DBD module not installed");
+            next;
+        }
+    }
+
     open (FILE,$file);
     my $bang = <FILE>;
     close (FILE);