DBD-PrimeBase

 view release on metacpan or  search on metacpan

t/60leaks.t  view on Meta::CPAN

#!/usr/local/bin/perl
#
#   $Id: 60leaks.t,v 1.1.1.1 1999/07/13 08:14:45 joe Exp $
#
#   This is a skeleton test. For writing new tests, take this file
#   and modify/extend it.
#

my $COUNT_CONNECT = 4000;   # Number of connect/disconnect iterations
my $COUNT_PREPARE = 10000;  # Number of prepare/execute/finish iterations


my $haveStorable;

eval { require Proc::ProcessTable; };
if ($@  ||  !$ENV{SLOW_TESTS}) {
    print "1..0\n";
    exit 0;
}
eval { require Storable };
$haveStorable = $@ ? 0 : 1;

sub size {
    my($p, $pt);
    $pt = Proc::ProcessTable->new('cache_ttys' => $haveStorable);
    foreach $p (@{$pt->table()}) {
	if ($p->pid() == $$) {
	    return $p->size();
	}
    }
    die "Cannot find my own process?!?\n";
    exit 0;
}

#
#   Make -w happy
#
$test_dsn = $test_user = $test_password = '';


#
#   Include lib.pl
#
require DBI;
$mdriver = "";
foreach $file ("lib.pl", "t/lib.pl") {
    do $file; if ($@) { print STDERR "Error while executing lib.pl: $@\n";
			   exit 10;
		      }
    if ($mdriver ne '') {
	last;
    }
}
if ($mdriver eq 'whatever') {
    print "1..0\n";
    exit 0;
}


#
#   Main loop; leave this untouched, put tests after creating
#   the new table.
#
while (Testing()) {
    #
    #   Connect to the database
    Test($state or ($dbh = DBI->connect($test_dsn, $test_user,
					$test_password)),
	 undef,
	 "Attempting to connect.\n")



( run in 0.487 second using v1.01-cache-2.11-cpan-71847e10f99 )