Skip Menu |

This queue is for tickets about the DBI CPAN distribution.

Report information
The Basics
Id: 26099
Status: resolved
Priority: 0/
Queue: DBI

People
Owner: Nobody in particular
Requestors: jdhedden [...] cpan.org
Cc:
AdminCc:

Bug Information
Severity: Important
Broken in:
  • 1.42
  • 1.43
  • 1.44
  • 1.45
  • 1.45-5.8.4
  • 1.46
  • 1.47
  • 1.48
  • 1.49
  • 1.50
  • 1.51
  • 1.52
  • 1.53
  • 1.54
Fixed in: (no value)



Subject: [PATCH] Allow any *DBM_File to work for DBI testing
The test suite for DBI is hard-coded to use SDBM_File by default, and hence fails if SDBM_File is not built. The attached patch lets testing proceed by using any *DBM_File (or DB_File) that is found. The patch also corrects an ordering problem found in one test.
Subject: dbi_dbm_test.patch
--- DBI-1.54/t/50dbm.t.orig 2007-04-04 10:34:48.000000000 -0400 +++ DBI-1.54/t/50dbm.t 2007-04-04 10:42:12.000000000 -0400 @@ -41,7 +41,13 @@ # we only test SDBM_File by default to avoid tripping up # on any broken DBM's that may be installed in odd places. # It's only DBD::DBM we're trying to test here. - @dbm_types = ("SDBM_File"); + # (However, if SDBM_File is not available, then use another.) + for (qw( SDBM_File GDBM_File DB_File BerkeleyDB )) { + if (eval { local $^W; require "$_.pm" }) { + @dbm_types = ($_); + last; + } + } } print "Using DBM modules: @dbm_types\n"; --- DBI-1.54/t/85gofer.t.orig 2007-04-04 10:34:54.000000000 -0400 +++ DBI-1.54/t/85gofer.t 2007-04-04 10:51:08.000000000 -0400 @@ -18,7 +18,6 @@ plan skip_all => "transport+policy tests skipped with non-pedantic policy in DBI_AUTOPROXY" if $ap !~ /policy=pedantic\b/i; } -plan 'no_plan'; # 0=SQL::Statement if avail, 1=DBI::SQL::Nano # next line forces use of Nano rather than default behaviour @@ -28,11 +27,22 @@ my %durations; # so users can try others from the command line -my $dbm = $ARGV[0] || "SDBM_File"; +my $dbm = $ARGV[0]; +if (! defined($dbm)) { + for (qw( SDBM_File GDBM_File DB_File BerkeleyDB )) { + if (eval { local $^W; require "$_.pm" }) { + $dbm = ($_); + last; + } + } + plan skip_all => 'No DBM modules available' if (! defined($dbm)); +} my $remote_driver_dsn = "dbm_type=$dbm;lockfile=0"; my $remote_dsn = "dbi:DBM:$remote_driver_dsn"; my $timeout = 10; +plan 'no_plan'; + if ($ENV{DBI_AUTOPROXY}) { # this means we have DBD::Gofer => DBD::Gofer => DBD::DBM! # rather than disable it we let it run because we're twisted @@ -142,7 +152,7 @@ ok $ins_sth->execute(2, 'oranges'); my $rowset; - ok $rowset = $dbh->selectall_arrayref("SELECT dKey, dVal FROM fruit"); + ok $rowset = $dbh->selectall_arrayref("SELECT dKey, dVal FROM fruit ORDER BY dKey"); is_deeply($rowset, [ [ '1', 'oranges' ], [ '2', 'oranges' ] ]); ok $dbh->do("UPDATE fruit SET dVal='apples' WHERE dVal='oranges'");
Thanks, applied.