Skip to content

Commit df18bb0

Browse files
author
giraffedata
committed
New test framework, lots of tests
git-svn-id: https://svn.code.sf.net/p/netpbm/code/trunk@1775 9d0c8265-081b-0410-96cb-a4ca84ce46f8
1 parent b6edcd0 commit df18bb0

File tree

136 files changed

+2231
-77
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

136 files changed

+2231
-77
lines changed

converter/pbm/pbmtog3.test

-23
This file was deleted.

doc/HISTORY

+2
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,8 @@ not yet BJH Release 10.61.00
3535
pamgauss: Fix bug: erroneously says -maxval is too big on 64 bit
3636
system. Always broken (Pamgauss was added in 10.23 (July 2004).
3737

38+
Add tests. Thanks Prophet of the Way <afu@wta.att.ne.jp>.
39+
3840
12.09.30 BJH Release 10.60.00
3941

4042
xpmtoppm: major speedup for 3-character-per pixel files,

editor/pamcut.test

-10
This file was deleted.

editor/pamenlarge.test

-8
This file was deleted.

editor/pamflip/pamflip.test

-12
This file was deleted.

editor/pnminvert.test

-15
This file was deleted.

generator/pbmmake.test

-9
This file was deleted.

test/Execute-Tests

+113
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,113 @@
1+
#! /bin/bash
2+
3+
# Confirm that PBM_TESTPREFIX is set.
4+
# PBM_TESTPREFIX is the directory with the Netpbm programs you want to
5+
# test. This can be null, but this is not recommended.
6+
#
7+
# You can set it here by decommenting and modifying the next line:
8+
# export PBM_TESTPREFIX="/usr/local/bin/"
9+
10+
11+
if [ -z $PBM_TESTPREFIX ]
12+
then
13+
echo "Warning: PBM_TESTPREFIX is not set."
14+
echo "Programs in the default execution path:"
15+
echo $PATH
16+
echo "will be tested."
17+
elif [ ! -d $PBM_TESTPREFIX ]
18+
then
19+
echo "Error: No directory named $PBM_TESTPREFIX"
20+
exit 1
21+
else
22+
# append "/" to end of string if necessary
23+
export PBM_TESTPREFIX=`echo $PBM_TESTPREFIX | sed '/\/$/!s@$@/@'`
24+
fi
25+
26+
# Set PBM_BINPREFIX.
27+
# PBM_BINPREFIX is the directory where Netpbm programs which play
28+
# auxiliary roles in tests (such as image generators for producing
29+
# test images, analyzers to summarize output and so forth).
30+
#
31+
# If testing a fresh install, this should be the same as PBM_TESTPREFIX.
32+
# If you are developing a single Netpbm program, you may want to
33+
# set this to a directory with stable executables.
34+
# If set to null, executables in the default execution path will
35+
# be used.
36+
37+
# export PBM_BINPREFIX="/usr/local/bin/"
38+
# export PBM_BINPREFIX=""
39+
export PBM_BINPREFIX=${PBM_TESTPREFIX}
40+
41+
# Add PBM_BINPREFIX to PATH.
42+
# This is necessary for Netpbm programs (mosly scripts) that call
43+
# other Netpbm programs.
44+
45+
if [ ! -z $PBM_BINPREFIX ]
46+
then
47+
export PATH=${PBM_BINPREFIX}:$PATH
48+
fi
49+
50+
# Set tmpdir, which is used in some of the test scripts.
51+
# This must be an existing directory.
52+
53+
if [ -z $tmpdir ]
54+
then
55+
if [ -z $TMPDIR ]
56+
then
57+
export tmpdir=/tmp/
58+
else
59+
export tmpdir=$TMPDIR
60+
fi
61+
fi
62+
63+
# If necessary set the RGBDEF environment variable.
64+
#export RGBDEF=/etc/rgb.txt
65+
#export RGBDEF=/usr/local/netpbm/lib/rgb.txt
66+
#export RGBDEF=/usr/share/emacs/*/etc/rgb.txt
67+
68+
# Declare arrays used to count and report test results.
69+
# For now only "SUCCESS" and "FAILURE" are used.
70+
declare -a array=(0 0 0 0 0)
71+
declare -a status=("SUCCESS" "FAILURE" "UNEXPECTED SUCCESS" \
72+
"EXPECTED FAILURE" "NOT SUPPORTED")
73+
74+
# Execute the tests, as described in the "Test-Order" file.
75+
#
76+
# To execute just one test, or a few tests, replace the grep part
77+
# within backquotes with names of tests you want to run like this:
78+
#
79+
# for t in pbmmake.test pgmmake.test ppmmake.test
80+
81+
for t in `grep -v "^#" Test-Order | grep "."`
82+
do
83+
echo == $t ==
84+
./$t > ${t%.test}.out ; let result=$?
85+
case $result in
86+
0) cmp --quiet ${t%.test}.out ${t%.test}.ok ;
87+
if [ $? -eq 0 ]
88+
then let result=0; rm ${t%.test}.out ;
89+
else let result=1;
90+
fi ;;
91+
1 | 2 | 3 ) ;;
92+
*) let result=1 ;;
93+
esac
94+
95+
# Print out a summary report.
96+
97+
echo $t: ${status[${result}]}; echo
98+
let array[${result}]=${array[${result}]}+1
99+
done
100+
101+
echo "Test summary:"
102+
echo ==================
103+
104+
for s in 0 1 2 3 4
105+
do
106+
if [[ ${array[${s}]} -gt 0 || s -eq 1 ]]
107+
then
108+
echo ${status[${s}]} ${array[${s}]}
109+
fi
110+
done
111+
112+
echo ==================
113+
echo "All tests done."

