~uhh-ssd/+junk/humidity_readout

« back to all changes in this revision

Viewing changes to plplot/plplot-5.9.9/plplot_test/plplot-test-interactive.sh.in

  • Committer: Joachim Erfle
  • Date: 2013-07-24 13:53:41 UTC
  • Revision ID: joachim.erfle@desy.de-20130724135341-1qojpp701zsn009p
initial commit

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#!@SH_EXECUTABLE@
 
2
# -*- mode: shell-script -*-
 
3
# $Id: plplot-test-interactive.sh.in 11680 2011-03-27 17:57:51Z airwin $
 
4
#
 
5
# Copyright (C) 2009 Alan W. Irwin
 
6
#
 
7
# This file is part of PLplot.
 
8
#
 
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.
 
13
#
 
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.
 
18
#
 
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
 
22
 
 
23
# Test suite of PLplot interactive stuff that cannot be tested with
 
24
# file output device drivers.
 
25
 
 
26
EXAMPLES_DIR=${EXAMPLES_DIR:-.}
 
27
SRC_EXAMPLES_DIR=${SRC_EXAMPLES_DIR:-.}
 
28
 
 
29
usage()
 
30
{
 
31
echo '
 
32
Usage: plplot-test-interactive.sh [OPTIONS]
 
33
 
 
34
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:
 
40
 
 
41
       xwin, tk, xcairo, gcw, wxwidgets, qtwidget, extcairo or extqt.
 
42
 
 
43
   [--help]
 
44
 
 
45
Environment variables:
 
46
   DEVICES_LIST can be used to specify the device(s).
 
47
   This environment variable is overridden by the option --device.
 
48
 
 
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.
 
53
'
 
54
   exit $1
 
55
}
 
56
 
 
57
# Figure out what script options were specified by the user.
 
58
 
 
59
while test $# -gt 0; do
 
60
   if [ "@HAVE_BASH@" = "ON" ] ; then
 
61
      case "$1" in
 
62
      -*=*) optarg=${1#*=} ;;
 
63
      *) optarg= ;;
 
64
      esac
 
65
   else
 
66
      case "$1" in
 
67
      -*=*) optarg=`echo "$1" | sed 's/[-_a-zA-Z0-9]*=//'` ;;
 
68
      *) optarg= ;;
 
69
      esac
 
70
   fi
 
71
 
 
72
   case $1 in
 
73
      --device=*)
 
74
         DEVICES_LIST=$optarg
 
75
         ;;
 
76
      --help)
 
77
         usage 0 1>&2
 
78
         ;;
 
79
      *)
 
80
         usage 1 1>&2
 
81
         ;;
 
82
   esac
 
83
   shift
 
84
done
 
85
 
 
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
 
89
    echo '
 
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.
 
93
'
 
94
    exit 1
 
95
fi
 
96
 
 
97
# Set up interactive and/or external devices that are used for tests.
 
98
# Cannot use loop for this because of configuration.
 
99
 
 
100
PLD_xwin=@PLD_xwin@
 
101
PLD_tk=@PLD_tk@
 
102
PLD_xcairo=@PLD_xcairo@
 
103
PLD_gcw=@PLD_gcw@
 
104
PLD_wxwidgets=@PLD_wxwidgets@
 
105
PLD_qtwidget=@PLD_qtwidget@
 
106
PLD_extcairo=@PLD_extcairo@
 
107
PLD_extqt=@PLD_extqt@
 
108
 
 
109
# These blank-delimited strings must be consistent with previous configured
 
110
# list of devices.
 
111
POSSIBLE_INTERACTIVE_DEVICES_LIST="xwin tk xcairo gcw wxwidgets qtwidget"
 
112
POSSIBLE_DEVICES_LIST="$POSSIBLE_INTERACTIVE_DEVICES_LIST extcairo extqt"
 
113
 
 
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
 
117
    DEVICES_LIST=
 
118
    for device in $POSSIBLE_DEVICES_LIST ; do
 
119
        eval pld_device='$'PLD_$device
 
120
        test "$pld_device" = "ON" && DEVICES_LIST="$DEVICES_LIST $device"
 
121
    done
 
122
fi
 
123
 
 
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."
 
129
        usage 1 1>&2 
 
130
    fi
 
131
done
 
132
 
 
133
# Turn off all devices not mentioned in DEVICES_LIST.
 
134
for device in $POSSIBLE_DEVICES_LIST ; do
 
135
    eval "PLD_$device=OFF"
 
136
done
 
137
 
 
138
for device in $DEVICES_LIST ; do
 
139
    eval "PLD_$device=ON"
 
140
done
 
141
 
 
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"
 
147
done
 
148
 
 
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=$?
 
153
done
 
154
 
 
155
INDEX_LIST=
 
156
COUNT=0
 
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 ))
 
162
fi
 
163
 
 
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 ))
 
169
fi
 
170
 
 
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 ))
 
176
fi
 
177
 
 
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 ))
 
183
fi
 
184
 
 
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 ))
 
190
 
 
191
    INDEX_LIST="$INDEX_LIST $COUNT"
 
192
    DIRECTORY[$COUNT]="${EXAMPLES_DIR}/c"
 
193
    COMMAND[$COUNT]="./plplotcanvas_animation"
 
194
    COUNT=$(( $COUNT + 1 ))
 
195
fi
 
196
 
 
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 ))
 
202
 
 
203
    INDEX_LIST="$INDEX_LIST $COUNT"
 
204
    DIRECTORY[$COUNT]="${SRC_EXAMPLES_DIR}/python"
 
205
    COMMAND[$COUNT]="./plplotcanvas_animation.py"
 
206
    COUNT=$(( $COUNT + 1 ))
 
207
fi
 
208
 
 
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 ))
 
214
fi
 
215
 
 
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 ))
 
221
fi
 
222
 
 
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 ))
 
228
fi
 
229
 
 
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 ))
 
235
fi
 
236
 
 
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
 
243
    status_code=$?
 
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
 
247
    fi
 
248
    cat test.error
 
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
 
254
    fi
 
255
    popd
 
256
done
 
257
 
 
258
if [ "@ENABLE_tk@" = "ON" ] ; then
 
259
    cd "${SRC_EXAMPLES_DIR}"/tcl
 
260
    plserver <<EOF
 
261
plstdwin .
 
262
plxframe .plw
 
263
pack append . .plw {left expand fill}
 
264
source plgrid.tcl
 
265
proc 1 {} "plgrid .plw.plwin"
 
266
1
 
267
exit
 
268
EOF
 
269
 
 
270
# Just in case EXAMPLES_DIR is a relative path such as the default ".".
 
271
    cd ..
 
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).
 
275
    plserver <<EOF
 
276
source tkdemos.tcl
 
277
1
 
278
2
 
279
3
 
280
4
 
281
5
 
282
6
 
283
7
 
284
8
 
285
9
 
286
10
 
287
11
 
288
12
 
289
13
 
290
15
 
291
16
 
292
17
 
293
18
 
294
19
 
295
20
 
296
21
 
297
22
 
298
23
 
299
24
 
300
25
 
301
26
 
302
27
 
303
28
 
304
29
 
305
30
 
306
exit
 
307
EOF
 
308
fi
 
309
if [ "$OVERALL_STATUS_CODE" -ne 0 ] ; then
 
310
    echo "A major error occurred for one of the interactive examples"
 
311
else
 
312
    echo "All interactive tests completed without any noticeable issues"
 
313
fi
 
314
exit $OVERALL_STATUS_CODE