1#!@BASHREAL@
2
3# Harness for rastertogutenprint tester.
4#
5# Copyright 2007-2017 Robert Krawitz (rlk@alum.mit.edu)
6#
7# This program is free software; you can redistribute it and/or modify it
8# under the terms of the GNU General Public License as published by the Free
9# Software Foundation; either version 2 of the License, or (at your option)
10# any later version.
11#
12# This program is distributed in the hope that it will be useful, but
13# WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
14# or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
15# for more details.
16#
17# You should have received a copy of the GNU General Public License
18# along with this program.  If not, see <https://www.gnu.org/licenses/>.
19
20if [[ -n "$STP_TEST_LOG_PREFIX" ]] ; then
21    redir="${STP_TEST_LOG_PREFIX}${0##*/}_$$.log"
22    if [[ -n $BUILD_VERBOSE ]] ; then
23	exec > >(tee -a "$redir" >&3)
24    else
25	exec 1>>"$redir"
26    fi
27    exec 2>&1
28fi
29
30STP_TEST_PROFILE=${STP_TEST_PROFILE:-full}
31
32[[ -n $STP_TEST_COMPONENTS && $STP_TEST_COMPONENTS != '*CUPS*' && $STP_TEST_COMPONENTS != '*test-rastertogutenprint*' ]] && exit 77
33
34set -e
35
36declare FASTOPT="-o StpDitherAlgorithm=VeryFast -l -N -o ColorCorrection=Raw"
37declare MIN_PRINTERS="@MINIMAL_PRINTERS_TO_TEST@"
38
39function runit() {
40    echo "================================================================"
41    echo "$@"
42    [[ -z $STP_TEST_DEBUG ]] && "$@"
43}
44
45function test_minimal() {
46    runit ./test-rastertogutenprint -s $FASTOPT -p 1 \
47	  $MIN_PRINTERS
48}
49
50function test_fast() {
51    runit ./test-rastertogutenprint -S -s $FASTOPT -p 2
52}
53
54function test_full() {
55    runit ./test-rastertogutenprint -l -p 2 $FASTOPT
56    runit ./test-rastertogutenprint -S -s -X
57}
58
59function test_valgrind_minimal() {
60    runit ./test-rastertogutenprint -v -v -s $FASTOPT -p 1 \
61	  $MIN_PRINTERS
62}
63
64function test_valgrind_fast() {
65    test_valgrind_minimal
66}
67
68function test_valgrind() {
69    runit ./test-rastertogutenprint -v -v -S -s $FASTOPT -p 2
70}
71
72case "$STP_TEST_PROFILE" in
73    full|fast|valgrind|valgrind_minimal|valgrind_fast|minimal)
74	test_"$STP_TEST_PROFILE"
75	;;
76    *)
77	exit 77
78	;;
79esac
80