#!@BASHREAL@
# Driver for test pattern generator
#
# Copyright 2004-2008 Robert Krawitz (rlk@alum.mit.edu) and other
# members of the Gutenprint project.
#
# This program is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by the Free
# Software Foundation; either version 2 of the License, or (at your option)
# any later version.
#
# This program is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
# or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
# for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see .
if [[ -n "$STP_TEST_LOG_PREFIX" ]] ; then
redir="${STP_TEST_LOG_PREFIX}${0##*/}_$$.log"
if [[ -n $BUILD_VERBOSE ]] ; then
exec > >(tee -a "$redir" >&3)
else
exec 1>>"$redir"
fi
exec 2>&1
fi
retval=0
if [ "$STP_TEST_PROFILE" != full -a -n "$STP_TEST_SUITE" ] ; then
exit 77
fi
if [ -n "$STP_TEST_DEBUG" ] ; then
echo "Would run $0 $@"
exit 0
fi
if [ -z "$srcdir" -o "$srcdir" = "." ] ; then
sdir=`pwd`
elif [ -n "`echo $srcdir |grep '^/'`" ] ; then
sdir="$srcdir"
else
sdir="`pwd`/$srcdir"
fi
if [ -z "$STP_DATA_PATH" ] ; then
STP_DATA_PATH="$sdir/../xml"
export STP_DATA_PATH
fi
if [ -z "$STP_MODULE_PATH" ] ; then
STP_MODULE_PATH="$sdir/../main:$sdir/../main/.libs"
export STP_MODULE_PATH
fi
valgrind=0
valopts=''
extra=''
dontrun=
output=
set_opt() {
opt=`echo $1 | awk -F= '{print $1}'`
val=`echo $1 | awk -F= '{print $2}'`
extra="`printf '%s\nparameter \"%s\" \"%s\";' \"$extra\" $opt $val`"
}
set_message() {
the_message="`printf '%s\nmessage \"%s\";' \"$the_message\" \"$@\"`"
}
usage() {
echo "Usage: run-testpattern [-v|--valgrind]"
echo " [-p|--parameter parameter=value]"
echo " [-n|--dontrun]"
echo " [-O|--output]"
echo " [--] [printers...]"
exit 0;
}
print_command=cat
set_args() {
while true ; do
case "$1" in
-h*|--h*) usage ;;
-v|--valgrind) valopts='--tool=memcheck' ; valgrind=`expr $valgrind + 1` ;;
-c|--cachegrind) valopts='--skin=cachegrind'; valgrind=4 ;;
-g|--gdb-attach) valopts='--vgdb=yes' ;;
-p|--parameter) shift; set_opt "$1" ;;
-n|--dontrun) dontrun=1 ;;
-O|--output) shift; output="$1" ;;
-o|--one) print_command=run_testpattern; dontrun=1 ;;
--) shift; args="$@"; return ;;
*) return ;;
esac
shift
done
}
print_one_testpattern() {
printer=$1
mode=$2
bits=$3
inktype=$4
correction=$5
printingmode=$6
shift
shift
shift
shift
shift
shift
stuff="$@"
cat <&1
else
print_all_testpatterns
fi
exit $?