summaryrefslogtreecommitdiff
path: root/mysql-test/lib/My/Test.pm
diff options
context:
space:
mode:
Diffstat (limited to 'mysql-test/lib/My/Test.pm')
-rw-r--r--mysql-test/lib/My/Test.pm34
1 files changed, 33 insertions, 1 deletions
diff --git a/mysql-test/lib/My/Test.pm b/mysql-test/lib/My/Test.pm
index c8bfbd34521..f9eed945e41 100644
--- a/mysql-test/lib/My/Test.pm
+++ b/mysql-test/lib/My/Test.pm
@@ -1,4 +1,18 @@
# -*- cperl -*-
+# Copyright (c) 2008, 2011, Oracle and/or its affiliates. All rights reserved.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; version 2 of the License.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
#
@@ -10,6 +24,7 @@ use strict;
use warnings;
use Carp;
use Storable();
+use mtr_results;
sub new {
@@ -47,9 +62,26 @@ sub is_failed {
}
+my %result_names= (
+ 'MTR_RES_PASSED' => 'pass',
+ 'MTR_RES_FAILED' => 'fail',
+ 'MTR_RES_SKIPPED' => 'skipped',
+ );
+
sub write_test {
my ($test, $sock, $header)= @_;
+ if ($::opt_resfile && defined $test->{'result'}) {
+ resfile_test_info("result", $result_names{$test->{'result'}});
+ if ($test->{'timeout'}) {
+ resfile_test_info("comment", "Timeout");
+ } elsif (defined $test->{'comment'}) {
+ resfile_test_info("comment", $test->{'comment'});
+ }
+ resfile_test_info("result", "warning") if defined $test->{'check'};
+ resfile_to_test($test);
+ }
+
# Give the test a unique key before serializing it
$test->{key}= "$test" unless defined $test->{key};
@@ -67,8 +99,8 @@ sub read_test {
my $test= Storable::thaw($serialized);
die "wrong class (hack attempt?)"
unless ref($test) eq 'My::Test';
+ resfile_from_test($test) if $::opt_resfile;
return $test;
}
-
1;