test/Test-Order

+89
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,89 @@
1+
# General test
2+
3+
all-in-place.test
4+
5+
# Generator tests
6+
7+
pbmmake.test
8+
pgmmake.test
9+
ppmmake.test
10+
pamseq.test
11+
12+
pbmpage.test
13+
pbmtext.test
14+
pbmupc.test
15+
pgmramp.test
16+
ppmgauss.test
17+
ppmcie.test
18+
ppmwheel.test
19+
20+
# Analyzer tests
21+
22+
pamfile.test
23+
pgmhist.test
24+
ppmhist.test
25+
pamsumm.test
26+
pnmpsnr.test
27+
pbmminkowski.test
28+
29+
# Basic (internal) converter tests
30+
31+
pamtopam.test
32+
pgmtopgm.test
33+
ppmtoppm.test
34+
pgmtoppm.test
35+
ppmtopgm.test
36+
pnmtopnm-plain.test
37+
38+
# Editor tests
39+
40+
pamditherbw.test
41+
42+
pbmclean.test
43+
pamcut.test
44+
pnmcat.test
45+
pamflip.test
46+
pamenlarge.test
47+
pnminvert.test
48+
49+
pbmpscale.test
50+
pnmremap1.test
51+
pnmremap2.test
52+
pnmtile.test
53+
ppmbrighten.test
54+
ppmdither.test
55+
pamedge.test
56+
ppmdim.test
57+
58+
ppmmix.test
59+
60+
# Format converter tests
61+
62+
pbmtog3.test
63+
64+
# Round-trip tests : editors
65+
66+
pnm-plain-roundtrip.test
67+
pnm-pam-roundtrip.test
68+
pnminvert-roundtrip.test
69+
pamflip-roundtrip.test
70+
pamdepth-roundtrip.test
71+
pad-crop-roundtrip.test
72+
cut-paste-roundtrip.test
73+
rgb3-roundtrip.test
74+
ppmchange-roundtrip.test
75+
pamdice-roundtrip.test
76+
pamslice-roundtrip.test
77+
78+
# Round-trip tests : lossless converters
79+
80+
g3-roundtrip.test
81+
bmp-roundtrip.test
82+
gif-roundtrip.test
83+
png-roundtrip.test
84+
ps-roundtrip.test
85+
tiff-roundtrip.test
86+
xbm-roundtrip.test
87+
xpm-roundtrip.test
88+
xwd-roundtrip.test
89+
hdiff-roundtrip.test

0 commit comments

Comments
 (0)