| 1 | # Licensed to the Apache Software Foundation (ASF) under one or more | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2 | # contributor license agreements. See the NOTICE file distributed with | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3 | # this work for additional information regarding copyright ownership. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4 | # The ASF licenses this file to You under the Apache License, Version 2.0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 5 | # (the "License"); you may not use this file except in compliance with | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 6 | # the License. You may obtain a copy of the License at | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 7 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 8 | # http://www.apache.org/licenses/LICENSE-2.0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 9 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 10 | # Unless required by applicable law or agreed to in writing, software | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 11 | # distributed under the License is distributed on an "AS IS" BASIS, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 13 | # See the License for the specific language governing permissions and | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 14 | # limitations under the License. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 15 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 16 | package Apache::TestRun; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 17 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 18 | 1 | ▶ | use strict; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 19 | 1 | ▶ | use warnings FATAL => 'all'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 20 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 21 | 1 | ▶ | use Apache::Test (); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 22 | 1 | ▶ | use Apache::TestMM (); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 23 | 1 | ▶ | use Apache::TestConfig (); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 24 | 1 | ▶ | use Apache::TestConfigC (); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 25 | 1 | ▶ | use Apache::TestRequest (); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 26 | 1 | ▶ | use Apache::TestHarness (); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 27 | 1 | ▶ | use Apache::TestTrace; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 28 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 29 | 1 | ▶ | use Cwd; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 30 | 1 | ▶ | use ExtUtils::MakeMaker; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 31 | 1 | ▶ | use File::Find qw(finddepth); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 32 | 1 | ▶ | use File::Path; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 33 | 1 | ▶ | use File::Spec::Functions qw(catfile catdir canonpath); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 34 | 1 | ▶ | use File::Basename qw(basename dirname); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 35 | 1 | ▶ | use Getopt::Long qw(GetOptions); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 36 | 1 | ▶ | use Config; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 37 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 38 | 1 | ▶ | use constant IS_APACHE_TEST_BUILD => Apache::TestConfig::IS_APACHE_TEST_BUILD; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 39 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 40 | 1 | ▶ | use constant STARTUP_TIMEOUT => 300; # secs (good for extreme debug cases) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 41 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 42 | 1 | ▶ | use subs qw(exit_shell exit_perl); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 43 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 44 | 1 | my $orig_command; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 45 | my $orig_cwd; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 46 | 1 | my $orig_conf_opts; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 47 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 48 | 1 | my %core_files = (); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 49 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 50 | 1 | my @std_run = qw(start-httpd run-tests stop-httpd); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 51 | 1 | my @others = qw(verbose configure clean help ssl http11 bugreport | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 52 | save no-httpd one-process); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 53 | 1 | my @flag_opts = (@std_run, @others); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 54 | 1 | my @string_opts = qw(order trace); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 55 | 1 | my @ostring_opts = qw(proxy ping); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 56 | 1 | my @debug_opts = qw(debug); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 57 | 1 | my @list_opts = qw(preamble postamble breakpoint); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 58 | 1 | my @hash_opts = qw(header); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 59 | 1 | my @help_opts = qw(clean help); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 60 | 1 | my @request_opts = qw(get post head); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 61 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 62 | 1 | my @exit_opts_no_need_httpd = (@help_opts); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 63 | 1 | my @exit_opts_need_httpd = (@debug_opts, qw(ping)); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 64 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 65 | my %usage = ( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 66 | 'start-httpd' => 'start the test server', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 67 | 'run-tests' => 'run the tests', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 68 | 'order=mode' => 'run the tests in one of the modes: ' . | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 69 | '(repeat|random|SEED)', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 70 | 'stop-httpd' => 'stop the test server', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 71 | 'no-httpd' => 'run the tests without configuring or starting httpd', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 72 | 'verbose[=1]' => 'verbose output', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 73 | 'configure' => 'force regeneration of httpd.conf ' . | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 74 | ' (tests will not be run)', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 75 | 'clean' => 'remove all generated test files', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 76 | 'help' => 'display this message', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 77 | 'bugreport' => 'print the hint how to report problems', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 78 | 'preamble' => 'config to add at the beginning of httpd.conf', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 79 | 'postamble' => 'config to add at the end of httpd.conf', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 80 | 'ping[=block]' => 'test if server is running or port in use', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 81 | 'debug[=name]' => 'start server under debugger name (gdb, ddd, etc.)', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 82 | 'breakpoint=bp' => 'set breakpoints (multiply bp can be set)', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 83 | 'header' => "add headers to (" . | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 84 | join('|', @request_opts) . ") request", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 85 | 'http11' => 'run all tests with HTTP/1.1 (keep alive) requests', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 86 | 'ssl' => 'run tests through ssl', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 87 | 'proxy' => 'proxy requests (default proxy is localhost)', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 88 | 'trace=T' => 'change tracing default to: warning, notice, ' . | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 89 | 'info, debug, ...', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 90 | 'one-process' => 'run the server in single process mode', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 91 | 1 | (map { $_, "\U$_\E url" } @request_opts), | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 92 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 93 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 94 | 2 | ▶ | sub fixup { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
fixup: called CC=2 SCAR=7.6
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 95 | #make sure we use an absolute path to perl | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 96 | #else Test::Harness uses the perl in our PATH | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 97 | #which might not be the one we want | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 98 | 2 | ▶ | $^X = $Config{perlpath} unless -e $^X; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 99 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 100 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 101 | # if the test suite was aborted because of a user-error we don't want | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 102 | # to call the bugreport and invite users to submit a bug report - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 103 | # after all it's a user error. but we still want the program to fail, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 104 | # so raise this flag in such a case. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 105 | 1 | my $user_error = 0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 106 | 1 | ▶ | sub user_error { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
user_error: called CC=2 SCAR=7.1
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 107 | 1 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 108 | 1 | ▶ | $user_error = shift if @_; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 109 | 1 | $user_error; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 110 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 111 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 112 | 2 | ▶ | sub new { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
new: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 113 | 2 | my $class = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 114 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 115 | 2 | my $self = bless { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 116 | tests => [], | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 117 | @_, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 118 | }, $class; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 119 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 120 | 2 | $self->fixup; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 121 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 122 | 2 | $self; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 123 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 124 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 125 | #split arguments into test files/dirs and options | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 126 | #take extra care if -e, the file matches /\.t$/ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 127 | # if -d, the dir contains .t files | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 128 | #so we dont slurp arguments that are not tests, example: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 129 | # httpd $HOME/apache-2.0/bin/httpd | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 130 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 131 | 0 | ▶ | sub split_test_args { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
split_test_args: not called CC=10 SCAR=47.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 132 | 0 | my($self) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 133 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 134 | 0 | my(@tests); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 135 | 0 | my $top_dir = $self->{test_config}->{vars}->{top_dir}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 136 | 0 | my $t_dir = $self->{test_config}->{vars}->{t_dir}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 137 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 138 | 0 | my $argv = $self->{argv}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 139 | 0 | my @leftovers = (); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 140 | 0 | for (@$argv) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 141 | 0 | my $arg = $_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 142 | # need the t/ (or t\) for stat-ing, but don't want to include | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 143 | # it in test output | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 144 | 0 | $arg =~ s@^(?:\.[\\/])?t[\\/]@@; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 145 | 0 | my $file = catfile $t_dir, $arg; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 146 | 0 | ▶ | if (-d $file and $_ ne '/') { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
-d $file and $_ ne "/"
MC/DC0%0/2
-d $file and $_ ne "/"
-d $file
$_ ne "/"
Truth table0%0/3
A and B
A= -d $fileB= $_ ne "/"
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 147 | 0 | my @files = <$file/*.t>; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 148 | 0 | my $remove = catfile $top_dir, ""; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 149 | 0 | ▶ | if (@files) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 150 | 0 | push @tests, map { s,^\Q$remove,,; $_ } @files; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 151 | 0 | next; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 152 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 153 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 154 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 155 | 0 | ▶ | if ($file =~ /\.t$/ and -e $file) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 3 branches
Condition0%0/3
$file =~ /\.t$/ and -e $file
MC/DC0%0/2
$file =~ /\.t$/ and -e $file
$file =~ /\.t$/
-e $file
Truth table0%0/3
A and B
A= $file =~ /\.t$/B= -e $file
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 156 | 0 | push @tests, "t/$arg"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 157 | 0 | next; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 158 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 159 | elsif (-e "$file.t") { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 160 | 0 | push @tests, "t/$arg.t"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 161 | 0 | next; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 162 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 163 | elsif (/^[\d.]+$/) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 164 | 0 | my @t = $_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 165 | #support range of subtests: t/TEST t/foo/bar 60..65 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 166 | 0 | ▶ | if (/^(\d+)\.\.(\d+)$/) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 167 | 0 | @t = $1..$2; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 168 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 169 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 170 | 0 | push @{ $self->{subtests} }, @t; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 171 | 0 | next; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 172 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 173 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 174 | 0 | push @leftovers, $_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 175 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 176 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 177 | 0 | $self->{tests} = [ map { canonpath($_) } @tests ]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 178 | 0 | $self->{argv} = \@leftovers; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 179 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 180 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 181 | 0 | ▶ | sub die_on_invalid_args { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
die_on_invalid_args: not called CC=2 SCAR=17.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 182 | 0 | my($self) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 183 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 184 | # at this stage $self->{argv} should be empty | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 185 | 0 | my @invalid_argv = @{ $self->{argv} }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 186 | 0 | ▶ | if (@invalid_argv) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 187 | 0 | error "unknown opts or test names: @invalid_argv\n" . | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 188 | "-help will list options\n"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 189 | 0 | exit_perl 0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 190 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 191 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 192 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 193 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 194 | 1 | ▶ | sub passenv { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
passenv: called CC=3 SCAR=11.1
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 195 | 1 | my $passenv = Apache::TestConfig->passenv; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 196 | 1 | for (keys %$passenv) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 197 | 5 | ▶ | return 1 if $ENV{$_}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 198 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 199 | 1 | 0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 200 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 201 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 202 | 1 | ▶ | sub getopts { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
getopts: called CC=21 SCAR=44.7
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 203 | 1 | my($self, $argv) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 204 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 205 | 1 | local *ARGV = $argv; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 206 | 1 | my(%opts, %vopts, %conf_opts); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 207 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 208 | # a workaround to support -verbose and -verbose=0|1 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 209 | # $Getopt::Long::VERSION > 2.26 can use the "verbose:1" rule | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 210 | # but we have to support older versions as well | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 211 | @ARGV = grep defined, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 212 | 1 | ▶ | map {/-verbose=(\d)/ ? ($1 ? '-verbose' : undef) : $_ } @ARGV; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 213 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 214 | # permute : optional values can come before the options | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 215 | # pass_through : all unknown things are to be left in @ARGV | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 216 | 1 | Getopt::Long::Configure(qw(pass_through permute)); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 217 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 218 | # grab from @ARGV only the options that we expect | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 219 | GetOptions(\%opts, @flag_opts, @help_opts, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 220 | (map "$_:s", @debug_opts, @request_opts, @ostring_opts), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 221 | (map "$_=s", @string_opts), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 222 | 3 | ▶ | (map { ("$_=s", $vopts{$_} ||= []) } @list_opts), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$vopts{$_} ||= []
MC/DC0%0/1
$vopts{$_} ||= []
$vopts{$_}
Truth table50%1/2
A
A= $vopts{$_}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 223 | 1 | ▶ | (map { ("$_=s", $vopts{$_} ||= {}) } @hash_opts)); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$vopts{$_} ||= {}
MC/DC0%0/1
$vopts{$_} ||= {}
$vopts{$_}
Truth table50%1/2
A
A= $vopts{$_}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 224 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 225 | 1 | $opts{$_} = $vopts{$_} for keys %vopts; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 226 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 227 | # separate configuration options and test files/dirs | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 228 | 1 | my $req_wanted_args = Apache::TestRequest::wanted_args(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 229 | 1 | my @argv = (); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 230 | 1 | my %req_args = (); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 231 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 232 | 1 | ▶ | while (@ARGV) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 233 | 0 | my $val = shift @ARGV; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 234 | 0 | ▶ | if ($val =~ /^--?(.+)/) { # must have a leading - or -- | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 235 | 0 | my $key = lc $1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 236 | # a known config option? | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 237 | 0 | ▶ | if (exists $Apache::TestConfig::Usage{$key}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 238 | 0 | $conf_opts{$key} = shift @ARGV; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 239 | 0 | next; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 240 | } # a TestRequest config option? | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 241 | elsif (exists $req_wanted_args->{$key}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 242 | 0 | $req_args{$key} = shift @ARGV; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 243 | 0 | next; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 244 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 245 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 246 | # to be processed later | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 247 | 0 | push @argv, $val; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 248 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 249 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 250 | # save the orig args (make a deep copy) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 251 | 1 | $orig_conf_opts = { %conf_opts }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 252 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 253 | # fixup the filepath options on win32 (spaces, short names, etc.) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 254 | 1 | if (Apache::TestConfig::WIN32) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 255 | for my $key (keys %conf_opts) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 256 | next unless Apache::TestConfig::conf_opt_is_a_filepath($key); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 257 | next unless -e $conf_opts{$key}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 258 | $conf_opts{$key} = Win32::GetShortPathName($conf_opts{$key}); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 259 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 260 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 261 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 262 | 1 | $opts{req_args} = \%req_args; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 263 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 264 | # only test files/dirs if any at all are left in argv | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 265 | 1 | $self->{argv} = \@argv; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 266 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 267 | # force regeneration of httpd.conf if commandline args want to | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 268 | # modify it. configure_opts() has more checks to decide whether to | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 269 | # reconfigure or not. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 270 | # XXX: $self->passenv() is already tested in need_reconfiguration() | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 271 | $self->{reconfigure} = $opts{configure} || | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 272 | 2 | (grep { $opts{$_}->[0] } qw(preamble postamble)) || | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 273 | 0 | ▶ | (grep { $Apache::TestConfig::Usage{$_} } keys %conf_opts ) || | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition33%4/12
$opts{'configure'} || grep({$opts{$_}[0];} 'preamble', 'postamble') || grep({$Apache::TestConfig::Usage{$_};} keys %conf_opts) || $self->passenv || !(-e 't/conf/httpd.conf')
$opts{"configure"} or grep {$opts{$_}[0];} "preamble", "postamble" or grep {$Apache::TestConfig::Usage{$_};} keys %conf_opts or $self->passenv
$opts{"configure"} or grep {$opts{$_}[0];} "preamble", "postamble" or grep {$Apache::TestConfig::Usage{$_};} keys %conf_opts
$opts{"configure"} or grep {$opts{$_}[0];} "preamble", "postamble"
MC/DC0%0/5
$opts{'configure'} || grep({$opts{$_}[0];} 'preamble', 'postamble') || grep({$Apache::TestConfig::Usage{$_};} keys %conf_opts) || $self->passenv || !(-e 't/conf/httpd.conf')
$opts{"configure"}
grep {$opts{$_}[0];} "preamble", "postamble"
grep {$Apache::TestConfig::Usage{$_};} keys %conf_opts
$self->passenv
!(-e 't/conf/httpd.conf')
Truth table16%1/6
A or B or C or D || not(E)
A= $opts{"configure"}B= grep {$opts{$_}[0];} "preamble", "postamble"C= grep {$Apache::TestConfig::Usage{$_};} keys %conf_optsD= $self->passenvE= !(-e 't/conf/httpd.conf')
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 274 | $self->passenv() || (! -e 't/conf/httpd.conf'); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 275 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 276 | 1 | ▶ | if (exists $opts{debug}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 277 | 0 | $opts{debugger} = $opts{debug}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 278 | 0 | $opts{debug} = 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 279 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 280 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 281 | 1 | ▶ | if ($opts{trace}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 282 | 0 | my %levels = map {$_ => 1} @Apache::TestTrace::Levels; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 283 | 0 | ▶ | if (exists $levels{ $opts{trace} }) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 284 | 0 | $Apache::TestTrace::Level = $opts{trace}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 285 | # propogate the override for the server-side. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 286 | # -trace overrides any previous APACHE_TEST_TRACE_LEVEL settings | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 287 | 0 | $ENV{APACHE_TEST_TRACE_LEVEL} = $opts{trace}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 288 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 289 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 290 | 0 | error "unknown trace level: $opts{trace}", | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 291 | "valid levels are: @Apache::TestTrace::Levels"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 292 | 0 | exit_perl 0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 293 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 294 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 295 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 296 | # breakpoint automatically turns the debug mode on | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 297 | 1 | ▶ | if (@{ $opts{breakpoint} }) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 298 | 0 | ▶ | $opts{debug} ||= 1; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/2
$opts{"debug"} ||= 1
MC/DC0%0/1
$opts{"debug"} ||= 1
$opts{"debug"}
Truth table0%0/2
A
A= $opts{"debug"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 299 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 300 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 301 | 1 | ▶ | if ($self->{reconfigure}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 302 | 1 | $conf_opts{save} = 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 303 | 1 | delete $self->{reconfigure}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 304 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 305 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 306 | 0 | $conf_opts{thaw} = 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 307 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 308 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 309 | #propagate some values | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 310 | 1 | for (qw(verbose)) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 311 | 1 | $conf_opts{$_} = $opts{$_}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 312 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 313 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 314 | 1 | $self->{opts} = \%opts; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 315 | 1 | $self->{conf_opts} = \%conf_opts; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 316 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 317 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 318 | 0 | ▶ | sub default_run_opts { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
default_run_opts: not called CC=6 SCAR=37.4
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 319 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 320 | 0 | my($opts, $tests) = ($self->{opts}, $self->{tests}); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 321 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 322 | 0 | ▶ | unless (grep { exists $opts->{$_} } @std_run, @request_opts) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 323 | 0 | ▶ | if (@$tests && $self->{server}->ping) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
@$tests and $self->{"server"}->ping
MC/DC0%0/2
@$tests and $self->{"server"}->ping
@$tests
$self->{"server"}->ping
Truth table0%0/3
A and B
A= @$testsB= $self->{"server"}->ping
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 324 | # if certain tests are specified and server is running, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 325 | # dont restart | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 326 | 0 | $opts->{'run-tests'} = 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 327 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 328 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 329 | #default is start-server run-tests stop-server | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 330 | 0 | $opts->{$_} = 1 for @std_run; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 331 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 332 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 333 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 334 | 0 | ▶ | $opts->{'run-tests'} ||= @$tests; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/3
$opts->{"run-tests"} ||= @$tests
MC/DC0%0/2
$opts->{"run-tests"} ||= @$tests
$opts->{"run-tests"}
@$tests
Truth table0%0/3
A ||= B
A= $opts->{"run-tests"}B= @$tests
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 335 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 336 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 337 | 1 | my $parent_pid = $$; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 338 | 1 | ▶ | sub is_parent { $$ == $parent_pid } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
is_parent: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 339 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 340 | 1 | my $caught_sig_int = 0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 341 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 342 | 1 | ▶ | sub install_sighandlers { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
install_sighandlers: called CC=2 SCAR=12.3
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 343 | 1 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 344 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 345 | 1 | my($server, $opts) = ($self->{server}, $self->{opts}); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 346 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 347 | 1 | ▶ | $SIG{__DIE__} = sub { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=5 SCAR=30.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 348 | 1 | ▶ | return unless $_[0] =~ /^Failed/i; #dont catch Test::ok failures | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 349 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 350 | # _show_results() calls die() under a few conditions, such as | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 351 | # when no tests are run or when tests fail. make sure the message | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 352 | # is propagated back to the user. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 353 | 0 | ▶ | print $_[0] if (caller(1))[3]||'' eq 'Test::Harness::_show_results'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/2
(caller 1)[3] or
MC/DC0%0/1
(caller 1)[3] or
(caller 1)[3]
Truth table0%0/2
A
A= (caller 1)[3]
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 354 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 355 | 0 | ▶ | $server->stop(1) if $opts->{'start-httpd'}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 356 | 0 | $server->failed_msg("error running tests"); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 357 | 0 | exit_perl 0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 358 | 1 | }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 359 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 360 | 0 | ▶ | $SIG{INT} = sub { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=3 SCAR=24.8
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 361 | 0 | ▶ | if ($caught_sig_int++) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 362 | 0 | warning "\ncaught SIGINT"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 363 | 0 | exit_perl 0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 364 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 365 | 0 | warning "\nhalting tests"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 366 | 0 | ▶ | $server->stop if $opts->{'start-httpd'}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 367 | 0 | exit_perl 0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 368 | 1 | }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 369 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 370 | #try to make sure we scan for core no matter what happens | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 371 | #must eval "" to "install" this END block, otherwise it will | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 372 | #always run, a subclass might not want that | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 373 | 1 | eval 'END { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 374 | return unless is_parent(); # because of fork | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 375 | $self ||= | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 376 | Apache::TestRun->new(test_config => Apache::TestConfig->thaw); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 377 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 378 | local $?; # preserve the exit status | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 379 | eval { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 380 | $self->scan_core; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 381 | }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 382 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 383 | $self->try_bug_report(); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 384 | }'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 385 | 1 | ▶ | die "failed: $@" if $@; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 386 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 387 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 388 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 389 | 1 | ▶ | sub try_bug_report { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
try_bug_report: called CC=5 SCAR=22.7
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 390 | 1 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 391 | 1 | ▶ | if ($? && !$self->user_error && | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%3/9
$? and not $self->user_error and $self->{"opts"}{"bugreport"} and $self->can("bug_report")
$? and not $self->user_error and $self->{"opts"}{"bugreport"}
$? and not $self->user_error
MC/DC0%0/4
$? and not $self->user_error and $self->{"opts"}{"bugreport"} and $self->can("bug_report")
$?
not $self->user_error
$self->{"opts"}{"bugreport"}
$self->can("bug_report")
Truth table20%1/5
A and not(B) and C and D
A= $?B= not $self->user_errorC= $self->{"opts"}{"bugreport"}D= $self->can("bug_report")
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 392 | $self->{opts}->{bugreport} && $self->can('bug_report')) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 393 | 0 | $self->bug_report; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 394 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 395 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 396 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 397 | #throw away cached config and start fresh | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 398 | 0 | ▶ | sub refresh { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
refresh: not called CC=2 SCAR=17.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 399 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 400 | 0 | $self->opt_clean(1); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 401 | 0 | ▶ | $self->{conf_opts}->{save} = delete $self->{conf_opts}->{thaw} || 1; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/2
delete $self->{'conf_opts'}{'thaw'} || 1
MC/DC0%0/1
delete $self->{'conf_opts'}{'thaw'} || 1
delete $self->{'conf_opts'}{'thaw'}
Truth table0%0/2
A
A= delete $self->{'conf_opts'}{'thaw'}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 402 | 0 | $self->{test_config} = $self->new_test_config()->httpd_config; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 403 | 0 | $self->{test_config}->{server}->{run} = $self; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 404 | 0 | $self->{server} = $self->{test_config}->server; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 405 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 406 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 407 | 0 | ▶ | sub configure_opts { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
configure_opts: not called CC=16 SCAR=56.1
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 408 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 409 | 0 | my $save = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 410 | 0 | my $refreshed = 0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 411 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 412 | 0 | my($test_config, $opts) = ($self->{test_config}, $self->{opts}); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 413 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 414 | $test_config->{vars}->{scheme} = | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 415 | $opts->{ssl} ? 'https' : | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 416 | 0 | ▶ | $self->{conf_opts}->{scheme} || 'http'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/2
$self->{"conf_opts"}{"scheme"} or "http"
MC/DC0%0/1
$self->{"conf_opts"}{"scheme"} or "http"
$self->{"conf_opts"}{"scheme"}
Truth table0%0/2
A
A= $self->{"conf_opts"}{"scheme"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 417 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 418 | 0 | ▶ | if ($opts->{http11}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 419 | 0 | $ENV{APACHE_TEST_HTTP11} = 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 420 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 421 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 422 | # unless we are already reconfiguring, check for .conf.in files changes | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 423 | 0 | ▶ | if (!$$save && | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
not $$save and my(@reasons) = $self->{"test_config"}->need_reconfiguration($self->{"conf_opts"})
MC/DC0%0/2
not $$save and my(@reasons) = $self->{"test_config"}->need_reconfiguration($self->{"conf_opts"})
not $$save
my(@reasons) = $self->{"test_config"}->need_reconfiguration($self->{"conf_opts"})
Truth table0%0/3
not(A) and B
A= not $$saveB= my(@reasons) = $self->{"test_config"}->need_reconfiguration($self->{"conf_opts"})
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 424 | (my @reasons = | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 425 | $self->{test_config}->need_reconfiguration($self->{conf_opts}))) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 426 | 0 | warning "forcing re-configuration:"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 427 | 0 | warning "\t- $_." for @reasons; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 428 | 0 | ▶ | unless ($refreshed) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 429 | 0 | $self->refresh; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 430 | 0 | $refreshed = 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 431 | 0 | $test_config = $self->{test_config}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 432 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 433 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 434 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 435 | # unless we are already reconfiguring, check for -proxy | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 436 | 0 | ▶ | if (!$$save && exists $opts->{proxy}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
not $$save and exists $opts->{"proxy"}
MC/DC0%0/2
not $$save and exists $opts->{"proxy"}
not $$save
exists $opts->{"proxy"}
Truth table0%0/3
not(A) and B
A= not $$saveB= exists $opts->{"proxy"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 437 | 0 | my $max = $test_config->{vars}->{maxclients}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 438 | 0 | ▶ | $opts->{proxy} ||= 'on'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/2
$opts->{"proxy"} ||= "on"
MC/DC0%0/1
$opts->{"proxy"} ||= "on"
$opts->{"proxy"}
Truth table0%0/2
A
A= $opts->{"proxy"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 439 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 440 | #if config is cached and MaxClients == 1, must reconfigure | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 441 | 0 | ▶ | if (!$$save and $opts->{proxy} eq 'on' and $max == 1) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/6
not $$save and $opts->{"proxy"} eq "on" and $max == 1
not $$save and $opts->{"proxy"} eq "on"
MC/DC0%0/3
not $$save and $opts->{"proxy"} eq "on" and $max == 1
not $$save
$opts->{"proxy"} eq "on"
$max == 1
Truth table0%0/4
not(A) and B and C
A= not $$saveB= $opts->{"proxy"} eq "on"C= $max == 1
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 442 | 0 | $$save = 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 443 | 0 | warning "server is reconfigured for proxy"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 444 | 0 | ▶ | unless ($refreshed) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 445 | 0 | $self->refresh; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 446 | 0 | $refreshed = 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 447 | 0 | $test_config = $self->{test_config}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 448 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 449 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 450 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 451 | 0 | $test_config->{vars}->{proxy} = $opts->{proxy}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 452 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 453 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 454 | 0 | $test_config->{vars}->{proxy} = 'off'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 455 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 456 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 457 | 0 | ▶ | return unless $$save; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 458 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 459 | 0 | ▶ | my $preamble = sub { shift->preamble($opts->{preamble}) }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 460 | 0 | ▶ | my $postamble = sub { shift->postamble($opts->{postamble}) }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 461 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 462 | 0 | $test_config->preamble_register($preamble); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 463 | 0 | $test_config->postamble_register($postamble); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 464 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 465 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 466 | 1 | ▶ | sub pre_configure { } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
pre_configure: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 467 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 468 | 0 | ▶ | sub configure { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
configure: not called CC=5 SCAR=34.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 469 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 470 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 471 | 0 | ▶ | if ($self->{opts}->{'no-httpd'}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 472 | 0 | warning "skipping httpd configuration"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 473 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 474 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 475 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 476 | # create the conf dir as early as possible | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 477 | 0 | $self->{test_config}->prepare_t_conf(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 478 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 479 | 0 | my $save = \$self->{conf_opts}->{save}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 480 | 0 | $self->configure_opts($save); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 481 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 482 | 0 | my $config = $self->{test_config}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 483 | 0 | ▶ | unless ($$save) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 484 | 0 | my $addr = \$config->{vars}->{remote_addr}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 485 | 0 | my $remote_addr = $config->our_remote_addr; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 486 | 0 | ▶ | unless ($$addr eq $remote_addr) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 487 | 0 | warning "local ip address has changed, updating config cache"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 488 | 0 | $$addr = $remote_addr; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 489 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 490 | #update minor changes to cached config | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 491 | #without complete regeneration | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 492 | #for example this allows switching between | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 493 | #'t/TEST' and 't/TEST -ssl' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 494 | 0 | $config->sync_vars(qw(scheme proxy remote_addr)); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 495 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 496 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 497 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 498 | 0 | my $test_config = $self->{test_config}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 499 | 0 | $test_config->sslca_generate; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 500 | 0 | ▶ | $test_config->generate_ssl_conf if $self->{opts}->{ssl}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 501 | 0 | $test_config->cmodules_configure; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 502 | 0 | $test_config->generate_httpd_conf; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 503 | 0 | $test_config->save; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 504 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 505 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 506 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 507 | 1 | ▶ | sub try_exit_opts { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
try_exit_opts: called CC=8 SCAR=35.6
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 508 | 1 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 509 | 1 | my @opts = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 510 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 511 | 1 | for (@opts) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 512 | 1 | ▶ | next unless exists $self->{opts}->{$_}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 513 | 1 | my $method = "opt_$_"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 514 | 1 | my $rc = $self->$method(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 515 | 0 | ▶ | exit_perl $rc if $rc; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 516 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 517 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 518 | 0 | ▶ | if ($self->{opts}->{'stop-httpd'}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 519 | 0 | my $ok = 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 520 | 0 | ▶ | if ($self->{server}->ping) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 521 | 0 | $ok = $self->{server}->stop; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 522 | 0 | ▶ | $ok = $ok < 0 ? 0 : 1; # adjust to 0/1 logic | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 523 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 524 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 525 | 0 | warning "server $self->{server}->{name} is not running"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 526 | # cleanup a stale pid file if found | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 527 | 0 | my $pid_file = $self->{test_config}->{vars}->{t_pid_file}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 528 | 0 | ▶ | unlink $pid_file if -e $pid_file; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 529 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 530 | 0 | exit_perl $ok; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 531 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 532 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 533 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 534 | 0 | ▶ | sub start { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
start: not called CC=11 SCAR=48.8
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 535 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 536 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 537 | 0 | my $opts = $self->{opts}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 538 | 0 | my $server = $self->{server}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 539 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 540 | #if t/TEST -d is running make sure we don't try to stop/start the server | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 541 | 0 | my $file = $server->debugger_file; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 542 | 0 | ▶ | if (-e $file and $opts->{'start-httpd'}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
-e $file and $opts->{"start-httpd"}
MC/DC0%0/2
-e $file and $opts->{"start-httpd"}
-e $file
$opts->{"start-httpd"}
Truth table0%0/3
A and B
A= -e $fileB= $opts->{"start-httpd"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 543 | 0 | ▶ | if ($server->ping) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 544 | 0 | warning "server is running under the debugger, " . | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 545 | "defaulting to -run"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 546 | 0 | $opts->{'start-httpd'} = $opts->{'stop-httpd'} = 0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 547 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 548 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 549 | 0 | warning "removing stale debugger note: $file"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 550 | 0 | unlink $file; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 551 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 552 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 553 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 554 | 0 | $self->check_runtime_user(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 555 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 556 | 0 | ▶ | if ($opts->{'start-httpd'}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 557 | 0 | ▶ | exit_perl 0 unless $server->start; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 558 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 559 | elsif ($opts->{'run-tests'}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 560 | my $is_up = $server->ping | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 561 | || (exists $self->{opts}->{ping} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 562 | 0 | ▶ | && $self->{opts}->{ping} eq 'block' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/9
$server->ping || exists $self->{'opts'}{'ping'} && $self->{'opts'}{'ping'} eq 'block' && $server->wait_till_is_up(300)
exists $self->{"opts"}{"ping"} and $self->{"opts"}{"ping"} eq "block" and $server->wait_till_is_up(300)
exists $self->{"opts"}{"ping"} and $self->{"opts"}{"ping"} eq "block"
MC/DC0%0/4
$server->ping || exists $self->{'opts'}{'ping'} && $self->{'opts'}{'ping'} eq 'block' && $server->wait_till_is_up(300)
$server->ping
exists $self->{"opts"}{"ping"}
$self->{"opts"}{"ping"} eq "block"
$server->wait_till_is_up(300)
Truth table0%0/5
A || B and C and D
A= $server->pingB= exists $self->{"opts"}{"ping"}C= $self->{"opts"}{"ping"} eq "block"D= $server->wait_till_is_up(300)
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 563 | && $server->wait_till_is_up(STARTUP_TIMEOUT)); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 564 | 0 | ▶ | unless ($is_up) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 565 | 0 | error "server is not ready yet, try again."; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 566 | 0 | exit_perl 0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 567 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 568 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 569 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 570 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 571 | 0 | ▶ | sub run_tests { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
run_tests: not called CC=4 SCAR=30.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 572 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 573 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 574 | my $test_opts = { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 575 | verbose => $self->{opts}->{verbose}, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 576 | tests => $self->{tests}, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 577 | order => $self->{opts}->{order}, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 578 | 0 | ▶ | subtests => $self->{subtests} || [], | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/2
$self->{'subtests'} || []
MC/DC0%0/1
$self->{'subtests'} || []
$self->{'subtests'}
Truth table0%0/2
A
A= $self->{'subtests'}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 579 | }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 580 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 581 | 0 | ▶ | if (grep { exists $self->{opts}->{$_} } @request_opts) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 582 | 0 | run_request($self->{test_config}, $self->{opts}); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 583 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 584 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 585 | Apache::TestHarness->run($test_opts) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 586 | 0 | ▶ | if $self->{opts}->{'run-tests'}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 587 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 588 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 589 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 590 | 0 | ▶ | sub stop { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
stop: not called CC=2 SCAR=17.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 591 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 592 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 593 | 0 | ▶ | return $self->{server}->stop if $self->{opts}->{'stop-httpd'}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 594 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 595 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 596 | 1 | ▶ | sub new_test_config { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
new_test_config: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 597 | 1 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 598 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 599 | 1 | Apache::TestConfig->new($self->{conf_opts}); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 600 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 601 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 602 | 1 | ▶ | sub set_ulimit_via_sh { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
set_ulimit_via_sh: called CC=7 SCAR=22.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 603 | 1 | return if Apache::TestConfig::WINFU; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 604 | 1 | ▶ | return if $ENV{APACHE_TEST_ULIMIT_SET}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 605 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 606 | # only root can allow unlimited core dumps on Solaris (8 && 9?) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 607 | 1 | if (Apache::TestConfig::SOLARIS) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 608 | my $user = getpwuid($>) || ''; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 609 | if ($user ne 'root') { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 610 | warning "Skipping 'set unlimited ulimit for coredumps', " . | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 611 | "since we are running as a non-root user on Solaris"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 612 | return; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 613 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 614 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 615 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 616 | 1 | my $binsh = '/bin/sh'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 617 | 1 | ▶ | return unless -e $binsh; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 618 | 1 | $ENV{APACHE_TEST_ULIMIT_SET} = 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 619 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 620 | 1 | my $sh = Symbol::gensym(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 621 | 1 | ▶ | open $sh, "echo ulimit -a | $binsh|" or die; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 622 | 1 | local $_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 623 | 1 | ▶ | while (<$sh>) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 624 | 5 | ▶ | if (/^core.*unlimited$/) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 625 | #already set to unlimited | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 626 | 1 | $ENV{APACHE_TEST_ULIMIT_SET} = 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 627 | 1 | return; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 628 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 629 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 630 | 0 | close $sh; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 631 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 632 | 0 | $orig_command = "ulimit -c unlimited; $orig_command"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 633 | 0 | warning "setting ulimit to allow core files\n$orig_command"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 634 | # use 'or die' to avoid warnings due to possible overrides of die | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 635 | 0 | ▶ | exec $orig_command or die "exec $orig_command has failed"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 636 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 637 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 638 | 1 | ▶ | sub set_ulimit { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
set_ulimit: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 639 | 1 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 640 | #return if $self->set_ulimit_via_bsd_resource; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 641 | 1 | eval { $self->set_ulimit_via_sh }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 642 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 643 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 644 | 1 | ▶ | sub set_env { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
set_env: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 645 | #export some environment variables for t/modules/env.t | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 646 | #(the values are unimportant) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 647 | 1 | $ENV{APACHE_TEST_HOSTNAME} = 'test.host.name'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 648 | 1 | $ENV{APACHE_TEST_HOSTTYPE} = 'z80'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 649 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 650 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 651 | 1 | ▶ | sub run { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
run: called CC=12 SCAR=38.5
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 652 | 1 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 653 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 654 | # assuming that test files are always in the same directory as the | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 655 | # driving script, make it possible to run the test suite from any place | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 656 | # use a full path, which will work after chdir (e.g. ./TEST) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 657 | 1 | $0 = File::Spec->rel2abs($0); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 658 | 1 | ▶ | if (-e $0) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 659 | 1 | my $top = dirname dirname $0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 660 | 1 | ▶ | chdir $top if $top and -d $top; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$top and -d $top
MC/DC0%0/2
$top and -d $top
$top
-d $top
Truth table33%1/3
A and B
A= $topB= -d $top
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 661 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 662 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 663 | # reconstruct argv, preserve multiwords args, eg 'PerlTrace all' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 664 | 1 | ▶ | my $argv = join " ", map { /^-/ ? $_ : qq['$_'] } @ARGV; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 665 | 1 | $orig_command = "$^X $0 $argv"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 666 | 1 | $orig_cwd = Cwd::cwd(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 667 | 1 | $self->set_ulimit; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 668 | 1 | $self->set_env; #make sure these are always set | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 669 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 670 | 1 | $self->detect_relocation($orig_cwd); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 671 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 672 | 1 | my(@argv) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 673 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 674 | 1 | $self->getopts(\@argv); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 675 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 676 | 1 | $self->pre_configure(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 677 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 678 | # can't setup the httpd-specific parts of the config object yet | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 679 | 1 | $self->{test_config} = $self->new_test_config(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 680 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 681 | 1 | $self->warn_core(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 682 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 683 | # give TestServer access to our runtime configuration directives | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 684 | # so we can tell the server stuff if we need to | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 685 | 1 | $self->{test_config}->{server}->{run} = $self; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 686 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 687 | 1 | $self->{server} = $self->{test_config}->server; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 688 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 689 | 1 | local($SIG{__DIE__}, $SIG{INT}); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 690 | 1 | $self->install_sighandlers; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 691 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 692 | 1 | $self->try_exit_opts(@exit_opts_no_need_httpd); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 693 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 694 | # httpd is found here (unless it was already configured before) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 695 | 0 | $self->{test_config}->httpd_config(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 696 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 697 | 0 | $self->try_exit_opts(@exit_opts_need_httpd); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 698 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 699 | 0 | ▶ | if ($self->{opts}->{configure}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 700 | 0 | warning "cleaning out current configuration"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 701 | 0 | $self->opt_clean(1); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 702 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 703 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 704 | 0 | $self->split_test_args; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 705 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 706 | 0 | $self->die_on_invalid_args; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 707 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 708 | 0 | $self->default_run_opts; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 709 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 710 | # if configure() fails for some reason before it has flushed the | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 711 | # config to a file, save it so -clean will be able to clean | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 712 | 0 | ▶ | if ($self->{opts}->{'start-httpd'} || $self->{opts}->{'configure'}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$self->{"opts"}{"start-httpd"} or $self->{"opts"}{"configure"}
MC/DC0%0/2
$self->{"opts"}{"start-httpd"} or $self->{"opts"}{"configure"}
$self->{"opts"}{"start-httpd"}
$self->{"opts"}{"configure"}
Truth table0%0/3
A or B
A= $self->{"opts"}{"start-httpd"}B= $self->{"opts"}{"configure"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 713 | 0 | eval { $self->configure }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 714 | 0 | ▶ | if ($@) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 715 | 0 | error "configure() has failed:\n$@"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 716 | 0 | warning "forcing Apache::TestConfig object save"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 717 | 0 | $self->{test_config}->save; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 718 | 0 | warning "run 't/TEST -clean' to clean up before continuing"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 719 | 0 | exit_perl 0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 720 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 721 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 722 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 723 | 0 | ▶ | if ($self->{opts}->{configure}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 724 | 0 | warning "reconfiguration done"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 725 | 0 | exit_perl 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 726 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 727 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 728 | 0 | ▶ | $self->start unless $self->{opts}->{'no-httpd'}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 729 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 730 | 0 | $self->run_tests; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 731 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 732 | 0 | ▶ | $self->stop unless $self->{opts}->{'no-httpd'}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 733 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 734 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 735 | 0 | ▶ | sub rerun { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
rerun: not called CC=7 SCAR=40.3
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 736 | 0 | my $vars = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 737 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 738 | # in %$vars | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 739 | # - httpd will be always set | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 740 | # - apxs is optional | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 741 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 742 | 0 | ▶ | $orig_cwd ||= Cwd::cwd(); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/3
$orig_cwd ||= Cwd::cwd()
MC/DC0%0/2
$orig_cwd ||= Cwd::cwd()
$orig_cwd
Cwd::cwd()
Truth table0%0/3
A ||= B
A= $orig_cwdB= Cwd::cwd()
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 743 | 0 | chdir $orig_cwd; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 744 | 0 | my $new_opts = " -httpd $vars->{httpd}"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 745 | 0 | ▶ | $new_opts .= " -apxs $vars->{apxs}" if $vars->{apxs}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 746 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 747 | 0 | my $new_command = $orig_command; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 748 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 749 | # strip any old bogus -httpd/-apxs | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 750 | $new_command =~ s/--?httpd\s+$orig_conf_opts->{httpd}// | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 751 | 0 | ▶ | if $orig_conf_opts->{httpd}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 752 | $new_command =~ s/--?httpd\s+$orig_conf_opts->{httpd}// | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 753 | 0 | ▶ | if $orig_conf_opts->{httpd} and $vars->{apxs}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$orig_conf_opts->{"httpd"} and $vars->{"apxs"}
MC/DC0%0/2
$orig_conf_opts->{"httpd"} and $vars->{"apxs"}
$orig_conf_opts->{"httpd"}
$vars->{"apxs"}
Truth table0%0/3
A and B
A= $orig_conf_opts->{"httpd"}B= $vars->{"apxs"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 754 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 755 | # add new opts | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 756 | 0 | $new_command .= $new_opts; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 757 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 758 | 0 | warning "running with new config opts: $new_command"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 759 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 760 | # use 'or die' to avoid warnings due to possible overrides of die | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 761 | 0 | ▶ | exec $new_command or die "exec $new_command has failed"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 762 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 763 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 764 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 765 | # make it easy to move the whole distro w/o running | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 766 | # 't/TEST -clean' before moving. when moving the whole package, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 767 | # the old cached config will stay, so we want to nuke it only if | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 768 | # we realize that it's no longer valid. we can't just check the | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 769 | # existance of the saved top_dir value, since the project may have | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 770 | # been copied and the old dir could be still there, but that's not | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 771 | # the one that we work in | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 772 | 1 | ▶ | sub detect_relocation { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
detect_relocation: called CC=6 SCAR=34.1
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 773 | 1 | my($self, $cur_top_dir) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 774 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 775 | 1 | my $config_file = catfile qw(t conf apache_test_config.pm); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 776 | 1 | ▶ | return unless -e $config_file; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 777 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 778 | 0 | my %inc = %INC; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 779 | 0 | eval { require "./$config_file" }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 780 | 0 | %INC = %inc; # be stealth | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 781 | 0 | ▶ | warn($@), return if $@; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 782 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 783 | 0 | my $cfg = 'apache_test_config'->new; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 784 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 785 | # if the top_dir from saved config doesn't match the current | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 786 | # top_dir, that means that the whole project was relocated to a | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 787 | # different directory, w/o running t/TEST -clean first (in each | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 788 | # directory with a test suite) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 789 | 0 | my $cfg_top_dir = $cfg->{vars}->{top_dir}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 790 | 0 | ▶ | return unless $cfg_top_dir; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 791 | 0 | ▶ | return if $cfg_top_dir eq $cur_top_dir; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 792 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 793 | # if that's the case silently fixup the saved config to use the | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 794 | # new paths, and force a complete cleanup. if we don't fixup the | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 795 | # config files, the cleanup process won't be able to locate files | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 796 | # to delete and re-configuration will fail | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 797 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 798 | # in place editing | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 799 | 0 | local @ARGV = $config_file; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 800 | 0 | local $^I = ".bak"; # Win32 needs a backup | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 801 | 0 | ▶ | while (<>) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 802 | 0 | s{$cfg_top_dir}{$cur_top_dir}g; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 803 | 0 | print; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 804 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 805 | 0 | unlink $config_file . $^I; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 806 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 807 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 808 | 0 | my $cleanup_cmd = "$^X $0 -clean"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 809 | 0 | warning "cleaning up the old config"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 810 | # XXX: do we care to check success? | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 811 | 0 | system $cleanup_cmd; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 812 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 813 | # XXX: I tried hard to accomplish that w/o starting a new process, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 814 | # but too many things get on the way, so for now just keep it as an | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 815 | # external process, as it's absolutely transparent to the normal | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 816 | # app-run | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 817 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 818 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 819 | 1 | my @oh = qw(jeez golly gosh darn shucks dangit rats nuts dangnabit crap); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 820 | 0 | ▶ | sub oh { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
oh: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 821 | 0 | $oh[ rand scalar @oh ]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 822 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 823 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 824 | #e.g. t/core or t/core.12499 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 825 | 1 | my $core_pat = '^core(\.\d+)?' . "\$"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 826 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 827 | # $self->scan_core_incremental([$only_top_dir]) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 828 | # normally would be called after each test | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 829 | # and since it updates the list of seen core files | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 830 | # scan_core() won't report these again | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 831 | # currently used in Apache::TestSmoke | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 832 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 833 | # if $only_t_dir arg is true only the t_dir dir (t/) will be scanned | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 834 | 0 | ▶ | sub scan_core_incremental { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
scan_core_incremental: not called CC=8 SCAR=42.8
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 835 | 0 | my($self, $only_t_dir) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 836 | 0 | my $vars = $self->{test_config}->{vars}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 837 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 838 | # no core files dropped on win32 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 839 | 0 | return () if Apache::TestConfig::WIN32; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 840 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 841 | 0 | ▶ | if ($only_t_dir) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 842 | 0 | require IO::Dir; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 843 | 0 | my @cores = (); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 844 | 0 | for (IO::Dir->new($vars->{t_dir})->read) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 845 | 0 | my $file = catfile $vars->{t_dir}, $_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 846 | 0 | ▶ | next unless -f $file; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 847 | 0 | ▶ | next unless /$core_pat/o; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 848 | next if exists $core_files{$file} && | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 849 | 0 | ▶ | $core_files{$file} == -M $file; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
exists $core_files{$file} and $core_files{$file} == -M $file
MC/DC0%0/2
exists $core_files{$file} and $core_files{$file} == -M $file
exists $core_files{$file}
$core_files{$file} == -M $file
Truth table0%0/3
A and B
A= exists $core_files{$file}B= $core_files{$file} == -M $file
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 850 | 0 | $core_files{$file} = -M $file; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 851 | 0 | push @cores, $file; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 852 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 853 | return @cores | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 854 | ? join "\n", "server dumped core, for stacktrace, run:", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 855 | 0 | ▶ | map { "gdb $vars->{httpd} -core $_" } @cores | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 856 | : (); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 857 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 858 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 859 | 0 | my @msg = (); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 860 | finddepth({ no_chdir => 1, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 861 | 0 | ▶ | wanted => sub { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=5 SCAR=34.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 862 | 0 | ▶ | return unless -f $_; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 863 | 0 | my $file = basename $File::Find::name; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 864 | 0 | ▶ | return unless $file =~ /$core_pat/o; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 865 | 0 | my $core = $File::Find::name; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 866 | 0 | ▶ | unless (exists $core_files{$core} && $core_files{$core} == -M $core) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
exists $core_files{$core} and $core_files{$core} == -M $core
MC/DC0%0/2
exists $core_files{$core} and $core_files{$core} == -M $core
exists $core_files{$core}
$core_files{$core} == -M $core
Truth table0%0/3
A and B
A= exists $core_files{$core}B= $core_files{$core} == -M $core
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 867 | # new core file! | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 868 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 869 | # XXX: could rename the file if it doesn't include the pid | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 870 | # in its name (i.e., just called 'core', instead of 'core.365') | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 871 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 872 | # XXX: could pass the test name and rename the core file | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 873 | # to use that name as a suffix, plus pid, time or some | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 874 | # other unique identifier, in case the same test is run | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 875 | # more than once and each time it caused a segfault | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 876 | 0 | $core_files{$core} = -M $core; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 877 | 0 | push @msg, "server dumped core, for stacktrace, run:\n" . | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 878 | "gdb $vars->{httpd} -core $core"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 879 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 880 | 0 | }}, $vars->{top_dir}); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 881 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 882 | 0 | return @msg; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 883 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 884 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 885 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 886 | 2 | ▶ | sub scan_core { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
scan_core: called CC=1 SCAR=1.8
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 887 | 2 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 888 | 2 | my $vars = $self->{test_config}->{vars}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 889 | 2 | my $times = 0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 890 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 891 | # no core files dropped on win32 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 892 | 2 | return if Apache::TestConfig::WIN32; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 893 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 894 | finddepth({ no_chdir => 1, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 895 | 294 | ▶ | wanted => sub { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=6 SCAR=29.5
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 896 | 294 | ▶ | return unless -f $_; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 897 | 238 | my $file = basename $File::Find::name; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 898 | 238 | ▶ | return unless $file =~ /$core_pat/o; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 899 | 0 | my $core = $File::Find::name; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 900 | 0 | ▶ | if (exists $core_files{$core} && $core_files{$core} == -M $core) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
exists $core_files{$core} and $core_files{$core} == -M $core
MC/DC0%0/2
exists $core_files{$core} and $core_files{$core} == -M $core
exists $core_files{$core}
$core_files{$core} == -M $core
Truth table0%0/3
A and B
A= exists $core_files{$core}B= $core_files{$core} == -M $core
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 901 | # we have seen this core file before the start of the test | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 902 | 0 | info "an old core file has been found: $core"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 903 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 904 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 905 | 0 | my $oh = oh(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 906 | 0 | ▶ | my $again = $times++ ? "again" : ""; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 907 | 0 | error "oh $oh, server dumped core $again"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 908 | 0 | error "for stacktrace, run: gdb $vars->{httpd} -core $core"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 909 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 910 | 2 | }}, $vars->{top_dir}); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 911 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 912 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 913 | # warn the user that there is a core file before the tests | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 914 | # start. suggest to delete it before proceeding or a false alarm can | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 915 | # be generated at the end of the test routine run. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 916 | 1 | ▶ | sub warn_core { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
warn_core: called CC=1 SCAR=0.2
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 917 | 1 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 918 | 1 | my $vars = $self->{test_config}->{vars}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 919 | 1 | %core_files = (); # reset global | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 920 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 921 | # no core files dropped on win32 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 922 | 1 | return if Apache::TestConfig::WIN32; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 923 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 924 | 147 | ▶ | finddepth(sub { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=3 SCAR=13.3
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 925 | 147 | ▶ | return unless -f $_; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 926 | 119 | ▶ | return unless /$core_pat/o; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 927 | 0 | my $core = "$File::Find::dir/$_"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 928 | 0 | info "consider removing an old $core file before running tests"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 929 | # remember the timestamp of $core so we can check if it's the | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 930 | # old core file at the end of the run and not complain then | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 931 | 0 | $core_files{$core} = -M $core; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 932 | 1 | }, $vars->{top_dir}); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 933 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 934 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 935 | # catch any attempts to ./t/TEST the tests as root user | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 936 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 937 | 0 | ▶ | sub check_runtime_user { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
check_runtime_user: not called CC=3 SCAR=24.8
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 938 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 939 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 940 | 0 | return if Apache::TestConfig::WINFU; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 941 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 942 | 0 | ▶ | my $user = getpwuid($>) || ''; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/2
getpwuid $> || ''
MC/DC0%0/1
getpwuid $> || ''
getpwuid $>
Truth table0%0/2
A
A= getpwuid $>
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 943 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 944 | 0 | ▶ | if ($user eq 'root') { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 945 | 0 | error "Apache cannot spawn child processes as root, therefore the test suite must be run as a non-privileged user."; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 946 | 0 | exit_perl(1); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 947 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 948 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 949 | 0 | return 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 950 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 951 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 952 | 0 | ▶ | sub run_request { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
run_request: not called CC=6 SCAR=37.4
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 953 | 0 | my($test_config, $opts) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 954 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 955 | 0 | my @args = (%{ $opts->{header} }, %{ $opts->{req_args} }); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 956 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 957 | 0 | my($request, $url) = ("", ""); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 958 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 959 | 0 | for (@request_opts) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 960 | 0 | ▶ | next unless exists $opts->{$_}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 961 | 0 | ▶ | $url = $opts->{$_} if $opts->{$_}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 962 | 0 | ▶ | $request = join $request ? '_' : '', $request, $_; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 963 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 964 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 965 | 0 | ▶ | if ($request) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 966 | 0 | my $method = \&{"Apache::TestRequest::\U$request"}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 967 | 0 | my $res = $method->($url, @args); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 968 | 0 | print Apache::TestRequest::to_string($res); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 969 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 970 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 971 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 972 | 1 | ▶ | sub opt_clean { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
opt_clean: called CC=1 SCAR=0.6
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 973 | 1 | my($self, $level) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 974 | 1 | my $test_config = $self->{test_config}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 975 | 1 | $test_config->server->stop; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 976 | 0 | $test_config->clean($level); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 977 | 0 | 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 978 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 979 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 980 | 0 | ▶ | sub opt_ping { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
opt_ping: not called CC=5 SCAR=34.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 981 | 0 | my($self) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 982 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 983 | 0 | my $test_config = $self->{test_config}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 984 | 0 | my $server = $test_config->server; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 985 | 0 | my $pid = $server->ping; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 986 | 0 | my $name = $server->{name}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 987 | # support t/TEST -ping=block -run ... | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 988 | 0 | my $exit = not $self->{opts}->{'run-tests'}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 989 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 990 | 0 | ▶ | if ($pid) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 991 | 0 | ▶ | if ($pid == -1) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 992 | 0 | error "port $test_config->{vars}->{port} is in use, ". | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 993 | "but cannot determine server pid"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 994 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 995 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 996 | 0 | my $version = $server->{version}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 997 | 0 | warning "server $name running (pid=$pid, version=$version)"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 998 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 999 | 0 | return $exit; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1000 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1001 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1002 | 0 | ▶ | if (exists $self->{opts}->{ping} && $self->{opts}->{ping} eq 'block') { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
exists $self->{"opts"}{"ping"} and $self->{"opts"}{"ping"} eq "block"
MC/DC0%0/2
exists $self->{"opts"}{"ping"} and $self->{"opts"}{"ping"} eq "block"
exists $self->{"opts"}{"ping"}
$self->{"opts"}{"ping"} eq "block"
Truth table0%0/3
A and B
A= exists $self->{"opts"}{"ping"}B= $self->{"opts"}{"ping"} eq "block"
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1003 | 0 | $server->wait_till_is_up(STARTUP_TIMEOUT); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1004 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1005 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1006 | 0 | warning "no server is running on $name"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1007 | 0 | exit_perl(0); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1008 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1009 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1010 | 0 | return $exit; #means call exit() if true | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1011 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1012 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1013 | 0 | ▶ | sub test_inc { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
test_inc: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1014 | 0 | map { "$_/Apache-Test/lib" } qw(. ..); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1015 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1016 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1017 | 0 | ▶ | sub set_perl5lib { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
set_perl5lib: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1018 | 0 | $ENV{PERL5LIB} = join $Config{path_sep}, shift->test_inc(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1019 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1020 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1021 | 0 | ▶ | sub set_perldb_opts { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
set_perldb_opts: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1022 | 0 | my $config = shift->{test_config}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1023 | 0 | my $file = catfile $config->{vars}->{t_logs}, 'perldb.out'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1024 | 0 | $config->genfile($file); #mark for -clean | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1025 | 0 | $ENV{PERLDB_OPTS} = "NonStop frame=4 AutoTrace LineInfo=$file"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1026 | 0 | warning "perldb log is t/logs/perldb.out"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1027 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1028 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1029 | 0 | ▶ | sub opt_debug { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
opt_debug: not called CC=7 SCAR=40.3
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1030 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1031 | 0 | my $server = $self->{server}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1032 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1033 | 0 | my $opts = $self->{opts}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1034 | 0 | my $debug_opts = {}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1035 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1036 | 0 | for (qw(debugger breakpoint)) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1037 | 0 | $debug_opts->{$_} = $opts->{$_}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1038 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1039 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1040 | 0 | ▶ | if (my $db = $opts->{debugger}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1041 | 0 | ▶ | if ($db =~ s/^perl=?//) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1042 | 0 | $opts->{'run-tests'} = 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1043 | 0 | $self->start; #if not already running | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1044 | 0 | $self->set_perl5lib; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1045 | 0 | ▶ | $self->set_perldb_opts if $db eq 'nostop'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1046 | 0 | system $^X, '-MApache::TestPerlDB', '-d', @{ $self->{tests} }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1047 | 0 | $self->stop; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1048 | 0 | return 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1049 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1050 | elsif ($db =~ s/^lwp[=:]?//) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1051 | 0 | ▶ | $ENV{APACHE_TEST_DEBUG_LWP} = $db || 1; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/2
$db || 1
MC/DC0%0/1
$db || 1
$db
Truth table0%0/2
A
A= $db
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1052 | 0 | $opts->{verbose} = 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1053 | 0 | return 0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1054 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1055 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1056 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1057 | 0 | $server->stop; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1058 | 0 | $server->start_debugger($debug_opts); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1059 | 0 | 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1060 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1061 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1062 | 0 | ▶ | sub opt_help { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
opt_help: not called CC=2 SCAR=17.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1063 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1064 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1065 | 0 | print <<EOM; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1066 | usage: TEST [options ...] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1067 | where options include: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1068 | EOM | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1069 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1070 | 0 | for (sort keys %usage){ | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1071 | 0 | printf " -%-13s %s\n", $_, $usage{$_}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1072 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1073 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1074 | 0 | print "\n configuration options:\n"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1075 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1076 | 0 | Apache::TestConfig->usage; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1077 | 0 | 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1078 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1079 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1080 | # generate t/TEST script (or a different filename) which will drive | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1081 | # Apache::TestRun | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1082 | 0 | ▶ | sub generate_script { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
generate_script: not called CC=5 SCAR=34.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1083 | 0 | my ($class, @opts) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1084 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1085 | 0 | my %opts = (); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1086 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1087 | # back-compat | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1088 | 0 | ▶ | if (@opts == 1) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1089 | 0 | $opts{file} = $opts[0]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1090 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1091 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1092 | 0 | %opts = @opts; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1093 | 0 | ▶ | $opts{file} ||= catfile 't', 'TEST'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/3
$opts{"file"} ||= catfile("t", "TEST")
MC/DC0%0/2
$opts{"file"} ||= catfile("t", "TEST")
$opts{"file"}
catfile("t", "TEST")
Truth table0%0/3
A ||= B
A= $opts{"file"}B= catfile("t", "TEST")
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1094 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1095 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1096 | 0 | my $body = "BEGIN { eval { require blib && blib->import; } }\n"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1097 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1098 | 0 | my %args = @Apache::TestMM::Argv; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1099 | 0 | ▶ | while (my($k, $v) = each %args) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1100 | 0 | $v =~ s/\|/\\|/g; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1101 | 0 | $body .= "\n\$Apache::TestConfig::Argv{'$k'} = q|$v|;\n"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1102 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1103 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1104 | 0 | my $header = Apache::TestConfig->perlscript_header; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1105 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1106 | 0 | $body .= join "\n", | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1107 | $header, "use $class ();"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1108 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1109 | 0 | ▶ | if (my $report = $opts{bugreport}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1110 | 0 | $body .= "\n\npackage $class;\n" . | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1111 | "sub bug_report { print '$report' }\n\n"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1112 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1113 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1114 | 0 | $body .= "$class->new->run(\@ARGV);"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1115 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1116 | Apache::Test::basic_config()->write_perlscript($opts{file}, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1117 | 0 | $body); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1118 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1119 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1120 | # in idiomatic perl functions return 1 on success and 0 on | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1121 | # failure. Shell expects the opposite behavior. So this function | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1122 | # reverses the status. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1123 | 0 | ▶ | sub exit_perl { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
exit_perl: not called CC=2 SCAR=17.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1124 | 0 | ▶ | exit_shell $_[0] ? 0 : 1; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1125 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1126 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1127 | # expects shell's exit status values (0==success) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1128 | 0 | ▶ | sub exit_shell { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
exit_shell: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1129 | # require Carp; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1130 | # Carp::cluck('exiting'); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1131 | 0 | CORE::exit $_[0]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1132 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1133 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1134 | 1 | 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1135 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1136 | __END__ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||