Branch Coverage

blib/lib/Test/Postgresql58.pm
Criterion Covered Total %
branch 12 110 10.9


line true false branch
60 0 6 @_ == 1 ? :
63 0 6 if (not defined $self->uid and $ENV{'USER'} eq 'root')
64 0 0 unless my(@a) = getpwnam 'nobody'
68 1 5 if (defined $self->base_dir) { }
69 0 1 unless $self->base_dir =~ m[^/]
74 0 5 $ENV{'TEST_POSTGRESQL_PRESERVE'} ? :
77 0 5 if defined $self->uid
80 6 0 unless (defined $self->initdb)
81 6 0 unless my $prog = _find_program('initdb')
85 0 0 unless (defined $self->postmaster)
86 0 0 unless my $prog = _find_program('postmaster')
90 0 0 if ($self->auto_start)
91 0 0 if $self->auto_start >= 2
101 0 6 if defined $self->pid and $$ == $self->_owner_pid
132 0 0 if defined $self->pid
136 0 0 if ($self->port) { }
137 0 0 unless $err = $self->_try_start($self->port)
142 0 0 unless $err = $self->_try_start($port)
158 0 0 if $dbh
161 0 0 if ($DBI::errstr =~ /the database system is starting up/ or $DBI::errstr =~ /Connection refused/)
169 0 0 unless $dbh
172 0 0 if ($dbh->selectrow_arrayref(q[SELECT COUNT(*) FROM pg_database WHERE datname='test'])->[0] == 0)
173 0 0 unless $dbh->do('CREATE DATABASE test')
182 0 0 unless open my $logfh, '>>', $self->base_dir . '/postgres.log'
186 0 0 unless defined $pid
188 0 0 if ($pid == 0)
189 0 0 unless open STDOUT, '>>&', $logfh
191 0 0 unless open STDERR, '>>&', $logfh
193 0 0 unless chdir $self->base_dir
195 0 0 if (defined $self->uid)
196 0 0 unless setuid($self->uid)
213 0 0 unless open $logfh, '<', $self->base_dir . '/postgres.log'
219 0 0 if $lines =~ /is ready to accept connections/
220 0 0 if (waitpid($pid, 1) > 0)
234 0 0 unless defined $self->pid
244 0 0 if ($timeout <= 0)
251 0 0 if ($timeout <= 0)
264 0 0 unless chmod 0755, $self->base_dir
266 0 0 if ($ENV{'USER'} eq 'root')
267 0 0 unless chown $self->uid, -1, $self->base_dir
270 0 0 if (mkdir $self->base_dir . '/tmp')
271 0 0 if ($self->uid)
272 0 0 unless chown $self->uid, -1, $self->base_dir . '/tmp'
277 0 0 if (not -d $self->base_dir . '/data')
278 0 0 unless pipe my $rfh, my $wfh
281 0 0 unless defined $pid
283 0 0 if ($pid == 0)
285 0 0 unless open STDOUT, '>&', $wfh
287 0 0 unless open STDERR, '>&', $wfh
289 0 0 unless chdir $self->base_dir
291 0 0 if (defined $self->uid)
292 0 0 unless setuid($self->uid)
312 0 0 if $? != 0
325 0 45 if -x "$sp/bin/$prog"
326 0 45 if -x "$sp/$prog"