fate: Add oneline comparison method
authorMans Rullgard <mans@mansr.com>
Thu, 3 May 2012 22:43:11 +0000 (15:43 -0700)
committerAlex Converse <alex.converse@gmail.com>
Mon, 7 May 2012 17:14:50 +0000 (10:14 -0700)
Signed-off-by: Alex Converse <alex.converse@gmail.com>
tests/fate-run.sh

index f7a7aba..8097eec 100755 (executable)
@@ -60,6 +60,12 @@ stddev(){
     do_tiny_psnr "$1" "$2" stddev
 }
 
     do_tiny_psnr "$1" "$2" stddev
 }
 
+oneline(){
+    val=$(cat "$2")
+    test x"$val" = x"$1" || { r=$?; printf -- '-%s\n+%s\n' "$ref" "$val"; }
+    return ${r:-0}
+}
+
 run(){
     test "${V:-0}" -gt 0 && echo "$target_exec" $target_path/"$@" >&3
     $target_exec $target_path/"$@"
 run(){
     test "${V:-0}" -gt 0 && echo "$target_exec" $target_path/"$@" >&3
     $target_exec $target_path/"$@"
@@ -147,11 +153,12 @@ if [ $err -gt 128 ]; then
     test "${sig}" = "${sig%[!A-Za-z]*}" || unset sig
 fi
 
     test "${sig}" = "${sig%[!A-Za-z]*}" || unset sig
 fi
 
-if test -e "$ref"; then
+if test -e "$ref" || test $cmp = "oneline" ; then
     case $cmp in
         diff)   diff -u -w "$ref" "$outfile"            >$cmpfile ;;
         oneoff) oneoff     "$ref" "$outfile"            >$cmpfile ;;
         stddev) stddev     "$ref" "$outfile"            >$cmpfile ;;
     case $cmp in
         diff)   diff -u -w "$ref" "$outfile"            >$cmpfile ;;
         oneoff) oneoff     "$ref" "$outfile"            >$cmpfile ;;
         stddev) stddev     "$ref" "$outfile"            >$cmpfile ;;
+        oneline)oneline    "$ref" "$outfile"            >$cmpfile ;;
         null)   cat               "$outfile"            >$cmpfile ;;
     esac
     cmperr=$?
         null)   cat               "$outfile"            >$cmpfile ;;
     esac
     cmperr=$?