List:Commits« Previous MessageNext Message »
From:capttofu Date:August 15 2008 1:39pm
Subject:[svn:DBD-mysql] r11646 - DBD-mysql/trunk/t
View as plain text  
Author: capttofu
Date: Fri Aug 15 04:39:30 2008
New Revision: 11646

Added:
   DBD-mysql/trunk/t/65segfault.t   (contents, props changed)

Log:
Added test for segfault - TAKE_IMP_DATA code causes segfaults for DBI
versions < 1.607. Disabled now until better solution can be found.


Added: DBD-mysql/trunk/t/65segfault.t
==============================================================================
--- (empty file)
+++ DBD-mysql/trunk/t/65segfault.t	Fri Aug 15 04:39:30 2008
@@ -0,0 +1,50 @@
+#!perl -w
+# vim: ft=perl
+
+use Test::More;
+use DBI;
+use DBI::Const::GetInfoType;
+use lib 't', '.';
+require 'lib.pl';
+use strict;
+$|= 1;
+
+use vars qw($table $test_dsn $test_user $test_password);
+
+my $dbh;
+eval {$dbh= DBI->connect($test_dsn, $test_user, $test_password,
+                      { 
+                          mysql_auto_reconnect  => 1, 
+                          RaiseError => 1, 
+                          PrintError => 1, 
+                          AutoCommit => 0 });
+};
+
+if ($@) {
+    plan skip_all => 
+        "ERROR: $DBI::errstr. Can't continue test";
+}
+my $dbh2;
+eval {$dbh2= DBI->connect($test_dsn, $test_user, $test_password);};
+
+if ($@) {
+    plan skip_all => 
+        "ERROR: $DBI::errstr. Can't continue test";
+}
+plan tests => 5;
+
+ok(defined $dbh, "Handle 1 Connected to database");
+ok(defined $dbh2, "Handle 2 Connected to database");
+
+#kill first db connection to trigger an auto reconnect
+ok ($dbh2->do('kill ' . $dbh->{'mysql_thread_id'}));
+
+#insert a temporary delay, try uncommenting this if it's not seg-faulting at first,
+# one of my initial tests without this delay didn't seg fault
+sleep 1;
+
+#ping first dbh handle to trigger auto-reconnect
+$dbh->ping;
+
+ok ($dbh);
+ok ($dbh2);
Thread
[svn:DBD-mysql] r11646 - DBD-mysql/trunk/tcapttofu15 Aug