File: rt_48393_debug_panic_with_commit.t

package info (click to toggle)
libdbd-sqlite3-perl 1.76-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 11,004 kB
  • sloc: ansic: 167,715; perl: 1,788; pascal: 277; makefile: 9
file content (56 lines) | stat: -rw-r--r-- 1,093 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
use strict;
use warnings;
use lib "t/lib";
use SQLiteTest;
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 if -d ".git", "Test::FailWarnings";

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';
}

done_testing;

__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;