2
# -*- mode: shell-script -*-
3
# $Id: plplot-test-interactive.sh.in 11680 2011-03-27 17:57:51Z airwin $
5
# Copyright (C) 2009 Alan W. Irwin
7
# This file is part of PLplot.
9
# PLplot is free software; you can redistribute it and/or modify
10
# it under the terms of the GNU Library General Public License as published
11
# by the Free Software Foundation; either version 2 of the License, or
12
# (at your option) any later version.
14
# PLplot is distributed in the hope that it will be useful,
15
# but WITHOUT ANY WARRANTY; without even the implied warranty of
16
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17
# GNU Library General Public License for more details.
19
# You should have received a copy of the GNU Library General Public License
20
# along with PLplot; if not, write to the Free Software
21
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
23
# Test suite of PLplot interactive stuff that cannot be tested with
24
# file output device drivers.
26
EXAMPLES_DIR=${EXAMPLES_DIR:-.}
27
SRC_EXAMPLES_DIR=${SRC_EXAMPLES_DIR:-.}
32
Usage: plplot-test-interactive.sh [OPTIONS]
35
[--device=DEVICES_LIST]
36
where DEVICES_LIST is one of more devices specified as a
37
blank-delimited string (e.g., --device=xwin or
38
--device="qtwidget extqt"). Note each specified device must be
39
taken from the following list of eligible interactive devices:
41
xwin, tk, xcairo, gcw, wxwidgets, qtwidget, extcairo or extqt.
45
Environment variables:
46
DEVICES_LIST can be used to specify the device(s).
47
This environment variable is overridden by the option --device.
49
N.B. All members of DEVICES_LIST (whether specified by the
50
DEVICES_LIST environment variable or by the --device option _must_ be
51
configured. If neither the environment variable or --device option is
52
specified, then every _configured_ device from the above list is used.
57
# Figure out what script options were specified by the user.
59
while test $# -gt 0; do
60
if [ "@HAVE_BASH@" = "ON" ] ; then
62
-*=*) optarg=${1#*=} ;;
67
-*=*) optarg=`echo "$1" | sed 's/[-_a-zA-Z0-9]*=//'` ;;
86
# This script is only designed to work when EXAMPLES_DIR is a directory
87
# with a subdirectory called "c". Check whether this conditions is true.
88
if [ ! -d "$EXAMPLES_DIR"/c ] ; then
90
This script is only designed to work when the EXAMPLES_DIR environment
91
variable (overridden by option --examples-dir) is a directory with a
92
subdirectory called "c". This condition has been violated.
97
# Set up interactive and/or external devices that are used for tests.
98
# Cannot use loop for this because of configuration.
102
PLD_xcairo=@PLD_xcairo@
104
PLD_wxwidgets=@PLD_wxwidgets@
105
PLD_qtwidget=@PLD_qtwidget@
106
PLD_extcairo=@PLD_extcairo@
107
PLD_extqt=@PLD_extqt@
109
# These blank-delimited strings must be consistent with previous configured
111
POSSIBLE_INTERACTIVE_DEVICES_LIST="xwin tk xcairo gcw wxwidgets qtwidget"
112
POSSIBLE_DEVICES_LIST="$POSSIBLE_INTERACTIVE_DEVICES_LIST extcairo extqt"
114
# Default DEVICES_LIST is all eligible devices if environment variable
115
# not specified and --devices option not specified.
116
if [ -z "$DEVICES_LIST" ] ; then
118
for device in $POSSIBLE_DEVICES_LIST ; do
119
eval pld_device='$'PLD_$device
120
test "$pld_device" = "ON" && DEVICES_LIST="$DEVICES_LIST $device"
124
# Check that everything in DEVICES_LIST is a configured device.
125
for device in $DEVICES_LIST ; do
126
eval pld_device='$'PLD_$device
127
if [ ! "$pld_device" = "ON" ] ; then
128
echo "$device is either not configured or not used for interactive tests."
133
# Turn off all devices not mentioned in DEVICES_LIST.
134
for device in $POSSIBLE_DEVICES_LIST ; do
135
eval "PLD_$device=OFF"
138
for device in $DEVICES_LIST ; do
139
eval "PLD_$device=ON"
142
INTERACTIVE_DEVICES_LIST=
143
for device in $POSSIBLE_INTERACTIVE_DEVICES_LIST ; do
144
eval pld_device='$'PLD_$device
145
test "$pld_device" = "ON" && \
146
INTERACTIVE_DEVICES_LIST="$INTERACTIVE_DEVICES_LIST $device"
149
OVERALL_STATUS_CODE=0
150
for device in $INTERACTIVE_DEVICES_LIST ; do
151
./plplot-test.sh --verbose --interactive --device=$device
152
OVERALL_STATUS_CODE=$?
157
if [ "@PLD_xcairo@" = "ON" ] ; then
158
INDEX_LIST="$INDEX_LIST $COUNT"
159
DIRECTORY[$COUNT]="${EXAMPLES_DIR}/c"
160
COMMAND[$COUNT]="./extXdrawable_demo"
161
COUNT=$(( $COUNT + 1 ))
164
if [ "@PLD_extcairo@" = "ON" ] ; then
165
INDEX_LIST="$INDEX_LIST $COUNT"
166
DIRECTORY[$COUNT]="${EXAMPLES_DIR}/c"
167
COMMAND[$COUNT]="./ext-cairo-test"
168
COUNT=$(( $COUNT + 1 ))
171
if [ "@ENABLE_wxwidgets@" = "ON" ] ; then
172
INDEX_LIST="$INDEX_LIST $COUNT"
173
DIRECTORY[$COUNT]="${EXAMPLES_DIR}/c++"
174
COMMAND[$COUNT]="./wxPLplotDemo"
175
COUNT=$(( $COUNT + 1 ))
178
if [ "@PLD_extqt@" = "ON" ] ; then
179
INDEX_LIST="$INDEX_LIST $COUNT"
180
DIRECTORY[$COUNT]="${EXAMPLES_DIR}/c++"
181
COMMAND[$COUNT]="./qt_example"
182
COUNT=$(( $COUNT + 1 ))
185
if [ "@ENABLE_gnome2@" = "ON" ] ; then
186
INDEX_LIST="$INDEX_LIST $COUNT"
187
DIRECTORY[$COUNT]="${EXAMPLES_DIR}/c"
188
COMMAND[$COUNT]="./plplotcanvas_demo"
189
COUNT=$(( $COUNT + 1 ))
191
INDEX_LIST="$INDEX_LIST $COUNT"
192
DIRECTORY[$COUNT]="${EXAMPLES_DIR}/c"
193
COMMAND[$COUNT]="./plplotcanvas_animation"
194
COUNT=$(( $COUNT + 1 ))
197
if [ "@ENABLE_pygcw@" = "ON" ] ; then
198
INDEX_LIST="$INDEX_LIST $COUNT"
199
DIRECTORY[$COUNT]="${SRC_EXAMPLES_DIR}/python"
200
COMMAND[$COUNT]="./plplotcanvas_demo.py"
201
COUNT=$(( $COUNT + 1 ))
203
INDEX_LIST="$INDEX_LIST $COUNT"
204
DIRECTORY[$COUNT]="${SRC_EXAMPLES_DIR}/python"
205
COMMAND[$COUNT]="./plplotcanvas_animation.py"
206
COUNT=$(( $COUNT + 1 ))
209
if [ "@ENABLE_tk@" = "ON" ] ; then
210
INDEX_LIST="$INDEX_LIST $COUNT"
211
DIRECTORY[$COUNT]="${EXAMPLES_DIR}/tk"
212
COMMAND[$COUNT]="./xtk01 -f tk01"
213
COUNT=$(( $COUNT + 1 ))
216
if [ "@ENABLE_itk@" = "ON" ] ; then
217
INDEX_LIST="$INDEX_LIST $COUNT"
218
DIRECTORY[$COUNT]="${EXAMPLES_DIR}/tk"
219
COMMAND[$COUNT]="./xtk02 -f tk02"
220
COUNT=$(( $COUNT + 1 ))
223
if [ "@ENABLE_tk@" = "ON" ] ; then
224
INDEX_LIST="$INDEX_LIST $COUNT"
225
DIRECTORY[$COUNT]="${EXAMPLES_DIR}/tk"
226
COMMAND[$COUNT]="plserver -f tk03"
227
COUNT=$(( $COUNT + 1 ))
230
if [ "@ENABLE_itk@" = "ON" ] ; then
231
INDEX_LIST="$INDEX_LIST $COUNT"
232
DIRECTORY[$COUNT]="${EXAMPLES_DIR}/tk"
233
COMMAND[$COUNT]="./xtk04 -f tk04"
234
COUNT=$(( $COUNT + 1 ))
237
# execute all interactive commands set up by previous stanzas.
238
for index in $INDEX_LIST ; do
239
pushd ${DIRECTORY[$index]}
240
echo "${COMMAND[$index]}"
241
${COMMAND[$index]} 2> test.error
242
# Look for any status codes (segfaults, plexit) from the examples themselves
244
if [ "$status_code" -ne 0 ] ; then
245
echo "ERROR indicated by status code = $status_code for ${COMMAND[$index]}"
246
OVERALL_STATUS_CODE=$status_code
249
# Look for any PLPLOT ERROR messages from plwarn that do not result in an exit code.
250
is_error=`grep -l 'PLPLOT ERROR' test.error`
251
if [ -n "$is_error" ] ; then
252
echo "ERROR indicated by 'PLPLOT ERROR' in stderr for ${COMMAND[$index]}"
253
OVERALL_STATUS_CODE=1
258
if [ "@ENABLE_tk@" = "ON" ] ; then
259
cd "${SRC_EXAMPLES_DIR}"/tcl
263
pack append . .plw {left expand fill}
265
proc 1 {} "plgrid .plw.plwin"
270
# Just in case EXAMPLES_DIR is a relative path such as the default ".".
272
cd "${EXAMPLES_DIR}"/tk
273
# Drop 14 because multiple devices do not seem to work in this context.
274
# Drop 31 since it produces empty plot (by design).
309
if [ "$OVERALL_STATUS_CODE" -ne 0 ] ; then
310
echo "A major error occurred for one of the interactive examples"
312
echo "All interactive tests completed without any noticeable issues"
314
exit $OVERALL_STATUS_CODE