mirror of
https://github.com/percona/percona-toolkit.git
synced 2025-09-28 17:15:44 +00:00
Add RawLogParser.pm and implement --type rawlog in pt-query-digest (Percona 22371).
This commit is contained in:
48
t/pt-query-digest/rawlog_analyses.t
Normal file
48
t/pt-query-digest/rawlog_analyses.t
Normal file
@@ -0,0 +1,48 @@
|
||||
#!/usr/bin/env perl
|
||||
|
||||
BEGIN {
|
||||
die "The PERCONA_TOOLKIT_BRANCH environment variable is not set.\n"
|
||||
unless $ENV{PERCONA_TOOLKIT_BRANCH} && -d $ENV{PERCONA_TOOLKIT_BRANCH};
|
||||
unshift @INC, "$ENV{PERCONA_TOOLKIT_BRANCH}/lib";
|
||||
};
|
||||
|
||||
use strict;
|
||||
use warnings FATAL => 'all';
|
||||
use English qw(-no_match_vars);
|
||||
use Test::More tests => 2;
|
||||
|
||||
use PerconaTest;
|
||||
|
||||
# See 101_slowlog_analyses.t or http://code.google.com/p/maatkit/wiki/Testing
|
||||
shift @INC; # our unshift (above)
|
||||
shift @INC; # PerconaTest's unshift
|
||||
|
||||
require "$trunk/bin/pt-query-digest";
|
||||
|
||||
# #############################################################################
|
||||
# Issue 172: Make mk-query-digest able to read raweral logs
|
||||
# #############################################################################
|
||||
|
||||
my @args = ('--report-format', 'header,query_report,profile', '--type', 'rawlog');
|
||||
my $sample = "$trunk/t/lib/samples/rawlogs/";
|
||||
|
||||
# --help exists so don't run mqd as a module else --help's exit will
|
||||
# exit this test script.
|
||||
like(
|
||||
`$trunk/bin/pt-query-digest --type rawlog rawlog001.txt --help`,
|
||||
qr/--order-by\s+Query_time:cnt/,
|
||||
'--order-by defaults to Query_time:cnt for --type rawlog',
|
||||
);
|
||||
|
||||
ok(
|
||||
no_diff(
|
||||
sub { pt_query_digest::main(@args, $sample.'rawlog001.txt') },
|
||||
"t/pt-query-digest/samples/rawlog001.txt"
|
||||
),
|
||||
'Analysis for rawlog001',
|
||||
);
|
||||
|
||||
# #############################################################################
|
||||
# Done.
|
||||
# #############################################################################
|
||||
exit;
|
Reference in New Issue
Block a user