changeset 34440:57d1ace7fb63

Clean up faterun.sh. Better variable names, less duplicated code, some whitespace, variable quoting...
author reimar
date Sun, 08 Jan 2012 09:28:51 +0000
parents 9441cb91bddd
children 4496c52ff7f1
files tests/faterun.sh
diffstat 1 files changed, 19 insertions(+), 9 deletions(-) [+]
line wrap: on
line diff
--- a/tests/faterun.sh	Sun Jan 08 09:25:45 2012 +0000
+++ b/tests/faterun.sh	Sun Jan 08 09:28:51 2012 +0000
@@ -1,15 +1,25 @@
 #!/bin/sh
-i=$1
-echo "running $i"
-mkdir -p tests/res/$(dirname $i)
-touch tests/res/$i.md5
-./mplayer -noconfig all -lavdopts threads=4:bitexact -really-quiet -noconsolecontrols -nosound -benchmark -vo md5sum:outfile=tests/res/$i.md5 $FATE_SAMPLES/$i
-ref_file=tests/ref/$i.md5
-if ! [ -e $ref_file ] ; then
+if [ -z "$FATE_SAMPLES" ] ; then
+  echo "FATE_SAMPLES is not set!"
+  exit 1
+fi
+
+sample="$1"
+md5out="tests/res/$sample.md5"
+ref_file="tests/ref/$sample.md5"
+echo "testing $sample"
+
+# create necessary files and run
+mkdir -p $(dirname "$md5out")
+touch "$md5out"
+./mplayer -noconfig all -lavdopts threads=4:bitexact -really-quiet -noconsolecontrols -nosound -benchmark -vo md5sum:outfile="$md5out" "$FATE_SAMPLES/$sample"
+
+# check result
+if ! [ -e "$ref_file" ] ; then
   touch tests/ref/empty.md5
   ref_file=tests/ref/empty.md5
 fi
-if ! diff -uw $ref_file tests/res/$i.md5 ; then
-  mv tests/res/$i.md5 tests/res/$i.md5.bad
+if ! diff -uw "$ref_file" "$md5out" ; then
+  mv "$md5out" "$md5out.bad"
   exit 1
 fi