test: fix bisecting issue in fuzzer-find-diff.pl
authorSiarhei Siamashka <siarhei.siamashka@gmail.com>
Wed, 6 Jun 2012 20:54:20 +0000 (23:54 +0300)
committerSiarhei Siamashka <siarhei.siamashka@gmail.com>
Tue, 12 Jun 2012 01:21:57 +0000 (04:21 +0300)
Before bisecting to find the exact test which has failed, we
first need to make sure that the first test is fine (the first
test is "good" and the whole range is "bad"). Otherwise
test 2 gets incorrectly flagged as problematic in the case
if we already got a failure on test 1 right from the start.

test/fuzzer-find-diff.pl

index 53d9b8d..e1d67fb 100755 (executable)
@@ -29,10 +29,17 @@ sub test_range {
     my $min = shift;
     my $max = shift;
 
+    # check that [$min, $max] range is "bad", otherwise return
     if (`$ARGV[0] $min $max 2>/dev/null` eq `$ARGV[1] $min $max 2>/dev/null`) {
         return;
     }
 
+    # check that $min itself is "good", otherwise return
+    if (`$ARGV[0] $min 2>/dev/null` ne `$ARGV[1] $min 2>/dev/null`) {
+        return $min;
+    }
+
+    # start bisecting
     while ($max != $min + 1) {
         my $avg = int(($min + $max) / 2);
         my $res1 = `$ARGV[0] $min $avg 2>/dev/null`;