#!/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; use PerconaTest; use Sandbox; require "$trunk/bin/pt-upgrade"; # This runs immediately if the server is already running, else it starts it. diag(`$trunk/sandbox/start-sandbox master 12348 >/dev/null`); my $dp = new DSNParser(opts=>$dsn_opts); my $sb = new Sandbox(basedir => '/tmp', DSNParser => $dp); my $dbh1 = $sb->get_dbh_for('master'); my $dbh2 = $sb->get_dbh_for('master1'); if ( !$dbh1 ) { plan skip_all => 'Cannot connect to sandbox master'; } elsif ( !$dbh2 ) { plan skip_all => 'Cannot connect to second sandbox master'; } else { plan tests => 1; } my $cmd = "$trunk/bin/pt-upgrade h=127.1,P=12345,u=msandbox,p=msandbox P=12348 --compare results,warnings --zero-query-times"; # Issue 391: Add --pid option to all scripts `touch /tmp/mk-script.pid`; my $output = `$cmd $trunk/t/pt-upgrade/samples/001/select-one.log --pid /tmp/mk-script.pid 2>&1`; like( $output, qr{PID file /tmp/mk-script.pid already exists}, 'Dies if PID file already exists (--pid without --daemonize) (issue 391)' ); `rm -rf /tmp/mk-script.pid`; # ############################################################################# # Done. # ############################################################################# exit;