From: John P. Linderman Date: Fri, 5 Apr 2002 07:13:27 +0000 (-0500) Subject: Re: lib/sort.t failure (and [PATCH]) X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=28e9118f23dc1b501af6ee6c0b70d68a5df2d3f2;p=p5sagit%2Fp5-mst-13.2.git Re: lib/sort.t failure (and [PATCH]) From: "John P. Linderman" Message-ID: <200204051213.HAA13004@raptor.research.att.com> p4raw-id: //depot/perl@15741 --- diff --git a/lib/sort.t b/lib/sort.t index c132a5c..52d1d8b 100644 --- a/lib/sort.t +++ b/lib/sort.t @@ -58,15 +58,18 @@ sub genarray { sub checkorder { my $aref = shift; my $status = ''; # so far, so good - my $i; + my ($i, $disorder); for ($i = 0; $i < $#$aref; ++$i) { - next if ($aref->[$i] lt $aref->[$i+1]); - $status = (substr($aref->[$i], 0, $RootWidth) eq - substr($aref->[$i+1], 0, $RootWidth)) ? - "Instability" : "Disorder"; - $status .= " at element $i between $aref->[$i] and $aref->[$i+1]"; - last; + # Equality shouldn't happen, but catch it in the contents check + next if ($aref->[$i] le $aref->[$i+1]); + $disorder = (substr($aref->[$i], 0, $RootWidth) eq + substr($aref->[$i+1], 0, $RootWidth)) ? + "Instability" : "Disorder"; + # Keep checking if merely unstable... disorder is much worse. + $status = + "$disorder at element $i between $aref->[$i] and $aref->[$i+1]"; + last unless ($disorder eq "Instability"); } return $status; } @@ -121,6 +124,11 @@ sub main { $status = checkequal(\@sorted, $unsorted); is($status, '', "contents ok for size $ts"); } + # P5P: The following test (#58) has been observed failing on + # a solaris 2.8 platform. Failure doesn't mean that sort is + # misbehaving, it is just exhibiting an exceedingly unlikely + # pattern of breaking ties. If you see no other failures, + # it should be perfectly safe to install. if ($expect_unstable) { ok($unstable_num > 0, 'Instability ok'); }