diff options
author | Lorry Tar Creator <lorry-tar-importer@baserock.org> | 2012-09-24 10:15:50 +0000 |
---|---|---|
committer | Lorry <lorry@roadtrain.codethink.co.uk> | 2012-09-26 13:46:46 +0000 |
commit | 485b97be9f2f2abf5a40923b5fd85f75714a8c02 (patch) | |
tree | ca05cb0ecf3828d909a898c3e5805804a0aff5f8 /t/rt_48393_debug_panic_with_commit.t | |
download | perl-dbd-sqlite-tarball-master.tar.gz |
Imported from /srv/lorry/lorry-area/perl-dbd-sqlite-tarball/DBD-SQLite-1.38_01.tar.gz.HEADDBD-SQLite-1.38_01masterbaserock/morph
Diffstat (limited to 't/rt_48393_debug_panic_with_commit.t')
-rw-r--r-- | t/rt_48393_debug_panic_with_commit.t | 62 |
1 files changed, 62 insertions, 0 deletions
diff --git a/t/rt_48393_debug_panic_with_commit.t b/t/rt_48393_debug_panic_with_commit.t new file mode 100644 index 0000000..66880ea --- /dev/null +++ b/t/rt_48393_debug_panic_with_commit.t @@ -0,0 +1,62 @@ +#!/usr/bin/perl + +use strict; +BEGIN { + $| = 1; + $^W = 1; +} + +use t::lib::Test; +use Test::More; + +BEGIN { + plan skip_all => + 'set $ENV{TEST_DBD_SQLITE_WITH_DEBUGGER} '. + 'to enable this test' + unless $ENV{TEST_DBD_SQLITE_WITH_DEBUGGER}; +} + +use Test::NoWarnings; + +plan tests => 2; + +my $file = 't/panic.pl'; +open my $fh, '>', $file; +print $fh <DATA>; +close $fh; + +if ($^O eq 'MSWin32') { + ok !system(qq{set PERLDB_OPTS="NonStop"; $^X -Mblib -d $file}); +} +else { + ok !system(qq{PERLDB_OPTS="NonStop" $^X -Mblib -d $file}); +} + +END { + unlink $file if $file && -f $file; + unlink 'test.db' if -f 'test.db'; +} + +__DATA__ +use strict; +use warnings; +use DBI; + +my $db_file = 'test.db'; + +unlink($db_file); +die "Could not delete $db_file - $!" if(-e $db_file); + +my $dbh = DBI->connect("dbi:SQLite:dbname=$db_file", undef, undef, { +RaiseError => 1, AutoCommit => 1 }); + +$dbh->do('CREATE TABLE t1 (id int)'); + +$dbh->begin_work or die $dbh->errstr; + +my $sth = $dbh->prepare('INSERT INTO t1 (id) VALUES (1)'); +$sth->execute; + +# XXX: Panic occurs here when running under the debugger +$dbh->commit or die $dbh->errstr; + |