2
# This program is free software; you can redistribute it and/or modify
3
# it under the terms of the GNU General Public License as published by
4
# the Free Software Foundation; version 2 of the License.
6
# This program is distributed in the hope that it will be useful, but
7
# WITHOUT ANY WARRANTY; without even the implied warranty of
8
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
9
# General Public License for more details.
11
# You should have received a copy of the GNU General Public License
12
# along with this program; if not, write to the Free Software
13
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301
17
package GenTest::SimPipe::Oracle::Crash;
20
@ISA = qw(GenTest::SimPipe::Oracle GenTest);
26
use GenTest::SimPipe::Oracle;
27
use GenTest::Constants;
28
use GenTest::Executor;
29
use GenTest::Comparator;
35
my ($oracle, $testcase) = @_;
37
my $executor = GenTest::Executor->newFromDSN($oracle->dsn());
40
my $dbh = $executor->dbh();
41
start_server() if not defined $dbh || !$dbh->ping();
43
my $testcase_string = join("\n", (
44
"CREATE DATABASE IF NOT EXISTS crash;",
46
$testcase->mysqldOptionsToString(),
47
$testcase->dbObjectsToString()
50
$dbh->do($testcase_string, { RaiseError => 1 , mysql_multi_statements => 1 });
52
foreach my $query (@{$testcase->queries()}) {
53
my $sth = $dbh->prepare($query, {RaiseError => 1, mysql_multi_statements => 1});
55
say("Result: ".$sth->err()." ".$sth->errstr())
58
$testcase_string .= "\n".join(";\n", @{$testcase->queries()})."\n";
60
# We use our home-grown ping here and not $dbh->ping() as $dbh->ping() was foind
61
# to be buggy in DBD::MySQL.For some reason, it returned TRUE even on a crashed server
63
my ($ping) = $dbh->selectrow_array("SELECT 'working';");
65
if ($ping eq 'working') {
66
say("Ping working. Not repeatable.");
67
open(NR, ">/tmp/last_not_repeatable.test");
68
print NR $testcase_string;
70
return ORACLE_ISSUE_NO_LONGER_REPEATABLE;
72
say("Ping not working. Server has likely crashed. Repeatable.");
73
open(NR, ">/tmp/last_repeatable.test");
74
print NR $testcase_string;
76
$oracle->startServer();
77
return ORACLE_ISSUE_STILL_REPEATABLE;
83
my $basedir = $oracle->basedir();
85
chdir($basedir.'/mysql-test');
86
system("MTR_VERSION=1 perl mysql-test-run.pl --start-and-exit --mysqld=--skip-grant-tables --mysqld=--loose-skip-pbxt --mysqld=--innodb --master_port=19300 --mysqld=--log-output=file 1st");