From 2cea73d040c6a41545093376c0c810248b1a2f55 Mon Sep 17 00:00:00 2001 From: Werner Almesberger Date: Tue, 26 Jul 2016 13:11:25 -0300 Subject: [PATCH] sch2fig/test/comp: add optional directory argument --- sch2fig/test/comp | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) diff --git a/sch2fig/test/comp b/sch2fig/test/comp index 55e1052..b406607 100755 --- a/sch2fig/test/comp +++ b/sch2fig/test/comp @@ -1,9 +1,23 @@ #!/bin/sh + +usage() +{ + echo "usage: $0 [dir]" 1>&2 + exit 1 +} + + +[ "$2" ] && usage +[ "${1#-}" != "$1" ] && usage + +dir=${1:-.} + diffs=0 -rm -f _diff*png -for n in out*.png; do - ref=ref${n#out} - diff=_diff${n#out} +rm -f $dir/_diff*png +for n in $dir/out*.png; do + out=`basename "$n"` + ref=$dir/ref${out#out} + diff=$dir/_diff${out#out} if ! compare -metric AE $ref $n - >/dev/null; then diffs=`expr $diffs + 1` compare -metric AE $ref $n $diff