Add test/bisect.sh for use with "git bisect"
authorVictor van den Elzen <victor.vde@gmail.com>
Wed, 11 Nov 2009 06:47:39 +0000 (07:47 +0100)
committerVictor van den Elzen <victor.vde@gmail.com>
Wed, 11 Nov 2009 06:47:39 +0000 (07:47 +0100)
test/bisect.sh [new file with mode: 0755]
test/performtest.pl

diff --git a/test/bisect.sh b/test/bisect.sh
new file mode 100755 (executable)
index 0000000..98bdb37
--- /dev/null
@@ -0,0 +1,22 @@
+#!/bin/sh
+
+# Usage:
+
+# Make a test and a golden file, read ./performtest.pl --help
+
+# cd nasm
+# cp -r test somewhere (copy test dir out of the tree)
+# git bisect start HEAD nasm-2.07 (where HEAD is bad and nasm-2.07 is good)
+# git bisect run somewhere/test/bisect.sh br2148476 (what you want to test)
+
+# Done
+
+
+# Slow but sure
+./autogen.sh
+./configure
+make
+
+NASMDIR=$(pwd)
+cd $(dirname "$0")
+./performtest.pl "--nasm=$NASMDIR/nasm" "$1.asm" --verbose
index f9b7bb2..f7865b3 100755 (executable)
@@ -15,6 +15,8 @@ use File::Path qw(mkpath rmtree);
 #sub debugprint { print (pop() . "\n"); }
  sub debugprint { }
 
+my $globalresult = 0;
+
 #Process one testfile
 sub perform {
     my ($clean, $diff, $golden, $nasm, $quiet, $testpath) = @_;
@@ -80,6 +82,7 @@ sub perform {
                     if($temp == 1) {
                         #different
                         $result = 1;
+                        $globalresult = 1;
                         push @failedfiles, $_;
                     } elsif($temp == -1) {
                         #error
@@ -89,6 +92,7 @@ sub perform {
                 } elsif (-f "golden/$testname/$subname/$_") {
                     #File exists in golden but not in output
                     $result = 1;
+                    $globalresult = 1;
                     push @failedfiles, $_;
                 }
             }
@@ -139,7 +143,7 @@ unless (!defined $nasm or -x $nasm) {
 }
 
 perform($clean, $diff, $golden, $nasm, ! $verbose, $_) foreach @ARGV;
-
+exit $globalresult;
 
 __END__