Add -pass-thresh parameter.

To control the threshold for the "PASS ratio is abnormally low" error
message.
The use case is binutils testing, where cross tools have a high enough
number of UNTESTED/UNSUPPORTED tests, leading to a pass rate of about
93%, which is below the current default of 95%, which we want to keep
for GCC validations.

Change-Id: Iad359f3efda19e4d70cf6e8776e8d541d582b42a
diff --git a/compare_tests b/compare_tests
index d98f7fe..39f74a3 100755
--- a/compare_tests
+++ b/compare_tests
@@ -13,7 +13,7 @@
 		echo >&2
 	fi
 	cat >&2 <<EOUSAGE
-Usage: $0 [-target target-triplet] PREVIOUS CURRENT
+Usage: $0 [-target target-triplet] [-pass-thresh pass-ratio-threshold] PREVIOUS CURRENT
 
 Compare the PREVIOUS and CURRENT test case .sum files, reporting anything of interest.
 
@@ -23,6 +23,9 @@
         -target enables to provide the target name to use when parsing
          the file containing the list of unstable tests.
 
+        -pass-thresh controls the level of warning when too few tests
+         pass.
+
 	Exit with the following values:
 		0 if there is nothing of interest
 		1 if there are improvements
@@ -54,8 +57,29 @@
 sum2=/tmp/$tool-sum2.$$
 tmps="$tmp1 $tmp2 $now_s $before_s $lst1 $lst2 $lst3 $lst4 $lst5 $sum1 $sum2"
 
-[ "$1" = "-target" ] && target=$2 && shift 2
-[ "$1" = "-?" ] && usage
+while [ $# -gt 2 ]
+do
+    case "$1" in
+	"-target")
+	    target=$2
+	    shift 2
+	    ;;
+	"-pass-thresh")
+	    pass_thresh=$2
+	    shift 2
+	    ;;
+	"-?")
+	    usage
+	    ;;
+	*)
+	    if [ $# -gt 2 ]; then
+		echo "ERROR: Too many arguments: $@"
+		usage
+	    fi
+	    ;;
+    esac
+done
+
 [ "$2" = "" ] && usage "Must specify both PREVIOUS and CURRENT"
 
 trap "rm -f $tmps" 0 1 2 3 5 9 13 15
@@ -113,7 +137,7 @@
 		unstable_target="$unstable_target --unstable-marker $board"
 	    fi
 	done
-	${CONFIG_SHELL-/usr/bin/perl} ${my_path}/compare_dg_tests.pl -l --unstable-test=${my_path}/unstable-tests.txt ${unstable_target} $sum1 $sum2
+	${CONFIG_SHELL-/usr/bin/perl} ${my_path}/compare_dg_tests.pl ${pass_thresh:+-pass-thresh=${pass_thresh}} -l --unstable-test=${my_path}/unstable-tests.txt ${unstable_target} $sum1 $sum2
 	ret=$?
 	case $ret in
 	    2)