Merged fix-903510-pt-tcp-model-empty-requests-file

This commit is contained in:
Brian Fraser fraserb@gmail.com
2012-08-01 14:56:10 -03:00
3 changed files with 22 additions and 4 deletions

View File

@@ -1832,7 +1832,10 @@ sub parse_event {
if ( $self->{in_prg} ) {
die "Error: no more lines, but in_prg = $self->{in_prg}";
}
if ( $self->{t_start} < $self->{current_ts} ) {
if ( defined $self->{t_start}
&& defined $self->{current_ts}
&& $self->{t_start} < $self->{current_ts} )
{
PTDEBUG && _d("Returning event based on what's been seen");
return $self->make_event($self->{t_start}, $self->{current_ts});
}

View File

@@ -122,7 +122,10 @@ sub parse_event {
if ( $self->{in_prg} ) {
die "Error: no more lines, but in_prg = $self->{in_prg}";
}
if ( $self->{t_start} < $self->{current_ts} ) {
if ( defined $self->{t_start}
&& defined $self->{current_ts}
&& $self->{t_start} < $self->{current_ts} )
{
PTDEBUG && _d("Returning event based on what's been seen");
return $self->make_event($self->{t_start}, $self->{current_ts});
}

View File

@@ -9,7 +9,7 @@ BEGIN {
use strict;
use warnings FATAL => 'all';
use English qw(-no_match_vars);
use Test::More tests => 2;
use Test::More;
use PerconaTest;
shift @INC; # our unshift (above)
@@ -45,7 +45,19 @@ ok(
'Analysis for sorted001.txt (issue 1341)'
);
($output) = full_output(
sub { pt_tcp_model::main(@args,
'--type=requests', "$trunk/t/lib/samples/empty.txt"
) }
);
is(
$output,
'',
"--type=requests doesn't die on an empty file",
);
# #############################################################################
# Done.
# #############################################################################
exit;
done_testing;