From 28e9118f23dc1b501af6ee6c0b70d68a5df2d3f2 Mon Sep 17 00:00:00 2001 From: "John P. Linderman" Date: Fri, 5 Apr 2002 02:13:27 -0500 Subject: [PATCH 1/1] Re: lib/sort.t failure (and [PATCH]) From: "John P. Linderman" Message-ID: <200204051213.HAA13004@raptor.research.att.com> p4raw-id: //depot/perl@15741 --- lib/sort.t | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-) 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'); } -- 1.8.3.1