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

Diego Biurrun diego at biurrun.de
Fri Jan 6 15:46:38 CET 2012


On Thu, Jan 05, 2012 at 02:01:07PM +0100, Reimar Döffinger wrote:
> 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.

> --- Makefile	(revision 34508)
> +++ Makefile	(working copy)
> @@ -996,6 +996,7 @@
>  
> +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

This is pointless - the declarations are harmless unless you really run
fatetest, which should now give an error message.

> --- 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"

"testing" might be better than "running" here.

The file could use a bit of whitespace to look less crammed, but overall
this is a clear improvement.

Diego


More information about the MPlayer-dev-eng mailing list