1
# Copyright (C) 2008-2009 Sun Microsystems, Inc. All rights reserved.
2
# Use is subject to license terms.
4
# This program is free software; you can redistribute it and/or modify
5
# it under the terms of the GNU General Public License as published by
6
# the Free Software Foundation; version 2 of the License.
8
# This program is distributed in the hope that it will be useful, but
9
# WITHOUT ANY WARRANTY; without even the implied warranty of
10
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11
# General Public License for more details.
13
# You should have received a copy of the GNU General Public License
14
# along with this program; if not, write to the Free Software
15
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301
18
package GenTest::Reporter::BackupAndRestore;
21
@ISA = qw(GenTest::Reporter);
25
use GenTest::Reporter;
26
use GenTest::Constants;
29
my $file = '/tmp/rqg_backup';
34
return STATUS_OK if $count > 0;
36
my $dsn = $reporter->dsn();
38
my $dbh = DBI->connect($dsn);
40
unlink('/tmp/rqg_backup');
41
say("Executing BACKUP DATABASE.");
42
$dbh->do("BACKUP DATABASE test TO '/tmp/rqg_backup'");
45
if (defined $dbh->err()) {
46
return STATUS_DATABASE_CORRUPTION;
55
my $dsn = $reporter->dsn();
57
my $dbh = DBI->connect($dsn);
59
say("Executing RESTORE FROM.");
60
$dbh->do("RESTORE FROM '/tmp/rqg_backup' OVERWRITE");
62
if (defined $dbh->err()) {
63
return STATUS_DATABASE_CORRUPTION;
70
return REPORTER_TYPE_PERIODIC | REPORTER_TYPE_SUCCESS;