From ab612b4eb2e65ad61268232c52fe9a424586fece Mon Sep 17 00:00:00 2001 From: Werner Almesberger Date: Tue, 26 Jul 2016 08:28:39 -0300 Subject: [PATCH] sch2fig/test/: tools for comparison with reference results --- sch2fig/test/README | 24 ++++++++++++++++++++++++ sch2fig/test/comp | 15 +++++++++++++++ sch2fig/test/genpng | 32 ++++++++++++++++++++++++++++++++ 3 files changed, 71 insertions(+) create mode 100644 sch2fig/test/README create mode 100755 sch2fig/test/comp create mode 100755 sch2fig/test/genpng diff --git a/sch2fig/test/README b/sch2fig/test/README new file mode 100644 index 0000000..fdc81f2 --- /dev/null +++ b/sch2fig/test/README @@ -0,0 +1,24 @@ +Setup +----- + +git clone https://neo900.org/git/ee.git neo900-ee +cd neo900-ee +git reset --hard 57eebdcf573311c049bc57527bc03a517aff0fef + +cd .. + +git clone git://projects.qi-hardware.com/kicad-libs.git +cd kicad-libs +git reset --hard 143fa7fe10cabbfe1cb12d010c7426d482d7e6f4 + +cd .. + +./genpng ref + + +Run test +-------- + +./genpng +./comp +qiv -t _diff*.png diff --git a/sch2fig/test/comp b/sch2fig/test/comp new file mode 100755 index 0000000..55e1052 --- /dev/null +++ b/sch2fig/test/comp @@ -0,0 +1,15 @@ +#!/bin/sh +diffs=0 +rm -f _diff*png +for n in out*.png; do + ref=ref${n#out} + diff=_diff${n#out} + if ! compare -metric AE $ref $n - >/dev/null; then + diffs=`expr $diffs + 1` + compare -metric AE $ref $n $diff + fi +done +echo +[ $diffs = 0 ] && exit 0 +echo "$diffs difference(s)" 1>&2 +exit 1 diff --git a/sch2fig/test/genpng b/sch2fig/test/genpng new file mode 100755 index 0000000..827e9b0 --- /dev/null +++ b/sch2fig/test/genpng @@ -0,0 +1,32 @@ +#!/bin/sh + +usage() +{ + echo "usage: $0 [[dir] prefix]" 1>&2 + exit 1 +} + + +[ "$3" ] && usage +[ "${1#-}" != "$1" ] && usage + +dir=. +if [ "$2" ]; then + dir=$1 + shift +fi +prefix=${1:-out} + +sheet=1 +while [ $sheet -le 37 ]; do + echo -n . + sn=`printf '%02d' $sheet` + file=$dir/$prefix$sn.png + $dir/../sch2fig -DSHEET=$sn -t $dir/frame.fig \ + $dir/neo900-ee/hw/neo900.lib \ + $dir/kicad-libs/components/powered.lib \ + $dir/neo900-ee/hw/neo900_SS_$sheet.sch | + fig2dev -L png -m 2 >$file + sheet=`expr $sheet + 1` +done +echo