Conditionalize IO::Uncompress::Inflate test. Make test names shorter, uniform.

This commit is contained in:
Daniel Nichter
2012-02-14 11:19:23 -07:00
parent 1c57fe8ee2
commit da051b3371
3 changed files with 86 additions and 80 deletions

View File

@@ -324,17 +324,18 @@ sub test_log_parser {
close $fh; close $fh;
}; };
my ($base_file_name) = $args{file} =~ m/([^\/]+)$/;
is( is(
$EVAL_ERROR, $EVAL_ERROR,
'', '',
"No error on $args{file}" "$base_file_name: no errors"
); );
if ( defined $args{result} ) { if ( defined $args{result} ) {
is_deeply( is_deeply(
\@e, \@e,
$args{result}, $args{result},
$args{file} "$base_file_name: results"
) or print "Got: ", Dumper(\@e); ) or print "Got: ", Dumper(\@e);
} }
@@ -342,7 +343,7 @@ sub test_log_parser {
is( is(
scalar @e, scalar @e,
$args{num_events}, $args{num_events},
"$args{file} num_events" "$base_file_name: $args{num_events} events"
); );
} }
@@ -380,17 +381,18 @@ sub test_protocol_parser {
close $fh; close $fh;
}; };
my ($base_file_name) = $args{file} =~ m/([^\/]+)$/;
is( is(
$EVAL_ERROR, $EVAL_ERROR,
'', '',
"No error on $args{file}" "$base_file_name: no errors"
); );
if ( defined $args{result} ) { if ( defined $args{result} ) {
is_deeply( is_deeply(
\@e, \@e,
$args{result}, $args{result},
$args{file} . ($args{desc} ? ": $args{desc}" : '') "$base_file_name: " . ($args{desc} || "results")
) or print "Got: ", Dumper(\@e); ) or print "Got: ", Dumper(\@e);
} }
@@ -398,7 +400,7 @@ sub test_protocol_parser {
is( is(
scalar @e, scalar @e,
$args{num_events}, $args{num_events},
"$args{file} num_events" "$base_file_name: $args{num_events} events"
); );
} }

View File

@@ -15,7 +15,7 @@ use MySQLProtocolParser;
use TcpdumpParser; use TcpdumpParser;
use PerconaTest; use PerconaTest;
my $sample = "t/lib/samples/tcpdump/"; my $sample = "t/lib/samples/tcpdump";
my $tcpdump = new TcpdumpParser(); my $tcpdump = new TcpdumpParser();
my $protocol; # Create a new MySQLProtocolParser for each test. my $protocol; # Create a new MySQLProtocolParser for each test.
@@ -487,6 +487,10 @@ test_protocol_parser(
], ],
); );
eval { require IO::Uncompress::Inflate; };
SKIP: {
skip "IO::Uncompress::Inflate not installed", 2 if $EVAL_ERROR;
# Check data decompression. # Check data decompression.
$protocol = new MySQLProtocolParser( $protocol = new MySQLProtocolParser(
server => '127.0.0.1', server => '127.0.0.1',
@@ -557,9 +561,9 @@ test_protocol_parser(
}, },
], ],
); );
}
# TCP retransmission. # TCP retransmission.
# Check data decompression.
$protocol = new MySQLProtocolParser( $protocol = new MySQLProtocolParser(
server => '10.55.200.15', server => '10.55.200.15',
); );

View File

@@ -15,7 +15,7 @@ use SlowLogParser;
use PerconaTest; use PerconaTest;
my $p = new SlowLogParser; my $p = new SlowLogParser;
my $sample = "t/lib/samples/slowlogs/"; my $sample = "t/lib/samples/slowlogs";
# Check that I can parse a slow log in the default slow log format. # Check that I can parse a slow log in the default slow log format.
test_log_parser( test_log_parser(