| 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::TestSmoke; | ||||||||||||||||||||||||||||
| 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::TestConfig (); | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 23 | 1 | ▶ | use Apache::TestTrace; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 24 | |||||||||||||||||||||||||||||
| 25 | 1 | ▶ | use Apache::TestHarness (); | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 26 | 1 | ▶ | use Apache::TestRun (); # for core scan functions | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 27 | 1 | ▶ | use Apache::TestSort; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 28 | |||||||||||||||||||||||||||||
| 29 | 1 | ▶ | use Getopt::Long qw(GetOptions); | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 30 | 1 | ▶ | use File::Spec::Functions qw(catfile); | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 31 | 1 | ▶ | use FindBin; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 32 | 1 | ▶ | use POSIX (); | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 33 | 1 | ▶ | use Symbol (); | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 34 | |||||||||||||||||||||||||||||
| 35 | #use constant DEBUG => 1; | ||||||||||||||||||||||||||||
| 36 | |||||||||||||||||||||||||||||
| 37 | # how many times to run all tests at the first iteration | ||||||||||||||||||||||||||||
| 38 | 1 | ▶ | use constant DEFAULT_TIMES => 10; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 39 | |||||||||||||||||||||||||||||
| 40 | # if after this number of tries to reduce the number of tests fails we | ||||||||||||||||||||||||||||
| 41 | # give up on more tries | ||||||||||||||||||||||||||||
| 42 | 1 | ▶ | use constant MAX_REDUCTION_TRIES => 50; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 43 | |||||||||||||||||||||||||||||
| 44 | 1 | my @num_opts = qw(times); | |||||||||||||||||||||||||||
| 45 | 1 | my @string_opts = qw(order report); | |||||||||||||||||||||||||||
| 46 | 1 | my @flag_opts = qw(help verbose bug_mode); | |||||||||||||||||||||||||||
| 47 | |||||||||||||||||||||||||||||
| 48 | 1 | my %order = map {$_ => 1} qw(random repeat); | |||||||||||||||||||||||||||
| 49 | |||||||||||||||||||||||||||||
| 50 | 1 | my %usage = ( | |||||||||||||||||||||||||||
| 51 | 'times=N' => 'how many times to run the entire test suite' . | ||||||||||||||||||||||||||||
| 52 | ' (default: ' . DEFAULT_TIMES . ')', | ||||||||||||||||||||||||||||
| 53 | 'order=MODE' => 'modes: random, repeat' . | ||||||||||||||||||||||||||||
| 54 | ' (default: random)', | ||||||||||||||||||||||||||||
| 55 | 'report=FILENAME' => 'save report in a filename' . | ||||||||||||||||||||||||||||
| 56 | ' (default: smoke-report-<date>.txt)', | ||||||||||||||||||||||||||||
| 57 | 'verbose[=1]' => 'verbose output' . | ||||||||||||||||||||||||||||
| 58 | ' (default: 0)', | ||||||||||||||||||||||||||||
| 59 | 'bug_mode' => 'bug report mode' . | ||||||||||||||||||||||||||||
| 60 | ' (default: 0)', | ||||||||||||||||||||||||||||
| 61 | ); | ||||||||||||||||||||||||||||
| 62 | |||||||||||||||||||||||||||||
| 63 | 0 | ▶ | sub new { | ||||||||||||||||||||||||||
|
Subroutine
new: not called CC=9 SCAR=45.0
Pod
undocumented
| |||||||||||||||||||||||||||||
| 64 | 0 | my($class, @argv) = @_; | |||||||||||||||||||||||||||
| 65 | |||||||||||||||||||||||||||||
| 66 | 0 | ▶ | my $self = bless { | ||||||||||||||||||||||||||
|
Condition0%0/3
ref $class || $class
MC/DC0%0/2
ref $class || $class
ref $class
$class
Truth table0%0/3
A || B
A= ref $classB= $class
| |||||||||||||||||||||||||||||
| 67 | seen => {}, # seen sequences and tried them md5 hash | ||||||||||||||||||||||||||||
| 68 | results => {}, # final reduced sequences md5 hash | ||||||||||||||||||||||||||||
| 69 | smoking_completed => 0, | ||||||||||||||||||||||||||||
| 70 | tests => [], | ||||||||||||||||||||||||||||
| 71 | total_iterations => 0, | ||||||||||||||||||||||||||||
| 72 | total_reduction_attempts => 0, | ||||||||||||||||||||||||||||
| 73 | total_reduction_successes => 0, | ||||||||||||||||||||||||||||
| 74 | total_tests_run => 0, | ||||||||||||||||||||||||||||
| 75 | }, ref($class)||$class; | ||||||||||||||||||||||||||||
| 76 | |||||||||||||||||||||||||||||
| 77 | 0 | $self->{test_config} = Apache::TestConfig->thaw; | |||||||||||||||||||||||||||
| 78 | |||||||||||||||||||||||||||||
| 79 | 0 | $self->getopts(\@argv); | |||||||||||||||||||||||||||
| 80 | 0 | my $opts = $self->{opts}; | |||||||||||||||||||||||||||
| 81 | |||||||||||||||||||||||||||||
| 82 | 0 | chdir "$FindBin::Bin/.."; | |||||||||||||||||||||||||||
| 83 | 0 | ▶ | $self->{times} = $opts->{times} || DEFAULT_TIMES; | ||||||||||||||||||||||||||
|
Condition0%0/2
$opts->{'times'} || 10
MC/DC0%0/1
$opts->{'times'} || 10
$opts->{'times'}
Truth table0%0/2
A
A= $opts->{'times'}
| |||||||||||||||||||||||||||||
| 84 | 0 | ▶ | $self->{order} = $opts->{order} || 'random'; | ||||||||||||||||||||||||||
|
Condition0%0/2
$opts->{'order'} || 'random'
MC/DC0%0/1
$opts->{'order'} || 'random'
$opts->{'order'}
Truth table0%0/2
A
A= $opts->{'order'}
| |||||||||||||||||||||||||||||
| 85 | 0 | ▶ | $self->{verbose} = $opts->{verbose} || 0; | ||||||||||||||||||||||||||
|
Condition0%0/2
$opts->{'verbose'} || 0
MC/DC0%0/1
$opts->{'verbose'} || 0
$opts->{'verbose'}
Truth table0%0/2
A
A= $opts->{'verbose'}
| |||||||||||||||||||||||||||||
| 86 | |||||||||||||||||||||||||||||
| 87 | 0 | $self->{run_iter} = $self->{times}; | |||||||||||||||||||||||||||
| 88 | |||||||||||||||||||||||||||||
| 89 | # this is like 'make test' but produces an output to be used in | ||||||||||||||||||||||||||||
| 90 | # the bug report | ||||||||||||||||||||||||||||
| 91 | 0 | ▶ | if ($opts->{bug_mode}) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 92 | 0 | $self->{bug_mode} = 1; | |||||||||||||||||||||||||||
| 93 | 0 | $self->{run_iter} = 1; | |||||||||||||||||||||||||||
| 94 | 0 | $self->{times} = 1; | |||||||||||||||||||||||||||
| 95 | 0 | $self->{verbose} = 1; | |||||||||||||||||||||||||||
| 96 | 0 | $self->{order} = 'random'; | |||||||||||||||||||||||||||
| 97 | 0 | $self->{trace} = 'debug'; | |||||||||||||||||||||||||||
| 98 | } | ||||||||||||||||||||||||||||
| 99 | |||||||||||||||||||||||||||||
| 100 | # specific tests end up in $self->{tests} and $self->{subtests}; | ||||||||||||||||||||||||||||
| 101 | # and get removed from $self->{argv} | ||||||||||||||||||||||||||||
| 102 | 0 | $self->Apache::TestRun::split_test_args(); | |||||||||||||||||||||||||||
| 103 | |||||||||||||||||||||||||||||
| 104 | my $test_opts = { | ||||||||||||||||||||||||||||
| 105 | verbose => $self->{verbose}, | ||||||||||||||||||||||||||||
| 106 | tests => $self->{tests}, | ||||||||||||||||||||||||||||
| 107 | order => $self->{order}, | ||||||||||||||||||||||||||||
| 108 | 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'}
| |||||||||||||||||||||||||||||
| 109 | }; | ||||||||||||||||||||||||||||
| 110 | |||||||||||||||||||||||||||||
| 111 | 0 | @{ $self->{tests} } = $self->get_tests($test_opts); | |||||||||||||||||||||||||||
| 112 | |||||||||||||||||||||||||||||
| 113 | 0 | $self->{base_command} = "$^X $FindBin::Bin/TEST"; | |||||||||||||||||||||||||||
| 114 | |||||||||||||||||||||||||||||
| 115 | # options common to all | ||||||||||||||||||||||||||||
| 116 | 0 | ▶ | $self->{base_command} .= " -verbose" if $self->{verbose}; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 117 | |||||||||||||||||||||||||||||
| 118 | # options specific to the startup | ||||||||||||||||||||||||||||
| 119 | 0 | $self->{start_command} = "$self->{base_command} -start"; | |||||||||||||||||||||||||||
| 120 | 0 | ▶ | $self->{start_command} .= " -trace=" . $self->{trace} if $self->{trace}; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 121 | |||||||||||||||||||||||||||||
| 122 | # options specific to the run | ||||||||||||||||||||||||||||
| 123 | 0 | $self->{run_command} = "$self->{base_command} -run"; | |||||||||||||||||||||||||||
| 124 | |||||||||||||||||||||||||||||
| 125 | # options specific to the stop | ||||||||||||||||||||||||||||
| 126 | 0 | $self->{stop_command} = "$self->{base_command} -stop"; | |||||||||||||||||||||||||||
| 127 | |||||||||||||||||||||||||||||
| 128 | 0 | $self; | |||||||||||||||||||||||||||
| 129 | } | ||||||||||||||||||||||||||||
| 130 | |||||||||||||||||||||||||||||
| 131 | 0 | ▶ | sub getopts { | ||||||||||||||||||||||||||
|
Subroutine
getopts: not called CC=4 SCAR=30.0
Pod
undocumented
| |||||||||||||||||||||||||||||
| 132 | 0 | my($self, $argv) = @_; | |||||||||||||||||||||||||||
| 133 | 0 | my %opts; | |||||||||||||||||||||||||||
| 134 | 0 | local *ARGV = $argv; | |||||||||||||||||||||||||||
| 135 | |||||||||||||||||||||||||||||
| 136 | # permute : optional values can come before the options | ||||||||||||||||||||||||||||
| 137 | # pass_through : all unknown things are to be left in @ARGV | ||||||||||||||||||||||||||||
| 138 | 0 | Getopt::Long::Configure(qw(pass_through permute)); | |||||||||||||||||||||||||||
| 139 | |||||||||||||||||||||||||||||
| 140 | # grab from @ARGV only the options that we expect | ||||||||||||||||||||||||||||
| 141 | 0 | GetOptions(\%opts, @flag_opts, | |||||||||||||||||||||||||||
| 142 | (map "$_=s", @string_opts), | ||||||||||||||||||||||||||||
| 143 | (map "$_=i", @num_opts)); | ||||||||||||||||||||||||||||
| 144 | |||||||||||||||||||||||||||||
| 145 | 0 | ▶ | if (exists $opts{order} && !exists $order{$opts{order}}) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
exists $opts{"order"} and not exists $order{$opts{"order"}}
MC/DC0%0/2
exists $opts{"order"} and not exists $order{$opts{"order"}}
exists $opts{"order"}
not exists $order{$opts{"order"}}
Truth table0%0/3
A and not(B)
A= exists $opts{"order"}B= not exists $order{$opts{"order"}}
| |||||||||||||||||||||||||||||
| 146 | 0 | error "unknown -order mode: $opts{order}"; | |||||||||||||||||||||||||||
| 147 | 0 | $self->opt_help(); | |||||||||||||||||||||||||||
| 148 | 0 | exit; | |||||||||||||||||||||||||||
| 149 | } | ||||||||||||||||||||||||||||
| 150 | |||||||||||||||||||||||||||||
| 151 | 0 | ▶ | if ($opts{help}) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 152 | 0 | $self->opt_help; | |||||||||||||||||||||||||||
| 153 | 0 | exit; | |||||||||||||||||||||||||||
| 154 | } | ||||||||||||||||||||||||||||
| 155 | |||||||||||||||||||||||||||||
| 156 | # min | ||||||||||||||||||||||||||||
| 157 | 0 | $self->{opts} = \%opts; | |||||||||||||||||||||||||||
| 158 | |||||||||||||||||||||||||||||
| 159 | 0 | $self->{argv} = [@ARGV]; | |||||||||||||||||||||||||||
| 160 | } | ||||||||||||||||||||||||||||
| 161 | |||||||||||||||||||||||||||||
| 162 | # XXX: need proper sub-classing | ||||||||||||||||||||||||||||
| 163 | # from Apache::TestHarness | ||||||||||||||||||||||||||||
| 164 | 0 | ▶ | sub skip { Apache::TestHarness::skip(@_); } | ||||||||||||||||||||||||||
|
Subroutine
skip: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||
| 165 | 0 | ▶ | sub prune { Apache::TestHarness::prune(@_); } | ||||||||||||||||||||||||||
|
Subroutine
prune: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||
| 166 | 0 | ▶ | sub get_tests { Apache::TestHarness::get_tests(@_);} | ||||||||||||||||||||||||||
|
Subroutine
get_tests: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||
| 167 | |||||||||||||||||||||||||||||
| 168 | 0 | ▶ | sub install_sighandlers { | ||||||||||||||||||||||||||
|
Subroutine
install_sighandlers: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||
| 169 | 0 | my $self = shift; | |||||||||||||||||||||||||||
| 170 | |||||||||||||||||||||||||||||
| 171 | 0 | ▶ | $SIG{INT} = sub { | ||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||
| 172 | # make sure that there the server is down | ||||||||||||||||||||||||||||
| 173 | 0 | $self->kill_proc(); | |||||||||||||||||||||||||||
| 174 | |||||||||||||||||||||||||||||
| 175 | 0 | $self->report_finish; | |||||||||||||||||||||||||||
| 176 | 0 | exit; | |||||||||||||||||||||||||||
| 177 | 0 | }; | |||||||||||||||||||||||||||
| 178 | } | ||||||||||||||||||||||||||||
| 179 | |||||||||||||||||||||||||||||
| 180 | 1 | ▶ | END { | ||||||||||||||||||||||||||
|
Subroutine
END: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 181 | 1 | local $?; # preserve the exit status | |||||||||||||||||||||||||||
| 182 | 1 | eval { | |||||||||||||||||||||||||||
| 183 | 1 | Apache::TestRun->new(test_config => | |||||||||||||||||||||||||||
| 184 | Apache::TestConfig->thaw)->scan_core; | ||||||||||||||||||||||||||||
| 185 | }; | ||||||||||||||||||||||||||||
| 186 | } | ||||||||||||||||||||||||||||
| 187 | |||||||||||||||||||||||||||||
| 188 | 0 | ▶ | sub run { | ||||||||||||||||||||||||||
|
Subroutine
run: not called CC=4 SCAR=30.0
Pod
undocumented
| |||||||||||||||||||||||||||||
| 189 | 0 | my($self) = shift; | |||||||||||||||||||||||||||
| 190 | |||||||||||||||||||||||||||||
| 191 | 0 | $self->Apache::TestRun::warn_core(); | |||||||||||||||||||||||||||
| 192 | 0 | local $SIG{INT}; | |||||||||||||||||||||||||||
| 193 | 0 | $self->install_sighandlers; | |||||||||||||||||||||||||||
| 194 | |||||||||||||||||||||||||||||
| 195 | 0 | $self->report_start(); | |||||||||||||||||||||||||||
| 196 | |||||||||||||||||||||||||||||
| 197 | 0 | ▶ | if ($self->{bug_mode}) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 198 | # 'make test', but useful for bug reports | ||||||||||||||||||||||||||||
| 199 | 0 | $self->run_bug_mode(); | |||||||||||||||||||||||||||
| 200 | } | ||||||||||||||||||||||||||||
| 201 | else { | ||||||||||||||||||||||||||||
| 202 | # normal smoke | ||||||||||||||||||||||||||||
| 203 | 0 | my $iter = 0; | |||||||||||||||||||||||||||
| 204 | 0 | ▶ | while ($iter++ < $self->{run_iter}) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 205 | 0 | my $last = $self->run_iter($iter); | |||||||||||||||||||||||||||
| 206 | 0 | ▶ | last if $last; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 207 | } | ||||||||||||||||||||||||||||
| 208 | } | ||||||||||||||||||||||||||||
| 209 | 0 | $self->{smoking_completed} = 1; | |||||||||||||||||||||||||||
| 210 | 0 | $self->report_finish(); | |||||||||||||||||||||||||||
| 211 | 0 | exit; | |||||||||||||||||||||||||||
| 212 | } | ||||||||||||||||||||||||||||
| 213 | |||||||||||||||||||||||||||||
| 214 | 0 | ▶ | sub sep { | ||||||||||||||||||||||||||
|
Subroutine
sep: not called CC=3 SCAR=24.8
Pod
undocumented
| |||||||||||||||||||||||||||||
| 215 | 0 | my($char, $title) = @_; | |||||||||||||||||||||||||||
| 216 | 0 | my $width = 60; | |||||||||||||||||||||||||||
| 217 | 0 | ▶ | if ($title) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 218 | 0 | my $side = int( ($width - length($title) - 2) / 2); | |||||||||||||||||||||||||||
| 219 | 0 | ▶ | my $pad = ($side+1) * 2 + length($title) < $width ? 1 : 0; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 220 | 0 | return $char x $side . " $title " . $char x ($side+$pad); | |||||||||||||||||||||||||||
| 221 | } | ||||||||||||||||||||||||||||
| 222 | else { | ||||||||||||||||||||||||||||
| 223 | 0 | return $char x $width; | |||||||||||||||||||||||||||
| 224 | } | ||||||||||||||||||||||||||||
| 225 | } | ||||||||||||||||||||||||||||
| 226 | |||||||||||||||||||||||||||||
| 227 | 1 | my %log_files = (); | |||||||||||||||||||||||||||
| 228 | 1 | ▶ | use constant FH => 0; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 229 | 1 | ▶ | use constant POS => 1; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 230 | 0 | ▶ | sub logs_init { | ||||||||||||||||||||||||||
|
Subroutine
logs_init: not called CC=3 SCAR=24.8
Pod
undocumented
| |||||||||||||||||||||||||||||
| 231 | 0 | my($self, @log_files) = @_; | |||||||||||||||||||||||||||
| 232 | |||||||||||||||||||||||||||||
| 233 | 0 | for my $path (@log_files) { | |||||||||||||||||||||||||||
| 234 | 0 | my $fh = Symbol::gensym(); | |||||||||||||||||||||||||||
| 235 | 0 | ▶ | open $fh, "<$path" or die "Can't open $path: $!"; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 236 | 0 | seek $fh, 0, POSIX::SEEK_END(); | |||||||||||||||||||||||||||
| 237 | 0 | $log_files{$path}[FH] = $fh; | |||||||||||||||||||||||||||
| 238 | 0 | $log_files{$path}[POS] = tell $fh; | |||||||||||||||||||||||||||
| 239 | } | ||||||||||||||||||||||||||||
| 240 | } | ||||||||||||||||||||||||||||
| 241 | |||||||||||||||||||||||||||||
| 242 | 0 | ▶ | sub logs_end { | ||||||||||||||||||||||||||
|
Subroutine
logs_end: not called CC=2 SCAR=17.9
Pod
undocumented
| |||||||||||||||||||||||||||||
| 243 | 0 | for my $path (keys %log_files) { | |||||||||||||||||||||||||||
| 244 | 0 | close $log_files{$path}[FH]; | |||||||||||||||||||||||||||
| 245 | } | ||||||||||||||||||||||||||||
| 246 | } | ||||||||||||||||||||||||||||
| 247 | |||||||||||||||||||||||||||||
| 248 | 0 | ▶ | sub log_diff { | ||||||||||||||||||||||||||
|
Subroutine
log_diff: not called CC=4 SCAR=30.0
Pod
undocumented
| |||||||||||||||||||||||||||||
| 249 | 0 | my($self, $path) = @_; | |||||||||||||||||||||||||||
| 250 | |||||||||||||||||||||||||||||
| 251 | 0 | my $log = $log_files{$path}; | |||||||||||||||||||||||||||
| 252 | 0 | ▶ | die "no such log file: $path" unless $log; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 253 | |||||||||||||||||||||||||||||
| 254 | 0 | my $fh = $log->[FH]; | |||||||||||||||||||||||||||
| 255 | # no checkpoints were made yet? | ||||||||||||||||||||||||||||
| 256 | 0 | ▶ | unless (defined $log->[POS]) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 257 | 0 | seek $fh, 0, POSIX::SEEK_END(); | |||||||||||||||||||||||||||
| 258 | 0 | $log->[POS] = tell $fh; | |||||||||||||||||||||||||||
| 259 | 0 | return ''; | |||||||||||||||||||||||||||
| 260 | } | ||||||||||||||||||||||||||||
| 261 | |||||||||||||||||||||||||||||
| 262 | 0 | seek $fh, $log->[POS], POSIX::SEEK_SET(); # not really needed | |||||||||||||||||||||||||||
| 263 | 0 | local $/; # slurp mode | |||||||||||||||||||||||||||
| 264 | 0 | my $diff = <$fh>; | |||||||||||||||||||||||||||
| 265 | 0 | seek $fh, 0, POSIX::SEEK_END(); # not really needed | |||||||||||||||||||||||||||
| 266 | 0 | $log->[POS] = tell $fh; | |||||||||||||||||||||||||||
| 267 | |||||||||||||||||||||||||||||
| 268 | 0 | ▶ | return $diff || ''; | ||||||||||||||||||||||||||
|
Condition0%0/2
$diff || ''
MC/DC0%0/1
$diff || ''
$diff
Truth table0%0/2
A
A= $diff
| |||||||||||||||||||||||||||||
| 269 | } | ||||||||||||||||||||||||||||
| 270 | |||||||||||||||||||||||||||||
| 271 | # this is a special mode, which really just runs 't/TEST -start; | ||||||||||||||||||||||||||||
| 272 | # t/TEST -run; t/TEST -stop;' but it runs '-run' separately for each | ||||||||||||||||||||||||||||
| 273 | # test, and checks whether anything bad has happened after the run | ||||||||||||||||||||||||||||
| 274 | # of each test (i.e. either a test has failed, or a test may be successful, | ||||||||||||||||||||||||||||
| 275 | # but server may have dumped a core file, we detect that). | ||||||||||||||||||||||||||||
| 276 | 0 | ▶ | sub run_bug_mode { | ||||||||||||||||||||||||||
|
Subroutine
run_bug_mode: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||
| 277 | 0 | my($self) = @_; | |||||||||||||||||||||||||||
| 278 | |||||||||||||||||||||||||||||
| 279 | 0 | my $iter = 0; | |||||||||||||||||||||||||||
| 280 | |||||||||||||||||||||||||||||
| 281 | 0 | warning "running t/TEST in the bug report mode"; | |||||||||||||||||||||||||||
| 282 | |||||||||||||||||||||||||||||
| 283 | 0 | my $reduce_iter = 0; | |||||||||||||||||||||||||||
| 284 | 0 | my @good = (); | |||||||||||||||||||||||||||
| 285 | |||||||||||||||||||||||||||||
| 286 | # first time run all tests, or all specified tests | ||||||||||||||||||||||||||||
| 287 | 0 | my @tests = @{ $self->{tests} }; # copy | |||||||||||||||||||||||||||
| 288 | 0 | my $bad = $self->run_test($iter, $reduce_iter, \@tests, \@good); | |||||||||||||||||||||||||||
| 289 | 0 | $self->{total_iterations}++; | |||||||||||||||||||||||||||
| 290 | |||||||||||||||||||||||||||||
| 291 | } | ||||||||||||||||||||||||||||
| 292 | |||||||||||||||||||||||||||||
| 293 | |||||||||||||||||||||||||||||
| 294 | # returns true if for some reason no more iterations should be made | ||||||||||||||||||||||||||||
| 295 | 0 | ▶ | sub run_iter { | ||||||||||||||||||||||||||
|
Subroutine
run_iter: not called CC=12 SCAR=50.5
Pod
undocumented
| |||||||||||||||||||||||||||||
| 296 | 0 | my($self, $iter) = @_; | |||||||||||||||||||||||||||
| 297 | 0 | my $stop_now = 0; | |||||||||||||||||||||||||||
| 298 | 0 | my $reduce_iter = 0; | |||||||||||||||||||||||||||
| 299 | 0 | my @good = (); | |||||||||||||||||||||||||||
| 300 | 0 | warning "\n" . sep("-"); | |||||||||||||||||||||||||||
| 301 | warning sprintf "[%03d-%02d-%02d] running all tests", | ||||||||||||||||||||||||||||
| 302 | 0 | $iter, $reduce_iter, $self->{times}; | |||||||||||||||||||||||||||
| 303 | |||||||||||||||||||||||||||||
| 304 | |||||||||||||||||||||||||||||
| 305 | # first time run all tests, or all specified tests | ||||||||||||||||||||||||||||
| 306 | 0 | my @tests = @{ $self->{tests} }; # copy | |||||||||||||||||||||||||||
| 307 | |||||||||||||||||||||||||||||
| 308 | # hack to ensure a new random seed is generated | ||||||||||||||||||||||||||||
| 309 | 0 | Apache::TestSort->run(\@tests, $self); | |||||||||||||||||||||||||||
| 310 | |||||||||||||||||||||||||||||
| 311 | 0 | my $bad = $self->run_test($iter, $reduce_iter, \@tests, \@good); | |||||||||||||||||||||||||||
| 312 | 0 | ▶ | unless ($bad) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 313 | 0 | $self->{total_iterations}++; | |||||||||||||||||||||||||||
| 314 | 0 | return $stop_now; | |||||||||||||||||||||||||||
| 315 | } | ||||||||||||||||||||||||||||
| 316 | 0 | error "recorded a positive failure ('$bad'), " . | |||||||||||||||||||||||||||
| 317 | "will try to minimize the input now"; | ||||||||||||||||||||||||||||
| 318 | |||||||||||||||||||||||||||||
| 319 | 0 | my $command = $self->{base_command}; | |||||||||||||||||||||||||||
| 320 | |||||||||||||||||||||||||||||
| 321 | # does the test fail on its own | ||||||||||||||||||||||||||||
| 322 | { | ||||||||||||||||||||||||||||
| 323 | 0 | $reduce_iter++; | |||||||||||||||||||||||||||
| 324 | 0 | warning sprintf "[%03d-%02d-%02d] trying '$bad' on its own", | |||||||||||||||||||||||||||
| 325 | $iter, $reduce_iter, 1; | ||||||||||||||||||||||||||||
| 326 | 0 | my @good = (); | |||||||||||||||||||||||||||
| 327 | 0 | my @tests = ($bad); | |||||||||||||||||||||||||||
| 328 | 0 | my $bad = $self->run_test($iter, $reduce_iter, \@tests, \@good); | |||||||||||||||||||||||||||
| 329 | # if a test is failing on its own there is no point to | ||||||||||||||||||||||||||||
| 330 | # continue looking for other sequences | ||||||||||||||||||||||||||||
| 331 | 0 | ▶ | if ($bad) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 332 | 0 | $stop_now = 1; | |||||||||||||||||||||||||||
| 333 | 0 | $self->{total_iterations}++; | |||||||||||||||||||||||||||
| 334 | 0 | ▶ | unless ($self->sequence_seen($self->{results}, [@good, $bad])) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 335 | 0 | $self->report_success($iter, $reduce_iter, "$command $bad", 1); | |||||||||||||||||||||||||||
| 336 | } | ||||||||||||||||||||||||||||
| 337 | 0 | return $stop_now; | |||||||||||||||||||||||||||
| 338 | } | ||||||||||||||||||||||||||||
| 339 | } | ||||||||||||||||||||||||||||
| 340 | |||||||||||||||||||||||||||||
| 341 | # positive failure | ||||||||||||||||||||||||||||
| 342 | 0 | my $ok_tests = @good; | |||||||||||||||||||||||||||
| 343 | 0 | my $reduction_success = 0; | |||||||||||||||||||||||||||
| 344 | 0 | my $done = 0; | |||||||||||||||||||||||||||
| 345 | 0 | ▶ | while (@good > 1) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 346 | 0 | my $tries = 0; | |||||||||||||||||||||||||||
| 347 | 0 | my $reduce_sub = $self->reduce_stream(\@good); | |||||||||||||||||||||||||||
| 348 | 0 | $reduce_iter++; | |||||||||||||||||||||||||||
| 349 | 0 | ▶ | while ($tries++ < MAX_REDUCTION_TRIES) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 350 | 0 | $self->{total_reduction_attempts}++; | |||||||||||||||||||||||||||
| 351 | 0 | my @try = @{ $reduce_sub->() }; | |||||||||||||||||||||||||||
| 352 | |||||||||||||||||||||||||||||
| 353 | # reduction stream is empty (tried all?) | ||||||||||||||||||||||||||||
| 354 | 0 | ▶ | unless (@try) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 355 | 0 | $done = 1; | |||||||||||||||||||||||||||
| 356 | 0 | last; | |||||||||||||||||||||||||||
| 357 | } | ||||||||||||||||||||||||||||
| 358 | |||||||||||||||||||||||||||||
| 359 | 0 | warning sprintf "\n[%03d-%02d-%02d] trying %d tests", | |||||||||||||||||||||||||||
| 360 | $iter, $reduce_iter, $tries, scalar(@try); | ||||||||||||||||||||||||||||
| 361 | 0 | my @ok = (); | |||||||||||||||||||||||||||
| 362 | 0 | my @tests = (@try, $bad); | |||||||||||||||||||||||||||
| 363 | 0 | my $new_bad = $self->run_test($iter, $reduce_iter, \@tests, \@ok); | |||||||||||||||||||||||||||
| 364 | 0 | ▶ | if ($new_bad) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 365 | # successful reduction | ||||||||||||||||||||||||||||
| 366 | 0 | $reduction_success++; | |||||||||||||||||||||||||||
| 367 | 0 | @good = @ok; | |||||||||||||||||||||||||||
| 368 | 0 | $tries = 0; | |||||||||||||||||||||||||||
| 369 | 0 | my $num = @ok; | |||||||||||||||||||||||||||
| 370 | 0 | error "*** reduction $reduce_iter succeeded ($num tests) ***"; | |||||||||||||||||||||||||||
| 371 | 0 | $self->{total_reduction_successes}++; | |||||||||||||||||||||||||||
| 372 | 0 | $self->log_successful_reduction($iter, \@ok); | |||||||||||||||||||||||||||
| 373 | 0 | last; | |||||||||||||||||||||||||||
| 374 | } | ||||||||||||||||||||||||||||
| 375 | } | ||||||||||||||||||||||||||||
| 376 | |||||||||||||||||||||||||||||
| 377 | # last round of reducing has failed, so we give up | ||||||||||||||||||||||||||||
| 378 | 0 | ▶ | if ($done || $tries >= MAX_REDUCTION_TRIES){ | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$done or $tries >= 50
MC/DC0%0/2
$done or $tries >= 50
$done
$tries >= 50
Truth table0%0/3
A or B
A= $doneB= $tries >= 50
| |||||||||||||||||||||||||||||
| 379 | 0 | error "no further reductions were made"; | |||||||||||||||||||||||||||
| 380 | 0 | $done = 1; | |||||||||||||||||||||||||||
| 381 | 0 | last; | |||||||||||||||||||||||||||
| 382 | } | ||||||||||||||||||||||||||||
| 383 | |||||||||||||||||||||||||||||
| 384 | } | ||||||||||||||||||||||||||||
| 385 | |||||||||||||||||||||||||||||
| 386 | # we have a minimal failure sequence at this point (to the extend | ||||||||||||||||||||||||||||
| 387 | # of success of our attempts to reduce) | ||||||||||||||||||||||||||||
| 388 | |||||||||||||||||||||||||||||
| 389 | # report the sequence if we didn't see such one yet in the | ||||||||||||||||||||||||||||
| 390 | # previous iterations | ||||||||||||||||||||||||||||
| 391 | 0 | ▶ | unless ($self->sequence_seen($self->{results}, [@good, $bad])) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 392 | # if no reduction succeeded, it's 0 | ||||||||||||||||||||||||||||
| 393 | 0 | ▶ | $reduce_iter = 0 unless $reduction_success; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 394 | 0 | $self->report_success($iter, $reduce_iter, | |||||||||||||||||||||||||||
| 395 | "$command @good $bad", @good + 1); | ||||||||||||||||||||||||||||
| 396 | } | ||||||||||||||||||||||||||||
| 397 | |||||||||||||||||||||||||||||
| 398 | 0 | $self->{total_iterations}++; | |||||||||||||||||||||||||||
| 399 | |||||||||||||||||||||||||||||
| 400 | 0 | return $stop_now; | |||||||||||||||||||||||||||
| 401 | } | ||||||||||||||||||||||||||||
| 402 | |||||||||||||||||||||||||||||
| 403 | # my $sub = $self->reduce_stream(\@items); | ||||||||||||||||||||||||||||
| 404 | 0 | ▶ | sub reduce_stream { | ||||||||||||||||||||||||||
|
Subroutine
reduce_stream: not called CC=2 SCAR=17.9
Pod
undocumented
| |||||||||||||||||||||||||||||
| 405 | 0 | my($self) = shift; | |||||||||||||||||||||||||||
| 406 | 0 | my @items = @{+shift}; | |||||||||||||||||||||||||||
| 407 | |||||||||||||||||||||||||||||
| 408 | 0 | my $items = @items; | |||||||||||||||||||||||||||
| 409 | 0 | ▶ | my $odd = $items % 2 ? 1 : 0; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 410 | 0 | my $middle = int($items/2) - 1; | |||||||||||||||||||||||||||
| 411 | 0 | my $c = 0; | |||||||||||||||||||||||||||
| 412 | |||||||||||||||||||||||||||||
| 413 | 0 | ▶ | return sub { | ||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=8 SCAR=42.8
| |||||||||||||||||||||||||||||
| 414 | 0 | $c++; # remember stream's state | |||||||||||||||||||||||||||
| 415 | |||||||||||||||||||||||||||||
| 416 | # a single item is not reduce-able | ||||||||||||||||||||||||||||
| 417 | 0 | ▶ | return \@items if $items == 1; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 418 | |||||||||||||||||||||||||||||
| 419 | 0 | my @try = (); | |||||||||||||||||||||||||||
| 420 | 0 | my $max_repeat_tries = 50; # avoid seen sequences | |||||||||||||||||||||||||||
| 421 | 0 | my $repeat = 0; | |||||||||||||||||||||||||||
| 422 | 0 | ▶ | while ($repeat++ <= $max_repeat_tries) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 423 | |||||||||||||||||||||||||||||
| 424 | # try to use a binary search | ||||||||||||||||||||||||||||
| 425 | 0 | ▶ | if ($c == 1) { | ||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||
| 426 | # right half | ||||||||||||||||||||||||||||
| 427 | 0 | @try = @items[($middle+1)..($items-1)]; | |||||||||||||||||||||||||||
| 428 | } | ||||||||||||||||||||||||||||
| 429 | elsif ($c == 2) { | ||||||||||||||||||||||||||||
| 430 | # left half | ||||||||||||||||||||||||||||
| 431 | 0 | @try = @items[0..$middle]; | |||||||||||||||||||||||||||
| 432 | } | ||||||||||||||||||||||||||||
| 433 | |||||||||||||||||||||||||||||
| 434 | # try to use a random window size alg | ||||||||||||||||||||||||||||
| 435 | else { | ||||||||||||||||||||||||||||
| 436 | 0 | my $left = int rand($items); | |||||||||||||||||||||||||||
| 437 | 0 | ▶ | $left = $items - 1 if $left == $items - 1; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 438 | 0 | my $right = $left + int rand($items - $left); | |||||||||||||||||||||||||||
| 439 | 0 | ▶ | $right = $items - 1 if $right >= $items; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 440 | 0 | @try = @items[$left..$right]; | |||||||||||||||||||||||||||
| 441 | } | ||||||||||||||||||||||||||||
| 442 | |||||||||||||||||||||||||||||
| 443 | 0 | ▶ | if ($self->sequence_seen($self->{seen}, \@try)) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 444 | 0 | @try = (); | |||||||||||||||||||||||||||
| 445 | } | ||||||||||||||||||||||||||||
| 446 | else { | ||||||||||||||||||||||||||||
| 447 | 0 | last; # found an unseen sequence | |||||||||||||||||||||||||||
| 448 | } | ||||||||||||||||||||||||||||
| 449 | } | ||||||||||||||||||||||||||||
| 450 | 0 | return \@try; | |||||||||||||||||||||||||||
| 451 | } | ||||||||||||||||||||||||||||
| 452 | 0 | } | |||||||||||||||||||||||||||
| 453 | |||||||||||||||||||||||||||||
| 454 | 0 | ▶ | sub sequence_seen { | ||||||||||||||||||||||||||
|
Subroutine
sequence_seen: not called CC=2 SCAR=17.9
Pod
undocumented
| |||||||||||||||||||||||||||||
| 455 | 0 | my ($self, $rh_store, $ra_tests) = @_; | |||||||||||||||||||||||||||
| 456 | |||||||||||||||||||||||||||||
| 457 | 0 | require Digest::MD5; | |||||||||||||||||||||||||||
| 458 | 0 | my $digest = Digest::MD5::md5_hex(join '', @$ra_tests); | |||||||||||||||||||||||||||
| 459 | #error $self->{seen}; | ||||||||||||||||||||||||||||
| 460 | 0 | ▶ | return $rh_store->{$digest}++ ? 1 : 0 | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 461 | |||||||||||||||||||||||||||||
| 462 | } | ||||||||||||||||||||||||||||
| 463 | |||||||||||||||||||||||||||||
| 464 | 0 | ▶ | sub run_test { | ||||||||||||||||||||||||||
|
Subroutine
run_test: not called CC=21 SCAR=61.4
Pod
undocumented
| |||||||||||||||||||||||||||||
| 465 | 0 | require IPC::Run3; | |||||||||||||||||||||||||||
| 466 | 0 | my($self, $iter, $count, $tests, $ra_ok) = @_; | |||||||||||||||||||||||||||
| 467 | 0 | my $bad = ''; | |||||||||||||||||||||||||||
| 468 | 0 | my $ra_nok = []; | |||||||||||||||||||||||||||
| 469 | |||||||||||||||||||||||||||||
| 470 | #warning "$self->{base_command} @$tests"; | ||||||||||||||||||||||||||||
| 471 | |||||||||||||||||||||||||||||
| 472 | #$SIG{PIPE} = 'IGNORE'; | ||||||||||||||||||||||||||||
| 473 | 0 | ▶ | $SIG{PIPE} = sub { die "pipe broke" }; | ||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||
| 474 | |||||||||||||||||||||||||||||
| 475 | # start server | ||||||||||||||||||||||||||||
| 476 | { | ||||||||||||||||||||||||||||
| 477 | 0 | my $command = $self->{start_command}; | |||||||||||||||||||||||||||
| 478 | 0 | my $log = ''; | |||||||||||||||||||||||||||
| 479 | 0 | IPC::Run3::run3($command, undef, \$log, \$log); | |||||||||||||||||||||||||||
| 480 | 0 | ▶ | my $started_ok = ($log =~ /started/) ? 1 : 0; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 481 | 0 | ▶ | unless ($started_ok) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 482 | 0 | error "failed to start server\n $log"; | |||||||||||||||||||||||||||
| 483 | 0 | exit 1; | |||||||||||||||||||||||||||
| 484 | } | ||||||||||||||||||||||||||||
| 485 | } | ||||||||||||||||||||||||||||
| 486 | |||||||||||||||||||||||||||||
| 487 | 0 | my $t_logs = $self->{test_config}->{vars}->{t_logs}; | |||||||||||||||||||||||||||
| 488 | 0 | my @log_files = map { catfile $t_logs, $_ } qw(error_log access_log); | |||||||||||||||||||||||||||
| 489 | 0 | $self->logs_init(@log_files); | |||||||||||||||||||||||||||
| 490 | |||||||||||||||||||||||||||||
| 491 | # run tests | ||||||||||||||||||||||||||||
| 492 | { | ||||||||||||||||||||||||||||
| 493 | 0 | my $command = $self->{run_command}; | |||||||||||||||||||||||||||
| 494 | |||||||||||||||||||||||||||||
| 495 | 0 | my $max_len = 1; | |||||||||||||||||||||||||||
| 496 | 0 | for my $test (@$tests) { | |||||||||||||||||||||||||||
| 497 | 0 | ▶ | $max_len = length $test if length $test > $max_len; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 498 | } | ||||||||||||||||||||||||||||
| 499 | |||||||||||||||||||||||||||||
| 500 | 0 | for my $test (@$tests) { | |||||||||||||||||||||||||||
| 501 | 0 | (my $test_name = $test) =~ s/\.t$//; | |||||||||||||||||||||||||||
| 502 | 0 | my $fill = "." x ($max_len - length $test_name); | |||||||||||||||||||||||||||
| 503 | 0 | $self->{total_tests_run}++; | |||||||||||||||||||||||||||
| 504 | |||||||||||||||||||||||||||||
| 505 | 0 | my $test_command = "$command $test"; | |||||||||||||||||||||||||||
| 506 | 0 | my $log = ''; | |||||||||||||||||||||||||||
| 507 | 0 | IPC::Run3::run3($test_command, undef, \$log, \$log); | |||||||||||||||||||||||||||
| 508 | 0 | ▶ | my $ok = ($log =~ /All tests successful|NOTESTS/) ? 1 : 0; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 509 | |||||||||||||||||||||||||||||
| 510 | 0 | my @core_files_msg = $self->Apache::TestRun::scan_core_incremental(1); | |||||||||||||||||||||||||||
| 511 | |||||||||||||||||||||||||||||
| 512 | # if the test has caused core file(s) it's not ok | ||||||||||||||||||||||||||||
| 513 | 0 | ▶ | $ok = 0 if @core_files_msg; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 514 | |||||||||||||||||||||||||||||
| 515 | 0 | ▶ | if ($ok == 1) { | ||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||
| 516 | 0 | push @$ra_ok, $test; | |||||||||||||||||||||||||||
| 517 | 0 | ▶ | if ($self->{verbose}) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 518 | |||||||||||||||||||||||||||||
| 519 | 0 | ▶ | if ($log =~ m/NOTESTS/) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 520 | 0 | print STDERR "$test_name${fill}skipped\n"; | |||||||||||||||||||||||||||
| 521 | } else { | ||||||||||||||||||||||||||||
| 522 | 0 | print STDERR "$test_name${fill}ok\n"; | |||||||||||||||||||||||||||
| 523 | } | ||||||||||||||||||||||||||||
| 524 | } | ||||||||||||||||||||||||||||
| 525 | # need to run log_diff to reset the position of the fh | ||||||||||||||||||||||||||||
| 526 | 0 | my %log_diffs = map { $_ => $self->log_diff($_) } @log_files; | |||||||||||||||||||||||||||
| 527 | |||||||||||||||||||||||||||||
| 528 | } | ||||||||||||||||||||||||||||
| 529 | elsif ($ok == 0) { | ||||||||||||||||||||||||||||
| 530 | 0 | push @$ra_nok, $test; | |||||||||||||||||||||||||||
| 531 | 0 | $bad = $test; | |||||||||||||||||||||||||||
| 532 | |||||||||||||||||||||||||||||
| 533 | 0 | ▶ | if ($self->{verbose}) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 534 | 0 | print STDERR "$test_name${fill}FAILED\n"; | |||||||||||||||||||||||||||
| 535 | 0 | error sep("-"); | |||||||||||||||||||||||||||
| 536 | |||||||||||||||||||||||||||||
| 537 | # give server some time to finish the | ||||||||||||||||||||||||||||
| 538 | # logging. it's ok to wait long time since we have | ||||||||||||||||||||||||||||
| 539 | # to deal with an error | ||||||||||||||||||||||||||||
| 540 | 0 | sleep 5; | |||||||||||||||||||||||||||
| 541 | 0 | my %log_diffs = map { $_ => $self->log_diff($_) } @log_files; | |||||||||||||||||||||||||||
| 542 | |||||||||||||||||||||||||||||
| 543 | # client log | ||||||||||||||||||||||||||||
| 544 | 0 | error "\t\t*** run log ***"; | |||||||||||||||||||||||||||
| 545 | 0 | $log =~ s/^/ /mg; | |||||||||||||||||||||||||||
| 546 | 0 | print STDERR "$log\n"; | |||||||||||||||||||||||||||
| 547 | |||||||||||||||||||||||||||||
| 548 | # server logs | ||||||||||||||||||||||||||||
| 549 | 0 | for my $path (@log_files) { | |||||||||||||||||||||||||||
| 550 | 0 | ▶ | next unless length $log_diffs{$path}; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 551 | 0 | error "\t\t*** $path ***"; | |||||||||||||||||||||||||||
| 552 | 0 | $log_diffs{$path} =~ s/^/ /mg; | |||||||||||||||||||||||||||
| 553 | 0 | print STDERR "$log_diffs{$path}\n"; | |||||||||||||||||||||||||||
| 554 | } | ||||||||||||||||||||||||||||
| 555 | } | ||||||||||||||||||||||||||||
| 556 | 0 | ▶ | if (@core_files_msg) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 557 | 0 | ▶ | unless ($self->{verbose}) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 558 | # currently the output of 'run log' already | ||||||||||||||||||||||||||||
| 559 | # includes the information about core files once | ||||||||||||||||||||||||||||
| 560 | # Test::Harness::Straps allows us to run callbacks | ||||||||||||||||||||||||||||
| 561 | # after each test, and we move back to run all | ||||||||||||||||||||||||||||
| 562 | # tests at once, we will log the message here | ||||||||||||||||||||||||||||
| 563 | 0 | error "$test_name caused core"; | |||||||||||||||||||||||||||
| 564 | 0 | print STDERR join "\n", @core_files_msg, "\n"; | |||||||||||||||||||||||||||
| 565 | } | ||||||||||||||||||||||||||||
| 566 | } | ||||||||||||||||||||||||||||
| 567 | |||||||||||||||||||||||||||||
| 568 | 0 | ▶ | if ($self->{verbose}) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 569 | 0 | error sep("-"); | |||||||||||||||||||||||||||
| 570 | } | ||||||||||||||||||||||||||||
| 571 | |||||||||||||||||||||||||||||
| 572 | 0 | ▶ | unless ($self->{bug_mode}) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 573 | # normal smoke stop the run, but in the bug_mode | ||||||||||||||||||||||||||||
| 574 | # we want to complete all the tests | ||||||||||||||||||||||||||||
| 575 | 0 | last; | |||||||||||||||||||||||||||
| 576 | } | ||||||||||||||||||||||||||||
| 577 | } | ||||||||||||||||||||||||||||
| 578 | |||||||||||||||||||||||||||||
| 579 | |||||||||||||||||||||||||||||
| 580 | } | ||||||||||||||||||||||||||||
| 581 | } | ||||||||||||||||||||||||||||
| 582 | |||||||||||||||||||||||||||||
| 583 | 0 | $self->logs_end(); | |||||||||||||||||||||||||||
| 584 | |||||||||||||||||||||||||||||
| 585 | # stop server | ||||||||||||||||||||||||||||
| 586 | 0 | $self->kill_proc(); | |||||||||||||||||||||||||||
| 587 | |||||||||||||||||||||||||||||
| 588 | 0 | ▶ | if ($self->{bug_mode}) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 589 | 0 | warning sep("-"); | |||||||||||||||||||||||||||
| 590 | 0 | ▶ | if (@$ra_nok == 0) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 591 | 0 | printf STDERR "All tests successful (%d)\n", scalar @$ra_ok; | |||||||||||||||||||||||||||
| 592 | } | ||||||||||||||||||||||||||||
| 593 | else { | ||||||||||||||||||||||||||||
| 594 | 0 | error sprintf "error running %d tests out of %d\n", | |||||||||||||||||||||||||||
| 595 | scalar(@$ra_nok), scalar @$ra_ok + @$ra_nok; | ||||||||||||||||||||||||||||
| 596 | } | ||||||||||||||||||||||||||||
| 597 | } | ||||||||||||||||||||||||||||
| 598 | else { | ||||||||||||||||||||||||||||
| 599 | 0 | return $bad; | |||||||||||||||||||||||||||
| 600 | } | ||||||||||||||||||||||||||||
| 601 | |||||||||||||||||||||||||||||
| 602 | |||||||||||||||||||||||||||||
| 603 | } | ||||||||||||||||||||||||||||
| 604 | |||||||||||||||||||||||||||||
| 605 | 0 | ▶ | sub report_start { | ||||||||||||||||||||||||||
|
Subroutine
report_start: not called CC=3 SCAR=24.8
Pod
undocumented
| |||||||||||||||||||||||||||||
| 606 | 0 | my($self) = shift; | |||||||||||||||||||||||||||
| 607 | |||||||||||||||||||||||||||||
| 608 | 0 | my $time = scalar localtime; | |||||||||||||||||||||||||||
| 609 | 0 | $self->{start_time} = $time; | |||||||||||||||||||||||||||
| 610 | 0 | $time =~ s/\s/_/g; | |||||||||||||||||||||||||||
| 611 | 0 | $time =~ s/:/-/g; # winFU | |||||||||||||||||||||||||||
| 612 | my $file = $self->{opts}->{report} || | ||||||||||||||||||||||||||||
| 613 | 0 | ▶ | catfile Apache::Test::vars('top_dir'), "smoke-report-$time.txt"; | ||||||||||||||||||||||||||
|
Condition0%0/3
$self->{'opts'}{'report'} || catfile(Apache::Test::vars('top_dir'), "smoke-report-$time.txt")
MC/DC0%0/2
$self->{'opts'}{'report'} || catfile(Apache::Test::vars('top_dir'), "smoke-report-$time.txt")
$self->{'opts'}{'report'}
catfile(Apache::Test::vars('top_dir'), "smoke-report-$time.txt")
Truth table0%0/3
A || B
A= $self->{'opts'}{'report'}B= catfile(Apache::Test::vars('top_dir'), "smoke-report-$time.txt")
| |||||||||||||||||||||||||||||
| 614 | 0 | $self->{runtime}->{report} = $file; | |||||||||||||||||||||||||||
| 615 | 0 | info "Report file: $file"; | |||||||||||||||||||||||||||
| 616 | |||||||||||||||||||||||||||||
| 617 | 0 | ▶ | open my $fh, ">$file" or die "cannot open $file for writing: $!"; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 618 | 0 | $self->{fh} = $fh; | |||||||||||||||||||||||||||
| 619 | 0 | my $sep = sep("-"); | |||||||||||||||||||||||||||
| 620 | 0 | my $title = sep('=', "Special Tests Sequence Failure Finder Report"); | |||||||||||||||||||||||||||
| 621 | |||||||||||||||||||||||||||||
| 622 | 0 | print $fh <<EOM; | |||||||||||||||||||||||||||
| 623 | $title | ||||||||||||||||||||||||||||
| 624 | $sep | ||||||||||||||||||||||||||||
| 625 | First iteration used: | ||||||||||||||||||||||||||||
| 626 | 0 | $self->{base_command} @{$self->{tests}} | |||||||||||||||||||||||||||
| 627 | $sep | ||||||||||||||||||||||||||||
| 628 | EOM | ||||||||||||||||||||||||||||
| 629 | |||||||||||||||||||||||||||||
| 630 | } | ||||||||||||||||||||||||||||
| 631 | |||||||||||||||||||||||||||||
| 632 | 0 | ▶ | sub report_success { | ||||||||||||||||||||||||||
|
Subroutine
report_success: not called CC=2 SCAR=17.9
Pod
undocumented
| |||||||||||||||||||||||||||||
| 633 | 0 | my($self, $iter, $reduce_iter, $sequence, $tests) = @_; | |||||||||||||||||||||||||||
| 634 | |||||||||||||||||||||||||||||
| 635 | 0 | my @report = ("iteration $iter ($tests tests):\n", | |||||||||||||||||||||||||||
| 636 | "\t$sequence\n", | ||||||||||||||||||||||||||||
| 637 | "(made $reduce_iter successful reductions)\n\n"); | ||||||||||||||||||||||||||||
| 638 | |||||||||||||||||||||||||||||
| 639 | 0 | print @report; | |||||||||||||||||||||||||||
| 640 | 0 | ▶ | if (my $fh = $self->{fh}) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 641 | 0 | print $fh @report; | |||||||||||||||||||||||||||
| 642 | } | ||||||||||||||||||||||||||||
| 643 | } | ||||||||||||||||||||||||||||
| 644 | |||||||||||||||||||||||||||||
| 645 | 0 | ▶ | sub report_finish { | ||||||||||||||||||||||||||
|
Subroutine
report_finish: not called CC=7 SCAR=40.3
Pod
undocumented
| |||||||||||||||||||||||||||||
| 646 | 0 | my($self) = @_; | |||||||||||||||||||||||||||
| 647 | |||||||||||||||||||||||||||||
| 648 | 0 | my $start_time = $self->{start_time}; | |||||||||||||||||||||||||||
| 649 | 0 | my $end_time = scalar localtime; | |||||||||||||||||||||||||||
| 650 | 0 | ▶ | if (my $fh = delete $self->{fh}) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 651 | 0 | my $failures = scalar keys %{ $self->{results} }; | |||||||||||||||||||||||||||
| 652 | |||||||||||||||||||||||||||||
| 653 | 0 | my $sep = sep("-"); | |||||||||||||||||||||||||||
| 654 | 0 | my $cfg_as_string = $self->build_config_as_string; | |||||||||||||||||||||||||||
| 655 | 0 | my $unique_seqs = scalar keys %{ $self->{results} }; | |||||||||||||||||||||||||||
| 656 | 0 | my $attempts = $self->{total_reduction_attempts}; | |||||||||||||||||||||||||||
| 657 | 0 | my $successes = $self->{total_reduction_successes}; | |||||||||||||||||||||||||||
| 658 | my $completion = $self->{smoking_completed} | ||||||||||||||||||||||||||||
| 659 | 0 | ▶ | ? "Completed" | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 660 | : "Not Completed (aborted by user)"; | ||||||||||||||||||||||||||||
| 661 | |||||||||||||||||||||||||||||
| 662 | 0 | my $status = "Unknown"; | |||||||||||||||||||||||||||
| 663 | 0 | ▶ | if ($self->{total_iterations} > 0) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 664 | 0 | ▶ | if ($failures) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 665 | 0 | $status = "*** NOT OK ***"; | |||||||||||||||||||||||||||
| 666 | } | ||||||||||||||||||||||||||||
| 667 | else { | ||||||||||||||||||||||||||||
| 668 | 0 | $status = "+++ OK +++"; | |||||||||||||||||||||||||||
| 669 | } | ||||||||||||||||||||||||||||
| 670 | } | ||||||||||||||||||||||||||||
| 671 | |||||||||||||||||||||||||||||
| 672 | 0 | my $title = sep('=', "Summary"); | |||||||||||||||||||||||||||
| 673 | |||||||||||||||||||||||||||||
| 674 | my $iter_made = sprintf "Iterations (%s) made : %d", | ||||||||||||||||||||||||||||
| 675 | 0 | $self->{order}, $self->{total_iterations}; | |||||||||||||||||||||||||||
| 676 | |||||||||||||||||||||||||||||
| 677 | 0 | print $fh <<EOM; | |||||||||||||||||||||||||||
| 678 | |||||||||||||||||||||||||||||
| 679 | $title | ||||||||||||||||||||||||||||
| 680 | Completion : $completion | ||||||||||||||||||||||||||||
| 681 | Status : $status | ||||||||||||||||||||||||||||
| 682 | Tests run : $self->{total_tests_run} | ||||||||||||||||||||||||||||
| 683 | $iter_made | ||||||||||||||||||||||||||||
| 684 | EOM | ||||||||||||||||||||||||||||
| 685 | |||||||||||||||||||||||||||||
| 686 | 0 | ▶ | if ($attempts > 0 && $failures) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$attempts > 0 and $failures
MC/DC0%0/2
$attempts > 0 and $failures
$attempts > 0
$failures
Truth table0%0/3
A and B
A= $attempts > 0B= $failures
| |||||||||||||||||||||||||||||
| 687 | 0 | my $reduction_stats = sprintf "%d/%d (%d%% success)", | |||||||||||||||||||||||||||
| 688 | $attempts, $successes, $successes / $attempts * 100; | ||||||||||||||||||||||||||||
| 689 | |||||||||||||||||||||||||||||
| 690 | 0 | print $fh <<EOM; | |||||||||||||||||||||||||||
| 691 | Unique sequences found : $unique_seqs | ||||||||||||||||||||||||||||
| 692 | Reduction tries/success : $reduction_stats | ||||||||||||||||||||||||||||
| 693 | EOM | ||||||||||||||||||||||||||||
| 694 | } | ||||||||||||||||||||||||||||
| 695 | |||||||||||||||||||||||||||||
| 696 | 0 | print $fh <<EOM; | |||||||||||||||||||||||||||
| 697 | $sep | ||||||||||||||||||||||||||||
| 698 | --- Started at: $start_time --- | ||||||||||||||||||||||||||||
| 699 | --- Ended at: $end_time --- | ||||||||||||||||||||||||||||
| 700 | $sep | ||||||||||||||||||||||||||||
| 701 | The smoke testing was run on the system with the following | ||||||||||||||||||||||||||||
| 702 | parameters: | ||||||||||||||||||||||||||||
| 703 | |||||||||||||||||||||||||||||
| 704 | $cfg_as_string | ||||||||||||||||||||||||||||
| 705 | |||||||||||||||||||||||||||||
| 706 | -- this report was generated by $0 | ||||||||||||||||||||||||||||
| 707 | EOM | ||||||||||||||||||||||||||||
| 708 | 0 | close $fh; | |||||||||||||||||||||||||||
| 709 | } | ||||||||||||||||||||||||||||
| 710 | } | ||||||||||||||||||||||||||||
| 711 | |||||||||||||||||||||||||||||
| 712 | # in case the smoke gets killed before it had a chance to finish and | ||||||||||||||||||||||||||||
| 713 | # write the report, at least we won't lose the last successful reduction | ||||||||||||||||||||||||||||
| 714 | # XXX: this wasn't needed before we switched to IPC::Run3, since | ||||||||||||||||||||||||||||
| 715 | # Ctrl-C would log the collected data, but it doesn't work with | ||||||||||||||||||||||||||||
| 716 | # IPC::Run3. So if that gets fixed, we can remove that function | ||||||||||||||||||||||||||||
| 717 | 0 | ▶ | sub log_successful_reduction { | ||||||||||||||||||||||||||
|
Subroutine
log_successful_reduction: not called CC=2 SCAR=17.9
Pod
undocumented
| |||||||||||||||||||||||||||||
| 718 | 0 | my($self, $iter, $tests) = @_; | |||||||||||||||||||||||||||
| 719 | |||||||||||||||||||||||||||||
| 720 | 0 | my $file = $self->{runtime}->{report} . ".$iter.temp"; | |||||||||||||||||||||||||||
| 721 | 0 | debug "saving in $file"; | |||||||||||||||||||||||||||
| 722 | 0 | ▶ | open my $fh, ">$file" or die "cannot open $file for writing: $!"; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 723 | 0 | print $fh join " ", @$tests; | |||||||||||||||||||||||||||
| 724 | 0 | close $fh; | |||||||||||||||||||||||||||
| 725 | } | ||||||||||||||||||||||||||||
| 726 | |||||||||||||||||||||||||||||
| 727 | 0 | ▶ | sub build_config_as_string { | ||||||||||||||||||||||||||
|
Subroutine
build_config_as_string: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||
| 728 | 0 | Apache::TestConfig::as_string(); | |||||||||||||||||||||||||||
| 729 | } | ||||||||||||||||||||||||||||
| 730 | |||||||||||||||||||||||||||||
| 731 | 0 | ▶ | sub kill_proc { | ||||||||||||||||||||||||||
|
Subroutine
kill_proc: not called CC=3 SCAR=24.8
Pod
undocumented
| |||||||||||||||||||||||||||||
| 732 | 0 | my($self) = @_; | |||||||||||||||||||||||||||
| 733 | |||||||||||||||||||||||||||||
| 734 | 0 | my $command = $self->{stop_command}; | |||||||||||||||||||||||||||
| 735 | 0 | my $log = ''; | |||||||||||||||||||||||||||
| 736 | 0 | require IPC::Run3; | |||||||||||||||||||||||||||
| 737 | 0 | IPC::Run3::run3($command, undef, \$log, \$log); | |||||||||||||||||||||||||||
| 738 | |||||||||||||||||||||||||||||
| 739 | 0 | ▶ | my $stopped_ok = ($log =~ /shutdown/) ? 1 : 0; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 740 | 0 | ▶ | unless ($stopped_ok) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 741 | 0 | error "failed to stop server\n $log"; | |||||||||||||||||||||||||||
| 742 | } | ||||||||||||||||||||||||||||
| 743 | } | ||||||||||||||||||||||||||||
| 744 | |||||||||||||||||||||||||||||
| 745 | 0 | ▶ | sub opt_help { | ||||||||||||||||||||||||||
|
Subroutine
opt_help: not called CC=2 SCAR=17.9
Pod
undocumented
| |||||||||||||||||||||||||||||
| 746 | 0 | my $self = shift; | |||||||||||||||||||||||||||
| 747 | |||||||||||||||||||||||||||||
| 748 | 0 | print <<EOM; | |||||||||||||||||||||||||||
| 749 | usage: t/SMOKE [options ...] [tests] | ||||||||||||||||||||||||||||
| 750 | where the options are: | ||||||||||||||||||||||||||||
| 751 | EOM | ||||||||||||||||||||||||||||
| 752 | |||||||||||||||||||||||||||||
| 753 | 0 | for (sort keys %usage){ | |||||||||||||||||||||||||||
| 754 | 0 | printf " -%-16s %s\n", $_, $usage{$_}; | |||||||||||||||||||||||||||
| 755 | } | ||||||||||||||||||||||||||||
| 756 | 0 | print <<EOM; | |||||||||||||||||||||||||||
| 757 | |||||||||||||||||||||||||||||
| 758 | if 'tests' argument is not provided all available tests will be run | ||||||||||||||||||||||||||||
| 759 | EOM | ||||||||||||||||||||||||||||
| 760 | } | ||||||||||||||||||||||||||||
| 761 | |||||||||||||||||||||||||||||
| 762 | # generate t/SMOKE script (or a different filename) which will drive | ||||||||||||||||||||||||||||
| 763 | # Apache::TestSmoke | ||||||||||||||||||||||||||||
| 764 | 0 | ▶ | sub generate_script { | ||||||||||||||||||||||||||
|
Subroutine
generate_script: not called CC=2 SCAR=17.9
Pod
undocumented
| |||||||||||||||||||||||||||||
| 765 | 0 | my ($class, $file) = @_; | |||||||||||||||||||||||||||
| 766 | |||||||||||||||||||||||||||||
| 767 | 0 | ▶ | $file ||= catfile 't', 'SMOKE'; | ||||||||||||||||||||||||||
|
Condition0%0/3
$file ||= catfile("t", "SMOKE")
MC/DC0%0/2
$file ||= catfile("t", "SMOKE")
$file
catfile("t", "SMOKE")
Truth table0%0/3
A ||= B
A= $fileB= catfile("t", "SMOKE")
| |||||||||||||||||||||||||||||
| 768 | |||||||||||||||||||||||||||||
| 769 | 0 | my $content = join "\n", | |||||||||||||||||||||||||||
| 770 | "BEGIN { eval { require blib && blib->import; } }", | ||||||||||||||||||||||||||||
| 771 | Apache::TestConfig->perlscript_header, | ||||||||||||||||||||||||||||
| 772 | "use $class;", | ||||||||||||||||||||||||||||
| 773 | "$class->new(\@ARGV)->run;"; | ||||||||||||||||||||||||||||
| 774 | |||||||||||||||||||||||||||||
| 775 | 0 | Apache::Test::basic_config()->write_perlscript($file, $content); | |||||||||||||||||||||||||||
| 776 | } | ||||||||||||||||||||||||||||
| 777 | |||||||||||||||||||||||||||||
| 778 | 1 | 1; | |||||||||||||||||||||||||||
| 779 | __END__ | ||||||||||||||||||||||||||||