Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Initial chained logop fix.

  • Loading branch information...
commit f26ba32d6acbb002e9eaba6019377af5eeea555f 1 parent 8c7b157
@pjcj authored
View
69 Cover.xs
@@ -573,7 +573,7 @@ static void add_condition(pTHX_ SV *cond_ref, int value)
sv_setiv(*count, 0);
/* Check if we have come from an xor with a true first op */
- if (final) value = 1;
+ if (final) value = 1;
if (type == 1) value += 2;
NDEB(D(L, "Found %p: %d, %d\n", op, type, value));
@@ -643,6 +643,10 @@ static OP *get_condition(pTHX)
if (pc && SvROK(*pc))
{
dSP;
+ NDEB(D(L, "get_condition from %p, %p: %p (%s)\n",
+ PL_op, (void *)PL_op->op_targ, pc, hex_key(get_key(PL_op))));
+ /* dump_conditions(aTHX); */
+ NDEB(svdump(Pending_conditionals));
add_condition(aTHX_ *pc, SvTRUE(TOPs) ? 2 : 1);
}
else
@@ -672,12 +676,15 @@ static void finalise_conditions(pTHX)
HE *e;
+ NDEB(D(L, "finalise_conditions\n"));
+ /* dump_conditions(aTHX); */
+ NDEB(svdump(Pending_conditionals));
+
MUTEX_LOCK(&DC_mutex);
hv_iterinit(Pending_conditionals);
while ((e = hv_iternext(Pending_conditionals)))
{
- NDEB(D(L, "finalise_conditions\n"));
add_condition(aTHX_ hv_iterval(Pending_conditionals, e), 0);
}
MUTEX_UNLOCK(&DC_mutex);
@@ -744,6 +751,9 @@ static void cover_logop(pTHX)
int left_val_def = SvOK(TOPs);
#endif
int void_context = GIMME_V == G_VOID;
+ NDEB(D(L, "left_val: %d, void_context: %d at %p\n",
+ left_val, void_context, PL_op));
+ NDEB(op_dump(PL_op));
set_conditional(aTHX_ PL_op, 5, void_context);
@@ -804,9 +814,16 @@ static void cover_logop(pTHX)
set_conditional(aTHX_ PL_op, 0, 1);
}
+#if PERL_VERSION > 14
+ next = (PL_op->op_type == OP_XOR)
+ ? PL_op->op_next
+ : right->op_next;
+#else
+ next = PL_op->op_next;
+#endif
NDEB(op_dump(PL_op));
+ NDEB(op_dump(next));
- next = PL_op->op_next;
ch = get_key(next);
MUTEX_LOCK(&DC_mutex);
cref = hv_fetch(Pending_conditionals, ch, KEY_SZ, 1);
@@ -829,10 +846,10 @@ static void cover_logop(pTHX)
cond = newSViv(PTR2IV(PL_op));
av_push(conds, cond);
- NDEB(D(L, "Adding conditional %p (%p) "
+ NDEB(D(L, "Adding conditional %p (%s) "
"making %d at %p (%s), ppaddr: %p\n",
- next, next->op_targ, av_len(conds) - 1, PL_op,
- hex_key(ch), next->op_ppaddr));
+ next, PL_op_name[next->op_targ], av_len(conds) - 1,
+ PL_op, hex_key(ch), next->op_ppaddr));
/* dump_conditions(aTHX); */
NDEB(svdump(Pending_conditionals));
NDEB(op_dump(PL_op));
@@ -845,6 +862,20 @@ static void cover_logop(pTHX)
else
{
/* short circuit */
+#if PERL_VERSION > 14
+ OP *up = cLOGOP->op_first->op_sibling->op_next;
+ while (up->op_type == PL_op->op_type)
+ {
+ NDEB(D(L, "Considering adding %p (%s) -> (%p) "
+ "from %p (%s) -> (%p)\n",
+ up, PL_op_name[up->op_type], up->op_next,
+ PL_op, PL_op_name[PL_op->op_type], PL_op->op_next));
+ add_conditional(aTHX_ up, 3);
+ if (up->op_next == PL_op->op_next)
+ break;
+ up = cLOGOPx(up)->op_first->op_sibling->op_next;
+ }
+#endif
add_conditional(aTHX_ PL_op, 3);
}
}
@@ -1182,13 +1213,36 @@ static int runops_cover(pTHX)
static int runops_orig(pTHX)
{
- NDEB(D(L, "runops_orig\n"));
+ NDEB(D(L, "entering runops_orig\n"));
while ((PL_op = PL_op->op_ppaddr(aTHX)))
{
PERL_ASYNC_CHECK();
}
+ NDEB(D(L, "exiting runops_orig\n"));
+
+ TAINT_NOT;
+ return 0;
+}
+
+static int runops_trace(pTHX)
+{
+ PDEB(D(L, "entering runops_trace\n"));
+
+ for (;;)
+ {
+ PDEB(D(L, "running func %p from %p (%s)\n",
+ PL_op->op_ppaddr, PL_op, OP_NAME(PL_op)));
+
+ if (!(PL_op = PL_op->op_ppaddr(aTHX)))
+ break;
+
+ PERL_ASYNC_CHECK();
+ }
+
+ PDEB(D(L, "exiting runops_trace\n"));
+
TAINT_NOT;
return 0;
}
@@ -1440,6 +1494,7 @@ BOOT:
#elif defined HAS_TIMES
cpu();
#endif
+ /* PL_runops = runops_trace; */
}
else {
PL_runops = runops_cover;
View
1  lib/Devel/Cover.pm
@@ -918,6 +918,7 @@ sub add_condition_cover
# print STDERR "type: [$type]\n";
my $c = $Coverage->{condition}{$key};
+ # print STDERR "Condition: ", Dumper $c;
no warnings "uninitialized";
View
2  lib/Devel/Cover/Op.pm
@@ -26,7 +26,7 @@ my %style =
"(*( )*)goto #class (#addr)\n",
"#class pp_#name"],
"concise" =>
- ["#hyphseq2 #cover12 (*( (x( ;)x))*)<#classsym> "
+ ["#hyphseq2 #addr10 #cover12 (*( (x( ;)x))*)<#classsym> "
. "#exname#arg(?([#targarglife])?)~#flags(?(/#private)?)(x(;~->#next)x)\n",
" (*( )*) goto #seq\n",
"(?(<#seq>)?)#exname#arg(?([#targarglife])?)"],
View
564 test_output/cover/cond_branch.5.015001
@@ -1,564 +0,0 @@
-Reading database from ...
-
-
------------------------------------------- ------ ------ ------ ------ ------
-File stmt bran cond sub total
------------------------------------------- ------ ------ ------ ------ ------
-tests/cond_branch 90.3 77.2 32.9 100.0 75.7
-Total 90.3 77.2 32.9 100.0 75.7
------------------------------------------- ------ ------ ------ ------ ------
-
-
-Run: ...
-Perl version: ...
-OS: ...
-Start: ...
-Finish: ...
-
-tests/cond_branch
-
-line err stmt bran cond sub code
-1 #!/usr/bin/perl
-2
-3 # Copyright 2002-2011, Paul Johnson (pjcj@cpan.org)
-4
-5 # This software is free. It is licensed under the same terms as Perl itself.
-6
-7 # The latest version of this software should be available from my homepage:
-8 # http://www.pjcj.net
-9
-10 1 1 use strict;
- 1
- 1
-11 1 1 use warnings;
- 1
- 1
-12
-13 1 my @x;
-14
-15 1 for my $y (0, 0)
-16 {
-17 2 for my $z (1, 0)
-18 {
-19 *** 4 50 33 if ($y && $z)
-20 {
-21 *** 0 $x[1]++;
-22 }
-23 else
-24 {
-25 4 $x[2]++;
-26 }
-27 *** 4 100 66 if ($y || $z)
-28 {
-29 2 $x[3]++;
-30 }
-31 else
-32 {
-33 2 $x[4]++;
-34 }
-35
-36 *** 4 50 $y && $x[5]++;
-37 *** 4 50 $x[5]++ if $y;
-38
-39 4 100 $z && $x[6]++;
-40 4 100 $x[6]++ if $z;
-41
-42 *** 4 50 $y || $x[7]++;
-43 *** 4 50 $x[7]++ unless $y;
-44
-45 4 100 $z || $x[8]++;
-46 4 100 $x[8]++ unless $z;
-47
-48 *** 4 50 $y ? $x[9]++ : $x[10]++;
-49 4 100 $z ? $x[11]++ : $x[12]++;
-50
-51 *** 4 50 33 if ($y)
- *** 50 66
- 100
-52 {
-53 *** 0 $x[13]++;
-54 }
-55 elsif ($y && $z)
-56 {
-57 *** 0 $x[14]++;
-58 }
-59 elsif ($y || $z)
-60 {
-61 2 $x[15]++;
-62 }
-63 else
-64 {
-65 2 $x[16]++;
-66 }
-67
-68 *** 4 0 33 $y && $z && $x[17]++; $y && $z && $x[18]++;
- *** 4 0 33
-69 }
-70 }
-71
-72
-73 1 for my $y (0, 1)
-74 {
-75 2 100 $y || next;
-76 1 $x[18]++;
-77 }
-78
-79 1 for my $y (1, 0)
-80 {
-81 2 100 $y || next;
-82 1 $x[19]++;
-83 }
-84
-85 1 for my $y (0, 1)
-86 {
-87 2 100 $y && next;
-88 1 $x[20]++;
-89 }
-90
-91 1 for my $y (1, 0)
-92 {
-93 2 100 $y && next;
-94 1 $x[21]++;
-95 }
-96
-97 1 for my $y (0, 1)
-98 {
-99 1 1 no warnings "void";
- 1
- 1
-100 *** 2 0 my $w = $y xor next;
-101 *** 0 $x[22]++;
-102 }
-103
-104 1 for my $y (1, 0)
-105 {
-106 1 1 no warnings "void";
- 1
- 1
-107 *** 2 0 my $w = $y xor next;
-108 *** 0 $x[23]++;
-109 }
-110
-111
-112 1 for my $y (0, 1)
-113 {
-114 *** 1 50 $y || last;
-115 *** 0 $x[24]++;
-116 }
-117
-118 1 for my $y (1, 0)
-119 {
-120 2 100 $y || last;
-121 1 $x[25]++;
-122 }
-123
-124 1 for my $y (0, 1)
-125 {
-126 2 100 $y && last;
-127 1 $x[26]++;
-128 }
-129
-130 1 for my $y (1, 0)
-131 {
-132 *** 1 50 $y && last;
-133 *** 0 $x[27]++;
-134 }
-135
-136 1 for my $y (0, 1)
-137 {
-138 1 1 no warnings "void";
- 1
- 1
-139 *** 1 0 my $w = $y xor last;
-140 *** 0 $x[28]++;
-141 }
-142
-143 1 for my $y (1, 0)
-144 {
-145 1 1 no warnings "void";
- 1
- 1
-146 *** 1 0 my $w = $y xor last;
-147 *** 0 $x[29]++;
-148 }
-149
-150
-151 1 for my $y (0, 1)
-152 {
-153 *** 1 50 $y || goto G1;
-154 *** 0 $x[30]++;
-155 }
-156 G1:
-157
-158 1 for my $y (1, 0)
-159 {
-160 2 100 $y || goto G2;
-161 1 $x[31]++;
-162 }
-163 G2:
-164
-165 1 for my $y (0, 1)
-166 {
-167 2 100 $y && goto G3;
-168 1 $x[32]++;
-169 }
-170 G3:
-171
-172 1 for my $y (1, 0)
-173 {
-174 *** 1 50 $y && goto G4;
-175 *** 0 $x[33]++;
-176 }
-177 G4:
-178
-179 1 for my $y (0, 1)
-180 {
-181 1 1 no warnings "void";
- 1
- 1
-182 *** 1 0 my $w = $y xor goto G5;
-183 *** 0 $x[34]++;
-184 }
-185 G5:
-186
-187 1 for my $y (1, 0)
-188 {
-189 1 1 no warnings "void";
- 1
- 1
-190 *** 1 0 my $w = $y xor goto G6;
-191 *** 0 $x[35]++;
-192 }
-193 G6:
-194
-195
-196 1 my $z;
-197
-198 1 $z = -1;
-199 1 for my $y (0, 1)
-200 {
-201 3 $z++;
-202 3 100 last if $z > 1;
-203 2 100 $z || redo;
-204 1 $x[36]++;
-205 }
-206
-207 1 $z = -1;
-208 1 for my $y (1, 0)
-209 {
-210 3 $z++;
-211 3 100 last if $z > 1;
-212 2 100 !$z || redo;
-213 1 $x[37]++;
-214 }
-215
-216 1 $z = -1;
-217 1 for my $y (0, 1)
-218 {
-219 3 $z++;
-220 3 100 last if $z > 1;
-221 2 100 $z && redo;
-222 1 $x[38]++;
-223 }
-224
-225 1 $z = -1;
-226 1 for my $y (1, 0)
-227 {
-228 3 $z++;
-229 3 100 last if $z > 1;
-230 2 100 !$z && redo;
-231 1 $x[39]++;
-232 }
-233
-234
-235 1 $z = -1;
-236 1 for my $y (0, 1)
-237 {
-238 3 $z++;
-239 3 100 last if $z > 1;
-240 1 1 no warnings "void";
- 1
- 1
-241 *** 2 0 my $w = $z xor redo;
-242 *** 0 $x[40]++;
-243 }
-244
-245 1 $z = -1;
-246 1 for my $y (1, 0)
-247 {
-248 3 $z++;
-249 3 100 last if $z > 1;
-250 1 1 no warnings "void";
- 1
- 1
-251 *** 2 0 my $w = !$z xor redo;
-252 *** 0 $x[41]++;
-253 }
-254
-255
-256 my @s =
-257 (
-258 sub
-259 {
-260 4 100 4 shift || return;
-261 2 $x[42]++;
-262 },
-263
-264 sub
-265 {
-266 4 100 4 shift && return;
-267 2 $x[43]++;
-268 },
-269
-270 sub
-271 {
-272 1 1 no warnings "void";
- 1
- 1
-273 *** 4 0 4 shift xor return;
-274 *** 0 $x[44]++;
-275 },
-276
-277 sub
-278 {
-279 4 100 4 my $x = shift || return;
-280 2 $x[45]++;
-281 },
-282
-283 sub
-284 {
-285 4 100 4 my $x = shift && return;
-286 2 $x[46]++;
-287 },
-288
-289 sub
-290 {
-291 4 4 my $x = shift;
-292 4 for my $y (1 .. 2)
-293 {
-294 6 100 my $z = $x || last;
-295 4 $x[47]++;
-296 }
-297 },
-298
-299 sub
-300 {
-301 4 4 my $x = shift;
-302 4 for my $y (1 .. 2)
-303 {
-304 8 100 my $z = $x || next;
-305 4 $x[48]++;
-306 }
-307 },
-308
-309 sub
-310 {
-311 4 4 my $x = shift;
-312 4 for my $y (1 .. 2)
-313 {
-314 10 100 my $z = $x++ || redo;
-315 8 $x[49]++;
-316 }
-317 },
-318
-319 sub
-320 {
-321 4 4 my $x = shift;
-322 4 for my $y (1 .. 2)
-323 {
-324 6 100 my $z = $x || goto GR;
-325 4 $x[50]++;
-326 }
-327 GR:
-328 4 },
-329
-330 sub
-331 {
-332 4 4 my $x = shift;
-333 4 for my $y (1 .. 2)
-334 {
-335 8 100 eval { my $z = $x || die };
- 8
-336 8 $x[51]++;
-337 }
-338 },
-339 1 );
-340
-341 1 for my $s (@s)
-342 {
-343 10 for my $y (0, 1)
-344 {
-345 20 $s->($y)
-346 }
-347
-348 10 for my $y (1, 0)
-349 {
-350 20 $s->($y)
-351 }
-352 }
-353
-354
-355 1 my ($a, $b) = (0, 1);
-356
-357 *** 1 50 33 if ($a && $b)
- *** 50 33
- *** 50 50
-358 {
-359 *** 0 print "path 1\n";
-360 }
-361 elsif (!$a && !$b)
-362 {
-363 *** 0 print "path 2\n";
-364 }
-365 elsif ($b || 0)
-366 {
-367 1 print "path 3\n";
-368 *** 1 50 33 if (!$b || $a)
- *** 50 33
-369 {
-370 *** 0 print "path 4\n";
-371 }
-372 elsif (!$a && $b)
-373 {
-374 1 print "path 5\n";
-375 }
-376 }
-
-
-Branches
---------
-
-line err % true false branch
------ --- ------ ------ ------ ------
-19 *** 50 0 4 if ($y and $z) { }
-27 100 2 2 if ($y or $z) { }
-36 *** 50 0 4 if $y
-37 *** 50 0 4 if $y
-39 100 2 2 if $z
-40 100 2 2 if $z
-42 *** 50 4 0 unless $y
-43 *** 50 4 0 unless $y
-45 100 2 2 unless $z
-46 100 2 2 unless $z
-48 *** 50 0 4 $y ? :
-49 100 2 2 $z ? :
-51 *** 50 0 4 if ($y) { }
- *** 50 0 4 elsif ($y and $z) { }
- 100 2 2 elsif ($y or $z) { }
-68 *** 0 0 0 if $y and $z
- *** 0 0 0 if $y and $z
-75 100 1 1 unless $y
-81 100 1 1 unless $y
-87 100 1 1 if $y
-93 100 1 1 if $y
-114 *** 50 1 0 unless $y
-120 100 1 1 unless $y
-126 100 1 1 if $y
-132 *** 50 1 0 if $y
-153 *** 50 1 0 unless $y
-160 100 1 1 unless $y
-167 100 1 1 if $y
-174 *** 50 1 0 if $y
-202 100 1 2 if $z > 1
-203 100 1 1 unless $z
-211 100 1 2 if $z > 1
-212 100 1 1 if $z
-220 100 1 2 if $z > 1
-221 100 1 1 if $z
-229 100 1 2 if $z > 1
-230 100 1 1 unless $z
-239 100 1 2 if $z > 1
-249 100 1 2 if $z > 1
-260 100 2 2 unless shift()
-266 100 2 2 if shift()
-357 *** 50 0 1 if ($a and $b) { }
- *** 50 0 1 elsif (not $a || $b) { }
- *** 50 1 0 elsif ($b or 0) { }
-368 *** 50 0 1 if (not $b or $a) { }
- *** 50 1 0 elsif (not $a and $b) { }
-
-
-Conditions
-----------
-
-and 2 conditions
-
-line err % l !l expr
------ --- ------ ------ ------ ----
-285 100 2 2 shift() && return
-
-and 3 conditions
-
-line err % !l l&&!r l&&r expr
------ --- ------ ------ ------ ------ ----
-19 *** 33 4 0 0 $y and $z
-51 *** 33 4 0 0 $y and $z
-68 *** 33 4 0 0 $y and $z
- *** 33 4 0 0 $y and $z
-357 *** 33 1 0 0 $a and $b
-368 *** 33 0 0 1 not $a and $b
-
-or 2 conditions
-
-line err % l !l expr
------ --- ------ ------ ------ ----
-279 100 2 2 shift() || return
-294 100 4 2 $x || last
-304 100 4 4 $x || next
-314 100 8 2 $x++ || redo
-324 100 4 2 $x || goto GR
-335 100 4 4 $x || die
-357 *** 50 1 0 $b or 0
-
-or 3 conditions
-
-line err % l !l&&r !l&&!r expr
------ --- ------ ------ ------ ------ ----
-27 *** 66 0 2 2 $y or $z
-51 *** 66 0 2 2 $y or $z
-357 *** 33 0 1 0 $a || $b
-368 *** 33 0 0 1 not $b or $a
-
-xor 4 conditions
-
-line err % l&&r l&&!r !l&&r !l&&!r expr
------ --- ------ ------ ------ ------ ------ ----
-100 *** 0 0 0 0 0 my $w = $y xor next
-107 *** 0 0 0 0 0 my $w = $y xor next
-139 *** 0 0 0 0 0 my $w = $y xor last
-146 *** 0 0 0 0 0 my $w = $y xor last
-182 *** 0 0 0 0 0 my $w = $y xor goto G5
-190 *** 0 0 0 0 0 my $w = $y xor goto G6
-241 *** 0 0 0 0 0 my $w = $z xor redo
-251 *** 0 0 0 0 0 my $w = !$z xor redo
-273 *** 0 0 0 0 0 shift() xor return
-
-
-Covered Subroutines
--------------------
-
-Subroutine Count Location
----------- ----- ---------------------
-BEGIN 1 tests/cond_branch:10
-BEGIN 1 tests/cond_branch:106
-BEGIN 1 tests/cond_branch:11
-BEGIN 1 tests/cond_branch:138
-BEGIN 1 tests/cond_branch:145
-BEGIN 1 tests/cond_branch:181
-BEGIN 1 tests/cond_branch:189
-BEGIN 1 tests/cond_branch:240
-BEGIN 1 tests/cond_branch:250
-BEGIN 1 tests/cond_branch:272
-BEGIN 1 tests/cond_branch:99
-__ANON__ 4 tests/cond_branch:260
-__ANON__ 4 tests/cond_branch:266
-__ANON__ 4 tests/cond_branch:273
-__ANON__ 4 tests/cond_branch:279
-__ANON__ 4 tests/cond_branch:285
-__ANON__ 4 tests/cond_branch:291
-__ANON__ 4 tests/cond_branch:301
-__ANON__ 4 tests/cond_branch:311
-__ANON__ 4 tests/cond_branch:321
-__ANON__ 4 tests/cond_branch:332
-
-
View
564 test_output/cover/cond_branch.5.015006
@@ -1,564 +0,0 @@
-Reading database from ...
-
-
------------------------------------------- ------ ------ ------ ------ ------
-File stmt bran cond sub total
------------------------------------------- ------ ------ ------ ------ ------
-tests/cond_branch 90.3 77.2 32.9 100.0 75.7
-Total 90.3 77.2 32.9 100.0 75.7
------------------------------------------- ------ ------ ------ ------ ------
-
-
-Run: ...
-Perl version: ...
-OS: ...
-Start: ...
-Finish: ...
-
-tests/cond_branch
-
-line err stmt bran cond sub code
-1 #!/usr/bin/perl
-2
-3 # Copyright 2002-2011, Paul Johnson (pjcj@cpan.org)
-4
-5 # This software is free. It is licensed under the same terms as Perl itself.
-6
-7 # The latest version of this software should be available from my homepage:
-8 # http://www.pjcj.net
-9
-10 1 1 use strict;
- 1
- 1
-11 1 1 use warnings;
- 1
- 1
-12
-13 1 my @x;
-14
-15 1 for my $y (0, 0)
-16 {
-17 2 for my $z (1, 0)
-18 {
-19 *** 4 50 33 if ($y && $z)
-20 {
-21 *** 0 $x[1]++;
-22 }
-23 else
-24 {
-25 4 $x[2]++;
-26 }
-27 *** 4 100 66 if ($y || $z)
-28 {
-29 2 $x[3]++;
-30 }
-31 else
-32 {
-33 2 $x[4]++;
-34 }
-35
-36 *** 4 50 $y && $x[5]++;
-37 *** 4 50 $x[5]++ if $y;
-38
-39 4 100 $z && $x[6]++;
-40 4 100 $x[6]++ if $z;
-41
-42 *** 4 50 $y || $x[7]++;
-43 *** 4 50 $x[7]++ unless $y;
-44
-45 4 100 $z || $x[8]++;
-46 4 100 $x[8]++ unless $z;
-47
-48 *** 4 50 $y ? $x[9]++ : $x[10]++;
-49 4 100 $z ? $x[11]++ : $x[12]++;
-50
-51 *** 4 50 33 if ($y)
- *** 50 66
- 100
-52 {
-53 *** 0 $x[13]++;
-54 }
-55 elsif ($y && $z)
-56 {
-57 *** 0 $x[14]++;
-58 }
-59 elsif ($y || $z)
-60 {
-61 2 $x[15]++;
-62 }
-63 else
-64 {
-65 2 $x[16]++;
-66 }
-67
-68 *** 4 0 33 $y && $z && $x[17]++; $y && $z && $x[18]++;
- *** 4 0 33
-69 }
-70 }
-71
-72
-73 1 for my $y (0, 1)
-74 {
-75 2 100 $y || next;
-76 1 $x[18]++;
-77 }
-78
-79 1 for my $y (1, 0)
-80 {
-81 2 100 $y || next;
-82 1 $x[19]++;
-83 }
-84
-85 1 for my $y (0, 1)
-86 {
-87 2 100 $y && next;
-88 1 $x[20]++;
-89 }
-90
-91 1 for my $y (1, 0)
-92 {
-93 2 100 $y && next;
-94 1 $x[21]++;
-95 }
-96
-97 1 for my $y (0, 1)
-98 {
-99 1 1 no warnings "void";
- 1
- 1
-100 *** 2 0 my $w = $y xor next;
-101 *** 0 $x[22]++;
-102 }
-103
-104 1 for my $y (1, 0)
-105 {
-106 1 1 no warnings "void";
- 1
- 1
-107 *** 2 0 my $w = $y xor next;
-108 *** 0 $x[23]++;
-109 }
-110
-111
-112 1 for my $y (0, 1)
-113 {
-114 *** 1 50 $y || last;
-115 *** 0 $x[24]++;
-116 }
-117
-118 1 for my $y (1, 0)
-119 {
-120 2 100 $y || last;
-121 1 $x[25]++;
-122 }
-123
-124 1 for my $y (0, 1)
-125 {
-126 2 100 $y && last;
-127 1 $x[26]++;
-128 }
-129
-130 1 for my $y (1, 0)
-131 {
-132 *** 1 50 $y && last;
-133 *** 0 $x[27]++;
-134 }
-135
-136 1 for my $y (0, 1)
-137 {
-138 1 1 no warnings "void";
- 1
- 1
-139 *** 1 0 my $w = $y xor last;
-140 *** 0 $x[28]++;
-141 }
-142
-143 1 for my $y (1, 0)
-144 {
-145 1 1 no warnings "void";
- 1
- 1
-146 *** 1 0 my $w = $y xor last;
-147 *** 0 $x[29]++;
-148 }
-149
-150
-151 1 for my $y (0, 1)
-152 {
-153 *** 1 50 $y || goto G1;
-154 *** 0 $x[30]++;
-155 }
-156 G1:
-157
-158 1 for my $y (1, 0)
-159 {
-160 2 100 $y || goto G2;
-161 1 $x[31]++;
-162 }
-163 G2:
-164
-165 1 for my $y (0, 1)
-166 {
-167 2 100 $y && goto G3;
-168 1 $x[32]++;
-169 }
-170 G3:
-171
-172 1 for my $y (1, 0)
-173 {
-174 *** 1 50 $y && goto G4;
-175 *** 0 $x[33]++;
-176 }
-177 G4:
-178
-179 1 for my $y (0, 1)
-180 {
-181 1 1 no warnings "void";
- 1
- 1
-182 *** 1 0 my $w = $y xor goto G5;
-183 *** 0 $x[34]++;
-184 }
-185 G5:
-186
-187 1 for my $y (1, 0)
-188 {
-189 1 1 no warnings "void";
- 1
- 1
-190 *** 1 0 my $w = $y xor goto G6;
-191 *** 0 $x[35]++;
-192 }
-193 G6:
-194
-195
-196 1 my $z;
-197
-198 1 $z = -1;
-199 1 for my $y (0, 1)
-200 {
-201 3 $z++;
-202 3 100 last if $z > 1;
-203 2 100 $z || redo;
-204 1 $x[36]++;
-205 }
-206
-207 1 $z = -1;
-208 1 for my $y (1, 0)
-209 {
-210 3 $z++;
-211 3 100 last if $z > 1;
-212 2 100 !$z || redo;
-213 1 $x[37]++;
-214 }
-215
-216 1 $z = -1;
-217 1 for my $y (0, 1)
-218 {
-219 3 $z++;
-220 3 100 last if $z > 1;
-221 2 100 $z && redo;
-222 1 $x[38]++;
-223 }
-224
-225 1 $z = -1;
-226 1 for my $y (1, 0)
-227 {
-228 3 $z++;
-229 3 100 last if $z > 1;
-230 2 100 !$z && redo;
-231 1 $x[39]++;
-232 }
-233
-234
-235 1 $z = -1;
-236 1 for my $y (0, 1)
-237 {
-238 3 $z++;
-239 3 100 last if $z > 1;
-240 1 1 no warnings "void";
- 1
- 1
-241 *** 2 0 my $w = $z xor redo;
-242 *** 0 $x[40]++;
-243 }
-244
-245 1 $z = -1;
-246 1 for my $y (1, 0)
-247 {
-248 3 $z++;
-249 3 100 last if $z > 1;
-250 1 1 no warnings "void";
- 1
- 1
-251 *** 2 0 my $w = !$z xor redo;
-252 *** 0 $x[41]++;
-253 }
-254
-255
-256 my @s =
-257 (
-258 sub
-259 {
-260 4 100 4 shift || return;
-261 2 $x[42]++;
-262 },
-263
-264 sub
-265 {
-266 4 100 4 shift && return;
-267 2 $x[43]++;
-268 },
-269
-270 sub
-271 {
-272 1 1 no warnings "void";
- 1
- 1
-273 *** 4 0 4 shift xor return;
-274 *** 0 $x[44]++;
-275 },
-276
-277 sub
-278 {
-279 4 100 4 my $x = shift || return;
-280 2 $x[45]++;
-281 },
-282
-283 sub
-284 {
-285 4 100 4 my $x = shift && return;
-286 2 $x[46]++;
-287 },
-288
-289 sub
-290 {
-291 4 4 my $x = shift;
-292 4 for my $y (1 .. 2)
-293 {
-294 6 100 my $z = $x || last;
-295 4 $x[47]++;
-296 }
-297 },
-298
-299 sub
-300 {
-301 4 4 my $x = shift;
-302 4 for my $y (1 .. 2)
-303 {
-304 8 100 my $z = $x || next;
-305 4 $x[48]++;
-306 }
-307 },
-308
-309 sub
-310 {
-311 4 4 my $x = shift;
-312 4 for my $y (1 .. 2)
-313 {
-314 10 100 my $z = $x++ || redo;
-315 8 $x[49]++;
-316 }
-317 },
-318
-319 sub
-320 {
-321 4 4 my $x = shift;
-322 4 for my $y (1 .. 2)
-323 {
-324 6 100 my $z = $x || goto GR;
-325 4 $x[50]++;
-326 }
-327 GR:
-328 4 },
-329
-330 sub
-331 {
-332 4 4 my $x = shift;
-333 4 for my $y (1 .. 2)
-334 {
-335 8 100 eval { my $z = $x || die };
- 8
-336 8 $x[51]++;
-337 }
-338 },
-339 1 );
-340
-341 1 for my $s (@s)
-342 {
-343 10 for my $y (0, 1)
-344 {
-345 20 $s->($y)
-346 }
-347
-348 10 for my $y (1, 0)
-349 {
-350 20 $s->($y)
-351 }
-352 }
-353
-354
-355 1 my ($a, $b) = (0, 1);
-356
-357 *** 1 50 33 if ($a && $b)
- *** 50 33
- *** 50 50
-358 {
-359 *** 0 print "path 1\n";
-360 }
-361 elsif (!$a && !$b)
-362 {
-363 *** 0 print "path 2\n";
-364 }
-365 elsif ($b || 0)
-366 {
-367 1 print "path 3\n";
-368 *** 1 50 33 if (!$b || $a)
- *** 50 33
-369 {
-370 *** 0 print "path 4\n";
-371 }
-372 elsif (!$a && $b)
-373 {
-374 1 print "path 5\n";
-375 }
-376 }
-
-
-Branches
---------
-
-line err % true false branch
------ --- ------ ------ ------ ------
-19 *** 50 0 4 if ($y and $z) { }
-27 100 2 2 if ($y or $z) { }
-36 *** 50 0 4 if $y
-37 *** 50 0 4 if $y
-39 100 2 2 if $z
-40 100 2 2 if $z
-42 *** 50 4 0 unless $y
-43 *** 50 4 0 unless $y
-45 100 2 2 unless $z
-46 100 2 2 unless $z
-48 *** 50 0 4 $y ? :
-49 100 2 2 $z ? :
-51 *** 50 0 4 if ($y) { }
- *** 50 0 4 elsif ($y and $z) { }
- 100 2 2 elsif ($y or $z) { }
-68 *** 0 0 0 if $y and $z
- *** 0 0 0 if $y and $z
-75 100 1 1 unless $y
-81 100 1 1 unless $y
-87 100 1 1 if $y
-93 100 1 1 if $y
-114 *** 50 1 0 unless $y
-120 100 1 1 unless $y
-126 100 1 1 if $y
-132 *** 50 1 0 if $y
-153 *** 50 1 0 unless $y
-160 100 1 1 unless $y
-167 100 1 1 if $y
-174 *** 50 1 0 if $y
-202 100 1 2 if $z > 1
-203 100 1 1 unless $z
-211 100 1 2 if $z > 1
-212 100 1 1 if $z
-220 100 1 2 if $z > 1
-221 100 1 1 if $z
-229 100 1 2 if $z > 1
-230 100 1 1 unless $z
-239 100 1 2 if $z > 1
-249 100 1 2 if $z > 1
-260 100 2 2 unless shift()
-266 100 2 2 if shift()
-357 *** 50 0 1 if ($a and $b) { }
- *** 50 0 1 elsif (not $a || $b) { }
- *** 50 1 0 elsif ($b or 0) { }
-368 *** 50 0 1 if (not $b or $a) { }
- *** 50 1 0 elsif (not $a and $b) { }
-
-
-Conditions
-----------
-
-and 2 conditions
-
-line err % l !l expr
------ --- ------ ------ ------ ----
-285 100 2 2 shift() && (return)
-
-and 3 conditions
-
-line err % !l l&&!r l&&r expr
------ --- ------ ------ ------ ------ ----
-19 *** 33 4 0 0 $y and $z
-51 *** 33 4 0 0 $y and $z
-68 *** 33 4 0 0 $y and $z
- *** 33 4 0 0 $y and $z
-357 *** 33 1 0 0 $a and $b
-368 *** 33 0 0 1 not $a and $b
-
-or 2 conditions
-
-line err % l !l expr
------ --- ------ ------ ------ ----
-279 100 2 2 shift() || (return)
-294 100 4 2 $x || last
-304 100 4 4 $x || next
-314 100 8 2 $x++ || redo
-324 100 4 2 $x || goto GR
-335 100 4 4 $x || die()
-357 *** 50 1 0 $b or 0
-
-or 3 conditions
-
-line err % l !l&&r !l&&!r expr
------ --- ------ ------ ------ ------ ----
-27 *** 66 0 2 2 $y or $z
-51 *** 66 0 2 2 $y or $z
-357 *** 33 0 1 0 $a || $b
-368 *** 33 0 0 1 not $b or $a
-
-xor 4 conditions
-
-line err % l&&r l&&!r !l&&r !l&&!r expr
------ --- ------ ------ ------ ------ ------ ----
-100 *** 0 0 0 0 0 my $w = $y xor next
-107 *** 0 0 0 0 0 my $w = $y xor next
-139 *** 0 0 0 0 0 my $w = $y xor last
-146 *** 0 0 0 0 0 my $w = $y xor last
-182 *** 0 0 0 0 0 my $w = $y xor goto G5
-190 *** 0 0 0 0 0 my $w = $y xor goto G6
-241 *** 0 0 0 0 0 my $w = $z xor redo
-251 *** 0 0 0 0 0 my $w = !$z xor redo
-273 *** 0 0 0 0 0 shift() xor return
-
-
-Covered Subroutines
--------------------
-
-Subroutine Count Location
----------- ----- ---------------------
-BEGIN 1 tests/cond_branch:10
-BEGIN 1 tests/cond_branch:106
-BEGIN 1 tests/cond_branch:11
-BEGIN 1 tests/cond_branch:138
-BEGIN 1 tests/cond_branch:145
-BEGIN 1 tests/cond_branch:181
-BEGIN 1 tests/cond_branch:189
-BEGIN 1 tests/cond_branch:240
-BEGIN 1 tests/cond_branch:250
-BEGIN 1 tests/cond_branch:272
-BEGIN 1 tests/cond_branch:99
-__ANON__ 4 tests/cond_branch:260
-__ANON__ 4 tests/cond_branch:266
-__ANON__ 4 tests/cond_branch:273
-__ANON__ 4 tests/cond_branch:279
-__ANON__ 4 tests/cond_branch:285
-__ANON__ 4 tests/cond_branch:291
-__ANON__ 4 tests/cond_branch:301
-__ANON__ 4 tests/cond_branch:311
-__ANON__ 4 tests/cond_branch:321
-__ANON__ 4 tests/cond_branch:332
-
-
View
283 test_output/cover/cond_or.5.015001
@@ -1,283 +0,0 @@
-Reading database from ...
-
-
------------------------------------------- ------ ------ ------ ------ ------
-File stmt bran cond sub total
------------------------------------------- ------ ------ ------ ------ ------
-tests/cond_or 90.7 30.0 72.3 75.0 73.6
-tests/cond_or.pl 100.0 n/a 62.5 100.0 78.6
-Total 93.8 30.0 67.8 85.7 75.4
------------------------------------------- ------ ------ ------ ------ ------
-
-
-Run: ...
-Perl version: ...
-OS: ...
-Start: ...
-Finish: ...
-
-tests/cond_or
-
-line err stmt bran cond sub code
-1 #!/usr/bin/perl
-2
-3 # Copyright 2002-2011, Paul Johnson (pjcj@cpan.org)
-4
-5 # This software is free. It is licensed under the same terms as Perl itself.
-6
-7 # The latest version of this software should be available from my homepage:
-8 # http://www.pjcj.net
-9
-10 # __COVER__ skip_test $] < 5.008 || $^O eq "cygwin"
-11 # __COVER__ skip_reason Busted on 5.6 and cygwin
-12
-13 1 1 use strict;
- 1
- 1
-14 1 1 use warnings;
- 1
- 1
-15
-16 1 my @x;
-17
-18 1 my $y = 1;
-19 1 my $z = 0;
-20 1 $::foo = 17;
-21
-22 *** 1 50 if ($] >= 5.009)
-23 {
-24 1 $ENV{PATH} = "/bin";
-25 1 system "pwd";
-26 1 1 use lib "tests";
- 1
- 1
-27 1 my $file = "cond_or.pl";
-28 *** 1 50 unless (my $return = do $file)
-29 {
-30 *** 0 0 die "couldn't parse $file: $@" if $@;
-31 *** 0 0 die "couldn't do $file: $!" unless defined $return;
-32 *** 0 0 die "couldn't run $file" unless $return;
-33 }
-34 }
-35
-36 1 for (0 .. 10)
-37 {
-38 *** 11 50 $y ||
-39 $x[1]++;
-40
-41 *** 11 0 33 $y ||
-42 $x[0]++ ||
-43 $x[1]++;
-44
-45 *** 11 50 $x[2]++
-46 unless $z;
-47
-48 11 for (0 .. 2)
-49 {
-50 33 $x[3]++;
-51 }
-52
-53 *** 11 50 if ($z)
-54 {
-55 *** 0 $x[4]++;
-56 }
-57 else
-58 {
-59 11 $x[5]++;
-60 }
-61
-62 *** 11 33 my $p = $y || $z;
-63 *** 11 33 my $q = $z || $y;
-64 11 100 my $r = $_ || "qqq";
-65 11 100 my $s = $_ || [];
-66 11 my $t = $y | $z;
-67 *** 11 50 my $u = $y || 0;
-68 *** 11 50 my $v = $y || undef;
-69 *** 11 50 my $w = $z || 0;
-70
-71 *** 11 50 $p ||= $y;
-72 *** 11 50 $p ||= $z;
-73 11 100 $x[ 6] ||= $y;
-74 *** 11 50 $x[ 7] ||= $z;
-75 11 100 $x[ 8] ||= 1;
-76 11 100 $x[ 9] ||= {};
-77 11 100 $x[10] ||= \"foo";
-78 11 100 $x[11] ||= \$y;
-79 11 100 $x[12] ||= \*STDIO;
-80 *** 11 100 0 $x[13] ||= sub { 1 };
- *** 0
-81 11 100 $x[14] ||= *::foo{SCALAR};
-82 *** 11 50 $x[15] ||= *STDIO{IO};
-83 11 100 $x[16] ||= bless {}, "XXX";
-84 11 100 $x[17] ||= <<"EOD";
-85 blah
-86 EOD
-87 *** 11 50 cond_dor(\@x) if exists &cond_dor;
-88 }
-89
-90 # print join(", ", @x), "\n";
-
-
-Branches
---------
-
-line err % true false branch
------ --- ------ ------ ------ ------
-22 *** 50 1 0 if ($] >= 5.009)
-28 *** 50 0 1 unless (my $return = do $file)
-30 *** 0 0 0 if $@
-31 *** 0 0 0 unless defined $return
-32 *** 0 0 0 unless $return
-38 *** 50 0 11 unless $y
-41 *** 0 0 0 unless $y or $x[0]++
-45 *** 50 11 0 unless $z
-53 *** 50 0 11 if ($z) { }
-87 *** 50 11 0 if exists &cond_dor
-
-
-Conditions
-----------
-
-or 2 conditions
-
-line err % l !l expr
------ --- ------ ------ ------ ----
-64 100 10 1 $_ || 'qqq'
-65 100 10 1 $_ || []
-67 *** 50 11 0 $y || 0
-68 *** 50 11 0 $y || undef
-69 *** 50 0 11 $z || 0
-71 *** 50 11 0 $p ||= $y
-72 *** 50 11 0 $p ||= $z
-73 100 10 1 $x[6] ||= $y
-74 *** 50 0 11 $x[7] ||= $z
-75 100 10 1 $x[8] ||= 1
-76 100 10 1 $x[9] ||= {}
-77 100 10 1 $x[10] ||= \'foo'
-78 100 10 1 $x[11] ||= \$y
-79 100 10 1 $x[12] ||= \*STDIO
-80 100 10 1 $x[13] ||= sub {
- 1;
-}
-
-81 100 10 1 $x[14] ||= *foo{'SCALAR'}
-82 *** 50 0 11 $x[15] ||= *STDIO{'IO'}
-83 100 10 1 $x[16] ||= bless({}, 'XXX')
-84 100 10 1 $x[17] ||= "blah\n"
-
-or 3 conditions
-
-line err % l !l&&r !l&&!r expr
------ --- ------ ------ ------ ------ ----
-41 *** 33 11 0 0 $y or $x[0]++
-62 *** 33 11 0 0 $y || $z
-63 *** 33 0 11 0 $z || $y
-
-
-Covered Subroutines
--------------------
-
-Subroutine Count Location
----------- ----- ----------------
-BEGIN 1 tests/cond_or:13
-BEGIN 1 tests/cond_or:14
-BEGIN 1 tests/cond_or:26
-
-Uncovered Subroutines
----------------------
-
-Subroutine Count Location
----------- ----- ----------------
-__ANON__ 0 tests/cond_or:80
-
-
-tests/cond_or.pl
-
-line err stmt bran cond sub code
-1 #!/usr/bin/perl
-2
-3 # Copyright 2002-2011, Paul Johnson (pjcj@cpan.org)
-4
-5 # This software is free. It is licensed under the same terms as Perl itself.
-6
-7 # The latest version of this software should be available from my homepage:
-8 # http://www.pjcj.net
-9
-10 1 1 use strict;
- 1
- 1
-11 1 1 use warnings;
- 1
- 1
-12
-13 sub cond_dor
-14 {
-15 11 11 my ($x) = @_;
-16
-17 11 100 $x->[18] //= undef;
-18 11 100 $x->[18] //= 0;
-19 *** 11 50 $x->[18] //= 0;
-20 *** 11 50 $x->[18] //= 1;
-21 *** 11 50 $x->[18] //= 1;
-22
-23 11 100 $x->[19] //= 1;
-24 *** 11 50 $x->[19] //= 1;
-25 *** 11 50 $x->[19] //= 0;
-26 *** 11 50 $x->[19] //= undef;
-27 *** 11 50 $x->[19] //= 1;
-28
-29 *** 11 50 $x->[20] = $x->[21] // undef;
-30 *** 11 50 $x->[20] = $x->[21] // 0;
-31 *** 11 50 $x->[20] = $x->[21] // 0;
-32 *** 11 50 $x->[20] = $x->[21] // 1;
-33 *** 11 50 $x->[20] = $x->[21] // 1;
-34
-35 11 100 $x->[22] = $x->[22] // undef;
-36 11 100 $x->[22] = $x->[22] // 0;
-37 *** 11 50 $x->[22] = $x->[22] // 0;
-38 *** 11 50 $x->[22] = $x->[22] // 1;
-39 *** 11 50 $x->[22] = $x->[22] // 1;
-40 }
-41
-42 1;
-
-
-Conditions
-----------
-
-or 2 conditions
-
-line err % l !l expr
------ --- ------ ------ ------ ----
-17 100 10 1 $$x[18] //= undef
-18 100 10 1 $$x[18] //= 0
-19 *** 50 11 0 $$x[18] //= 0
-20 *** 50 11 0 $$x[18] //= 1
-21 *** 50 11 0 $$x[18] //= 1
-23 100 10 1 $$x[19] //= 1
-24 *** 50 11 0 $$x[19] //= 1
-25 *** 50 11 0 $$x[19] //= 0
-26 *** 50 11 0 $$x[19] //= undef
-27 *** 50 11 0 $$x[19] //= 1
-29 *** 50 0 11 $$x[21] // undef
-30 *** 50 0 11 $$x[21] // 0
-31 *** 50 0 11 $$x[21] // 0
-32 *** 50 0 11 $$x[21] // 1
-33 *** 50 0 11 $$x[21] // 1
-35 100 10 1 $$x[22] // undef
-36 100 10 1 $$x[22] // 0
-37 *** 50 11 0 $$x[22] // 0
-38 *** 50 11 0 $$x[22] // 1
-39 *** 50 11 0 $$x[22] // 1
-
-
-Covered Subroutines
--------------------
-
-Subroutine Count Location
----------- ----- -------------------
-BEGIN 1 tests/cond_or.pl:10
-BEGIN 1 tests/cond_or.pl:11
-cond_dor 11 tests/cond_or.pl:15
-
-
Please sign in to comment.
Something went wrong with that request. Please try again.