mirror of
https://github.com/percona/percona-toolkit.git
synced 2025-09-11 13:40:07 +00:00
Debug Daemon.t failures.
This commit is contained in:
@@ -617,6 +617,14 @@ sub get_master_binlog_pos {
|
|||||||
return $ms->{position};
|
return $ms->{position};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
sub _d {
|
||||||
|
my ($package, undef, $line) = caller 0;
|
||||||
|
@_ = map { (my $temp = $_) =~ s/\n/\n# /g; $temp; }
|
||||||
|
map { defined $_ ? $_ : 'undef' }
|
||||||
|
@_;
|
||||||
|
print STDERR "# $package:$line $PID ", join(' ', @_), "\n";
|
||||||
|
}
|
||||||
|
|
||||||
1;
|
1;
|
||||||
}
|
}
|
||||||
# ###########################################################################
|
# ###########################################################################
|
||||||
|
@@ -15,6 +15,8 @@ use Daemon;
|
|||||||
use OptionParser;
|
use OptionParser;
|
||||||
use PerconaTest;
|
use PerconaTest;
|
||||||
|
|
||||||
|
use constant PTDEVDEBUG => $ENV{PTDEVDEBUG} || 0;
|
||||||
|
|
||||||
my $o = new OptionParser(file => "$trunk/t/lib/samples/daemonizes.pl");
|
my $o = new OptionParser(file => "$trunk/t/lib/samples/daemonizes.pl");
|
||||||
my $d = new Daemon(o=>$o);
|
my $d = new Daemon(o=>$o);
|
||||||
|
|
||||||
@@ -30,7 +32,7 @@ sub rm_tmp_files() {
|
|||||||
rm_tmp_files();
|
rm_tmp_files();
|
||||||
|
|
||||||
my $cmd = "$trunk/t/lib/samples/daemonizes.pl";
|
my $cmd = "$trunk/t/lib/samples/daemonizes.pl";
|
||||||
my $ret_val = system("$cmd 2 --daemonize --pid $pid_file");
|
my $ret_val = system("$cmd 2 --daemonize --pid $pid_file >/dev/null 2>&1");
|
||||||
die 'Cannot test Daemon.pm because t/daemonizes.pl is not working'
|
die 'Cannot test Daemon.pm because t/daemonizes.pl is not working'
|
||||||
unless $ret_val == 0;
|
unless $ret_val == 0;
|
||||||
|
|
||||||
@@ -108,6 +110,8 @@ SKIP: {
|
|||||||
my $proc_fd_0 = -l "/proc/$pid/0" ? "/proc/$pid/0"
|
my $proc_fd_0 = -l "/proc/$pid/0" ? "/proc/$pid/0"
|
||||||
: -l "/proc/$pid/fd/0" ? "/proc/$pid/fd/0"
|
: -l "/proc/$pid/fd/0" ? "/proc/$pid/fd/0"
|
||||||
: die "Cannot find fd 0 symlink in /proc/$pid";
|
: die "Cannot find fd 0 symlink in /proc/$pid";
|
||||||
|
PTDEVDEBUG && PerconaTest::_d('pid_file', $pid_file,
|
||||||
|
'pid', $pid, 'proc_fd_0', $proc_fd_0, `ls -l $proc_fd_0`);
|
||||||
my $stdin = readlink $proc_fd_0;
|
my $stdin = readlink $proc_fd_0;
|
||||||
is(
|
is(
|
||||||
$stdin,
|
$stdin,
|
||||||
@@ -136,7 +140,7 @@ SKIP: {
|
|||||||
# pid-file is still running
|
# pid-file is still running
|
||||||
# ##########################################################################
|
# ##########################################################################
|
||||||
rm_tmp_files();
|
rm_tmp_files();
|
||||||
system("$cmd 5 --daemonize --pid $pid_file 2>&1");
|
system("$cmd 5 --daemonize --pid $pid_file >/dev/null 2>&1");
|
||||||
PerconaTest::wait_for_files($pid_file);
|
PerconaTest::wait_for_files($pid_file);
|
||||||
chomp($pid = `cat $pid_file`);
|
chomp($pid = `cat $pid_file`);
|
||||||
kill 9, $pid;
|
kill 9, $pid;
|
||||||
|
Reference in New Issue
Block a user