53
53
export srcdir=$( dirname $0 )
54
54
55
55
# Set tmpdir, which is used in some of the test scripts. By default
56
- # this is created by mktemp. The user can override and specify tmpdir,
57
- # but in this case it must be an existing directory and must not be
58
- # either $srcdir or current work.
56
+ # this is created by mktemp. To override edit the following lines.
57
+
58
+ # When tmpdir is specified it must be an existing directory and must
59
+ # not be either $srcdir or current work. tmpdir should not contain
60
+ # whitespace, non-printable characters, etc.
61
+
62
+ tmpdir_created=$( mktemp -d " ${TMPDIR:-/ tmp} /netpbm.XXXXXXXX" ) || exit 1;
63
+ export tmpdir=${tmpdir_created}
59
64
60
- if [ -z $tmpdir ]
61
- then
62
- tmpdir_created=$( mktemp -d " ${TMPDIR:-/ tmp} /netpbm.XXXXXXXX" ) || exit 1;
63
- export tmpdir=${tmpdir_created}
64
- else
65
- tmpdir_created=" " ;
66
- if [ ! -d ${tmpdir} ]
67
- then echo " Specified temporary directory $tmpdir does not exist."
68
- exit 1;
69
- elif [ ${tmpdir} -ef ${srcdir} ]
70
- then echo " Temporary directory must not be $srcdir ."
71
- exit 1;
72
- elif [ ${tmpdir} -ef $PWD ]
73
- then echo " Temporary directory must not be current directory."
74
- exit 1;
75
- fi
76
- fi
77
65
78
- # If necessary set the RGBDEF environment variable.
79
- # export RGBDEF=/etc/rgb.txt
80
- # export RGBDEF=/usr/local/netpbm/lib/rgb.txt
81
- # export RGBDEF=/usr/share/emacs/*/etc/rgb.txt
66
+ # tmpdir_created=""
67
+ # export tmpdir=/tmp/netpbm-test-tempdir
68
+
69
+ # if [ ! -d "${tmpdir}" ]
70
+ # then echo "Specified temporary directory $tmpdir does not exist."
71
+ # exit 1;
72
+ # elif [ "${tmpdir}" -ef "${srcdir}" ]
73
+ # then echo "Temporary directory must not be $srcdir."
74
+ # exit 1;
75
+ # elif [ "${tmpdir}" -ef "$PWD" ]
76
+ # then echo "Temporary directory must not be current directory."
77
+ # exit 1;
78
+ # fi
79
+ # fi
82
80
83
81
84
82
# Declare arrays used to count and report test results.
@@ -100,17 +98,29 @@ status[4]="NOT TESTABLE"
100
98
# Copy test image files to the current work directory
101
99
102
100
if [ ! -f ./testgrid.pbm ]
103
- then cp -v ${srcdir} /testgrid.pbm ./testgrid.pbm
101
+ then cp -v " ${srcdir} " /testgrid.pbm ./testgrid.pbm
104
102
fi
105
103
106
104
if [ ! -f ./maze.pbm ]
107
- then cp -v ${srcdir} /maze.pbm ./maze.pbm
105
+ then cp -v " ${srcdir} " /maze.pbm ./maze.pbm
108
106
fi
109
107
110
108
if [ ! -f ./testimg.ppm ]
111
- then cp -v ${srcdir} /testimg.ppm ./testimg.ppm
109
+ then cp -v " ${srcdir} " /testimg.ppm ./testimg.ppm
110
+ fi
111
+
112
+ if [ ! -f ./rgbt.txt ]
113
+ then cp -v " ${srcdir} " /rgbt.txt ./rgbt.txt
114
+ # Color name dictionary file rgbt.txt is a short digest.
115
+ # If desired use the proper file:
116
+ # cp -v /etc/rgb.txt ./rgbt.txt
117
+ # cp -v $RGBDEF ./rgbt.txt
112
118
fi
113
119
120
+ if [ ! -f ./test-invalid.inc ]
121
+ then cp -v " ${srcdir} " /test-invalid.inc ./test-invalid.inc
122
+ fi
123
+
114
124
# The block-bin directory
115
125
#
116
126
# This directory contains dummy executables with the names of the
@@ -130,14 +140,14 @@ if [ ! -z $PBM_TEST_PATH ]
130
140
then rm -rf $blockbin
131
141
fi
132
142
mkdir $blockbin
133
- cp ${srcdir} /BLOCK $blockbin /BLOCK
143
+ cp " ${srcdir} " /BLOCK $blockbin /BLOCK
134
144
chmod +x $blockbin /BLOCK
135
145
136
146
# Populate the block-bin directory using all-in-place.ok and
137
147
# legacy-names.ok which together make a complete list of programs.
138
148
139
149
sed ' s/: ok$//' \
140
- ${srcdir} /all-in-place.ok ${srcdir} /legacy-names.ok | \
150
+ " ${srcdir} " /all-in-place.ok " ${srcdir} " /legacy-names.ok | \
141
151
tr ' ' ' \n' | while read prog
142
152
do
143
153
ln -s $blockbin /BLOCK $blockbin /$prog
@@ -216,17 +226,17 @@ if [ ! -z $target ]
216
226
echo $target | sed ' s/,/\n/g' | \
217
227
sed -e ' s/^/# This script tests: .*\\</' -e ' s/$/\\>/' \
218
228
-e ' /^$/q' | \
219
- grep -f - ${srcdir} /* .test -l | \
229
+ grep -f - " ${srcdir} " /* .test -l | \
220
230
while read i ; do echo ${i##*/ } ; done | \
221
- grep -f - ${srcdir} /Test-Order > ./Test-Order ;
231
+ grep -f - " ${srcdir} " /Test-Order > ./Test-Order ;
222
232
if [ ! -s ./Test-Order ]
223
233
then echo ;
224
234
echo " Error: No testable program names in target: " $target ;
225
235
echo ; exit 1
226
236
fi
227
237
else
228
- cp ${srcdir} /Test-Order ./Test-Order ;
229
- # cp --no-clobber ${srcdir}/Test-Order ./Test-Order ;
238
+ cp " ${srcdir} " /Test-Order ./Test-Order ;
239
+ # cp --no-clobber " ${srcdir}" /Test-Order ./Test-Order ;
230
240
fi
231
241
232
242
echo
250
260
# either of these conditions are not met, do not execute the test and
251
261
# report "Not Testable".
252
262
253
- if [ ! -s ${srcdir} /${tname% .test} .ok ]
263
+ if [ ! -s " ${srcdir} " /${tname% .test} .ok ]
254
264
then
255
265
echo " ${tname% .test} .ok does not exist"
256
266
let result=4;
257
267
else
258
- ${srcdir} /Available-Testprog \
268
+ " ${srcdir} " /Available-Testprog \
259
269
` sed -n -e ' /^# This script tests: /s/# This script tests: //p' \
260
270
-e ' /^# Also requires: /s/^# Also requires: //p' \
261
- -e ' /^$/q' ${srcdir} /$tname | tr ' \n' ' ' `
271
+ -e ' /^$/q' " ${srcdir} " /$tname | tr ' \n' ' ' `
262
272
case $? in
263
273
0)
264
- PATH=${testpath} $vg_command ${srcdir} /$tname > ${tname% .test} .out;
274
+ PATH=${testpath} $vg_command " ${srcdir} " /$tname > ${tname% .test} .out;
265
275
let retval=$?
266
276
case $retval in
267
- 0) cmp -s ${tname% .test} .out ${srcdir} /${tname% .test} .ok ;
277
+ 0) cmp -s ${tname% .test} .out " ${srcdir} " /${tname% .test} .ok ;
268
278
if [ $? -eq 0 ]
269
279
then let result=0; rm ${tname% .test} .out ;
270
280
else let result=1;
271
- grep " ^##" ${srcdir} /$tname # Print failure message.
281
+ grep " ^##" " ${srcdir} " /$tname # Print failure message.
272
282
fi ;;
273
283
80) let result=4 ;;
274
284
* ) let result=1 ;;
290
300
291
301
# Erase temporary bin directory and its contents.
292
302
293
- rm -rf ${srcdir} /bin
303
+ rm -rf " ${srcdir} " /bin
294
304
295
305
296
306
# Erase temporary directory and its contents, if it was created.
303
313
# Erase test image files in the current (work) directory.
304
314
# (Do not erase them if we are working from the source directory.)
305
315
306
- if [ ! $PWD -ef ${srcdir} ]
307
- then rm ./testimg.ppm ./testgrid.pbm ./maze.pbm
316
+ if [ ! $PWD -ef " ${srcdir} " ]
317
+ then rm ./testimg.ppm ./testgrid.pbm ./maze.pbm \
318
+ ./rgbt.txt ./test-invalid.inc
308
319
fi
309
320
310
321
0 commit comments