Branch Coverage

blib/lib/Test/postgresql.pm
Criterion Covered Total %
branch 12 106 11.3


line true false branch
46 0 4 @_ == 1 ? :
49 0 4 if (not defined $self->uid and $ENV{'USER'} eq 'root')
50 0 0 unless my(@a) = getpwnam 'nobody'
54 0 4 if (defined $self->base_dir) { }
55 0 0 unless $self->base_dir =~ m[^/]
58 0 4 $ENV{'TEST_POSTGRESQL_PRESERVE'} ? :
63 0 4 if defined $self->uid
66 4 0 unless (defined $self->initdb)
67 4 0 unless my $prog = _find_program('initdb')
71 0 0 unless (defined $self->postmaster)
72 0 0 unless my $prog = _find_program('postmaster')
76 0 0 if ($self->auto_start)
77 0 0 if $self->auto_start >= 2
86 0 4 if defined $self->pid and $$ == $self->_owner_pid
102 0 0 if defined $self->pid
106 0 0 if ($self->port) { }
107 0 0 unless $err = $self->_try_start($self->port)
112 0 0 unless $err = $self->_try_start($port)
120 0 0 unless my $dbh = 'DBI'->connect($self->dsn('dbname', 'template1'), '', '', {})
122 0 0 if ($dbh->selectrow_arrayref(q[SELECT COUNT(*) FROM pg_database WHERE datname='test'])->[0] == 0)
123 0 0 unless $dbh->do('CREATE DATABASE test')
132 0 0 unless open my $logfh, '>', $self->base_dir . '/postgres.log'
136 0 0 unless defined $pid
138 0 0 if ($pid == 0)
139 0 0 unless open STDOUT, '>&', $logfh
141 0 0 unless open STDERR, '>&', $logfh
143 0 0 unless chdir $self->base_dir
145 0 0 if (defined $self->uid)
146 0 0 unless setuid($self->uid)
163 0 0 unless open $logfh, '<', $self->base_dir . '/postgres.log'
169 0 0 if $lines =~ /is ready to accept connections/
170 0 0 if (waitpid($pid, 1) > 0)
185 0 0 unless defined $self->pid
197 0 0 unless chmod 0755, $self->base_dir
199 0 0 if ($ENV{'USER'} eq 'root')
200 0 0 unless chown $self->uid, -1, $self->base_dir
203 0 0 if (mkdir $self->base_dir . '/tmp')
204 0 0 if ($self->uid)
205 0 0 unless chown $self->uid, -1, $self->base_dir . '/tmp'
210 0 0 if (not -d $self->base_dir . '/data')
211 0 0 unless pipe my $rfh, my $wfh
214 0 0 unless defined $pid
216 0 0 if ($pid == 0)
218 0 0 unless open STDOUT, '>&', $wfh
220 0 0 unless open STDERR, '>&', $wfh
222 0 0 unless chdir $self->base_dir
224 0 0 if (defined $self->uid)
225 0 0 unless setuid($self->uid)
245 0 0 if $? != 0
254 0 4 if $path
257 0 3 if -x "$sp/bin/$prog"
267 0 4 if $path
269 4 0 unless -x $path