Convert TableUsage.t from Maatkit to Percona Toolkit.

This commit is contained in:
Daniel Nichter
2012-04-03 10:47:01 -06:00
parent ca084ace0f
commit dcec863988

View File

@@ -1,9 +1,9 @@
#!/usr/bin/perl #!/usr/bin/perl
BEGIN { BEGIN {
die "The MAATKIT_WORKING_COPY environment variable is not set. See http://code.google.com/p/maatkit/wiki/Testing" die "The PERCONA_TOOLKIT_BRANCH environment variable is not set.\n"
unless $ENV{MAATKIT_WORKING_COPY} && -d $ENV{MAATKIT_WORKING_COPY}; unless $ENV{PERCONA_TOOLKIT_BRANCH} && -d $ENV{PERCONA_TOOLKIT_BRANCH};
unshift @INC, "$ENV{MAATKIT_WORKING_COPY}/common"; unshift @INC, "$ENV{PERCONA_TOOLKIT_BRANCH}/lib";
}; };
use strict; use strict;
@@ -11,7 +11,7 @@ use warnings FATAL => 'all';
use English qw(-no_match_vars); use English qw(-no_match_vars);
use Test::More tests => 34; use Test::More tests => 34;
use MaatkitTest; use PerconaTest;
use QueryParser; use QueryParser;
use SQLParser; use SQLParser;
use TableUsage; use TableUsage;
@@ -590,23 +590,22 @@ use Schema;
use SchemaIterator; use SchemaIterator;
my $o = new OptionParser(description => 'SchemaIterator'); my $o = new OptionParser(description => 'SchemaIterator');
$o->get_specs("$trunk/mk-table-checksum/mk-table-checksum"); $o->get_specs("$trunk/bin/pt-table-checksum");
my $q = new Quoter; my $q = new Quoter;
my $tp = new TableParser(Quoter => $q); my $tp = new TableParser(Quoter => $q);
my $fi = new FileIterator(); my $fi = new FileIterator();
my $file_itr = $fi->get_file_itr("$trunk/common/t/samples/mysqldump-no-data/dump001.txt"); my $file_itr = $fi->get_file_itr("$trunk/t/lib/samples/mysqldump-no-data/dump001.txt");
my $schema = new Schema(); my $schema = new Schema();
my $schema_itr = new SchemaIterator( my $schema_itr = new SchemaIterator(
file_itr => $file_itr, file_itr => $file_itr,
OptionParser => $o, OptionParser => $o,
Quoter => $q, Quoter => $q,
TableParser => $tp, TableParser => $tp,
keep_ddl => 1,
Schema => $schema, Schema => $schema,
); );
# Init schema. # Init schema.
1 while ($schema_itr->next_schema_object()); 1 while ($schema_itr->next());
# Before, this is as correct as we can determine. The WHERE access is missing # Before, this is as correct as we can determine. The WHERE access is missing
# because c3 is not qualified and there's multiple tables, so the code can't # because c3 is not qualified and there's multiple tables, so the code can't