diff --git a/t/pt-online-schema-change/alter_active_table.t b/t/pt-online-schema-change/alter_active_table.t index 16a31167..3ddf8680 100644 --- a/t/pt-online-schema-change/alter_active_table.t +++ b/t/pt-online-schema-change/alter_active_table.t @@ -170,8 +170,8 @@ diag('Binlog position before altering table: ', $rows->{file}, '/', $rows->{posi start_query_table(qw(pt_osc t id)); # While that's ^ happening, alter the table. -$output = output( - sub { $exit = pt_online_schema_change::main( +($output, $exit) = full_output( + sub { pt_online_schema_change::main( "$master_dsn,D=pt_osc,t=t", qw(--lock-wait-timeout 5), qw(--print --execute --chunk-size 100 --alter ENGINE=InnoDB)) }, @@ -188,7 +188,7 @@ is( $rows->{t}->{engine}, 'InnoDB', "New table ENGINE=InnoDB" -) or warn Dumper($rows); +) or BAIL_OUT("Something went terribly wrong"); is( scalar keys %$rows, diff --git a/t/pt-online-schema-change/basics.t b/t/pt-online-schema-change/basics.t index b23a95f5..1a0efd2d 100644 --- a/t/pt-online-schema-change/basics.t +++ b/t/pt-online-schema-change/basics.t @@ -51,8 +51,8 @@ my $rows; $sb->load_file('master', "$sample/basic_no_fks.sql"); -$output = output( - sub { $exit = pt_online_schema_change::main(@args, "$dsn,D=pt_osc,t=t", +($output, $exit) = full_output( + sub { pt_online_schema_change::main(@args, "$dsn,D=pt_osc,t=t", '--alter', 'drop column id') } ); @@ -139,11 +139,8 @@ sub test_alter_table { unshift @$orig_tbls, [$new_tbl]; } - # TODO: output() is capturing if this call dies, so if a test - # causes it to die, the tests just stop without saying why, i.e. - # without re-throwing the error. - $output = output( - sub { $exit = pt_online_schema_change::main( + ($output, $exit) = full_output( + sub { pt_online_schema_change::main( @args, '--print', "$dsn,D=$db,t=$tbl", @@ -575,8 +572,8 @@ sub test_table { my $org_rows = $master_dbh->selectall_arrayref('select * from osc.t order by id'); - $output = output( - sub { $exit = pt_online_schema_change::main(@args, + ($output, $exit) = full_output( + sub { pt_online_schema_change::main(@args, "$dsn,D=osc,t=t", qw(--execute --alter ENGINE=InnoDB)) }, stderr => 1, ); diff --git a/t/pt-online-schema-change/bugs.t b/t/pt-online-schema-change/bugs.t index 47f68ade..a364fee2 100644 --- a/t/pt-online-schema-change/bugs.t +++ b/t/pt-online-schema-change/bugs.t @@ -46,8 +46,8 @@ my $sample = "t/pt-online-schema-change/samples/"; # ############################################################################ $sb->load_file('master', "$sample/pk-bug-994002.sql"); -$output = output( - sub { $exit_status = pt_online_schema_change::main(@args, +($output, $exit_status) = full_output( + sub { pt_online_schema_change::main(@args, "$master_dsn,D=test,t=t", "--alter", "add column (foo int)", qw(--chunk-size 2 --dry-run --print)) }, @@ -71,7 +71,7 @@ unlike( # ############################################################################ $sb->load_file('master', "$sample/bug-1002448.sql"); -$output = output( +($output, $exit_status) = full_output( sub { pt_online_schema_change::main(@args, "$master_dsn,D=test1002448,t=table_name", "--alter", "add column (foo int)", diff --git a/t/pt-online-schema-change/privs.t b/t/pt-online-schema-change/privs.t index 0a64ac33..2b96f316 100644 --- a/t/pt-online-schema-change/privs.t +++ b/t/pt-online-schema-change/privs.t @@ -56,7 +56,7 @@ PerconaTest::wait_for_table($slave1_dbh, "mysql.tables_priv", "user='osc_user'") $sb->load_file('master', "$sample/basic_no_fks.sql"); -$output = output( +($output, $exit_status) = full_output( sub { $exit_status = pt_online_schema_change::main(@args, "$master_dsn,u=osc_user,D=pt_osc,t=t", '--alter', 'drop column id', qw(--execute), diff --git a/t/pt-online-schema-change/skip_innodb.t b/t/pt-online-schema-change/skip_innodb.t index 053f5f6d..71c73140 100644 --- a/t/pt-online-schema-change/skip_innodb.t +++ b/t/pt-online-schema-change/skip_innodb.t @@ -31,14 +31,11 @@ else { my $master_dsn = 'h=127.1,P=12348,u=msandbox,p=msandbox'; my @args = (qw(--lock-wait-timeout 3), '--max-load', ''); -my $output; -my $retval; -$output = output( - sub { $retval = pt_online_schema_change::main(@args, +my ($output, $retval) = full_output( + sub { pt_online_schema_change::main(@args, "$master_dsn,D=mysql,t=user", "--alter", "add column (foo int)", qw(--dry-run)) }, - stderr => 1, ); like(