~posulliv/drizzle/memcached_applier

« back to all changes in this revision

Viewing changes to tests/lib/mtr_report.pl

Merge trunk

Show diffs side-by-side

added added

removed removed

Lines of Context:
56
56
    if defined $tinfo->{combination};
57
57
 
58
58
  _mtr_log($tname);
59
 
  printf "%-30s ", $tname;
 
59
  if ($::opt_subunit) {
 
60
    printf "test: $tname\n";
 
61
  } else {
 
62
    printf "%-30s ", $tname;
 
63
  }
60
64
}
61
65
 
62
66
sub mtr_report_test_skipped ($) {
63
67
  my $tinfo= shift;
 
68
  my $tname= $tinfo->{name};
 
69
  my $cause= "";
64
70
 
65
71
  $tinfo->{'result'}= 'MTR_RES_SKIPPED';
66
72
  if ( $tinfo->{'disable'} )
67
73
  {
68
 
    mtr_report("[ disabled ]  $tinfo->{'comment'}");
69
 
  }
70
 
  elsif ( $tinfo->{'comment'} )
71
 
  {
72
 
    mtr_report("[ skipped ]   $tinfo->{'comment'}");
73
 
  }
74
 
  else
75
 
  {
76
 
    mtr_report("[ skipped ]");
 
74
    $cause.= "disable";
 
75
  }
 
76
  else
 
77
  {
 
78
    $cause.= "skipped";
 
79
  }
 
80
  if ( $tinfo->{'comment'} )
 
81
  {
 
82
    if ($::opt_subunit) {
 
83
      mtr_report("skip: $tname [\ncause: $cause\n$tinfo->{'comment'}\n]");
 
84
    } else { 
 
85
      mtr_report("[ $cause ]   $tinfo->{'comment'}");
 
86
    }
 
87
  }
 
88
  else
 
89
  {
 
90
    if ($::opt_subunit) {
 
91
      mtr_report("skip: $tname");
 
92
    } else {
 
93
      mtr_report("[ $cause ]");
 
94
    }
77
95
  }
78
96
}
79
97
 
96
114
 
97
115
sub mtr_report_test_passed ($) {
98
116
  my $tinfo= shift;
 
117
  my $tname= $tinfo->{name};
99
118
 
100
119
  my $timer=  "";
101
120
  if ( $::opt_timer and -f "$::opt_vardir/log/timer" )
103
122
    $timer= mtr_fromfile("$::opt_vardir/log/timer");
104
123
    $tot_real_time += ($timer/1000);
105
124
    $timer= sprintf "%12s", $timer;
 
125
    ### XXX: How to format this as iso6801 datetime?
106
126
  }
107
127
  $tinfo->{'result'}= 'MTR_RES_PASSED';
108
 
  mtr_report("[ pass ]   $timer");
 
128
  if ($::opt_subunit) {
 
129
    mtr_report("success: $tname");
 
130
  } else {
 
131
    mtr_report("[ pass ]   $timer");
 
132
  }
109
133
}
110
134
 
111
135
sub mtr_report_test_failed ($) {
112
136
  my $tinfo= shift;
 
137
  my $tname= $tinfo->{name};
 
138
  my $comment= "";
113
139
 
114
140
  $tinfo->{'result'}= 'MTR_RES_FAILED';
115
141
  if ( defined $tinfo->{'timeout'} )
116
142
  {
117
 
    mtr_report("[ fail ]  timeout");
118
 
    return;
119
 
  }
120
 
  else
121
 
  {
122
 
    mtr_report("[ fail ]");
123
 
  }
124
 
 
125
 
  if ( $tinfo->{'comment'} )
 
143
    $comment.= "timeout";
 
144
  }
 
145
  elsif ( $tinfo->{'comment'} )
126
146
  {
127
147
    # The test failure has been detected by mysql-test-run.pl
128
148
    # when starting the servers or due to other error, the reason for
129
149
    # failing the test is saved in "comment"
130
 
    mtr_report("\nERROR: $tinfo->{'comment'}");
 
150
    $comment.= "$tinfo->{'comment'}";
131
151
  }
132
152
  elsif ( -f $::path_timefile )
133
153
  {
134
154
    # Test failure was detected by test tool and it's report
135
155
    # about what failed has been saved to file. Display the report.
136
 
    print "\n";
137
 
    print mtr_fromfile($::path_timefile); # FIXME print_file() instead
138
 
    print "\n";
 
156
    $comment.= mtr_fromfile($::path_timefile);
139
157
  }
140
158
  else
141
159
  {
142
160
    # Neither this script or the test tool has recorded info
143
161
    # about why the test has failed. Should be debugged.
144
 
    mtr_report("\nUnexpected termination, probably when starting mysqld");;
 
162
    $comment.= "Unexpected termination, probably when starting mysqld";
 
163
  }
 
164
  if ($::opt_subunit) {
 
165
    mtr_report("failure: $tname [\n$comment\n]");
 
166
  } else {
 
167
    mtr_report("[ fail ]   $comment");
145
168
  }
146
169
}
147
170