[MPlayer-dev-eng] [PATCH] cleanup faterun.sh, do not use / if FATE_SAMPLES is not set

Reimar Döffinger Reimar.Doeffinger at gmx.de
Thu Jan 5 14:01:07 CET 2012


Hello,
currently fatetest behaves badly if FATE_SAMPLES is not set.
And the script contains code duplication and bad variables names like
"i".
Attached patch IMO is much better.
-------------- next part --------------
Index: Makefile
===================================================================
--- Makefile	(revision 34508)
+++ Makefile	(working copy)
@@ -996,6 +996,7 @@
     qt-surge-suite/% real/ra% sipr/% truespeech/% vorbis/%         \
     vqf/% w64/% wmapro/% wmavoice/%                                \
 
+ifdef FATE_SAMPLES
 ALLSAMPLES_FULLPATH = $(wildcard $(FATE_SAMPLES)/*/*.*)
 ALLSAMPLES          = $(patsubst $(FATE_SAMPLES)/%,%,$(ALLSAMPLES_FULLPATH))
 SAMPLES := $(filter-out $(BROKEN_SAMPLES),$(ALLSAMPLES))
@@ -1006,6 +1007,7 @@
 
 tests/res/%.md5: mplayer$(EXESUF) $(FATE_SAMPLES)/%
 	@tests/faterun.sh $*
+endif
 
 
 
Index: tests/faterun.sh
===================================================================
--- tests/faterun.sh	(revision 34508)
+++ tests/faterun.sh	(working copy)
@@ -1,15 +1,20 @@
 #!/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 [ -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 "running $sample"
+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
 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


More information about the MPlayer-dev-eng mailing list