| 1 |
# Regression-test suite for the giflib library and tools |
| 2 |
# All utilities have tests except gifbg, gifcolor, and gifhisto. |
| 3 |
|
| 4 |
.SUFFIXES: .gif .rgb |
| 5 |
|
| •6 |
export LD_LIBRARY_PATH=$(CURDIR)/.. |
| 7 |
|
| 8 |
# This is what to do by default |
| 9 |
test: |
| 10 |
@$(MAKE) --quiet tap | ./tapview |
| 11 |
|
| 12 |
tap: |
| 13 |
@$(MAKE) --quiet tapstream | tee taplog$$$$; echo "1..$$(grep ok taplog$$$$ | wc -l)"; rm taplog$$$$ |
| 14 |
|
| 15 |
tapstream: render-regress \ |
| 16 |
gif2rgb-regress \ |
| 17 |
gifbuild-regress \ |
| 18 |
gifclrmp-regress \ |
| 19 |
gifecho-regress \ |
| 20 |
giffilter-regress \ |
| 21 |
giffix-regress \ |
| 22 |
gifinto-regress \ |
| 23 |
gifsponge-regress \ |
| 24 |
giftext-regress \ |
| 25 |
giftool-regress \ |
| 26 |
gifwedge-regress |
| 27 |
|
| 28 |
rebuild: render-rebuild \ |
| 29 |
gif2rgb-rebuild \ |
| 30 |
gifclrmp-rebuild \ |
| 31 |
gifecho-rebuild \ |
| 32 |
giffix-rebuild \ |
| 33 |
gifinto-rebuild \ |
| 34 |
giftext-rebuild \ |
| 35 |
gifwedge-rebuild |
| 36 |
|
| 37 |
UTILS = .. |
| 38 |
PICS = ../pic |
| 39 |
GIF2RGB = ../gif2rgb |
| 40 |
|
| 41 |
$(GIF2RGB): |
| 42 |
@$(MAKE) -C .. gif2rgb |
| 43 |
|
| 44 |
GIFS := $(shell ls ../pic/*.gif) |
| 45 |
|
| 46 |
# Test decompression and rendering by unpacking images, |
| 47 |
# converting them to RGB, and comparing that result to a check file. |
| 48 |
render-regress: $(GIF2RGB) |
| 49 |
@for test in $(GIFS); \ |
| 50 |
do \ |
| 51 |
stem=`basename $${test} | sed -e "s/.gif$$//"`; \ |
| 52 |
$(UTILS)/gif2rgb -1 <$${test} | ./cmpdiffer "gif2rgb: test of $${test}" $${stem}.rgb; \ |
| 53 |
done |
| 54 |
render-rebuild: $(GIF2RGB) |
| 55 |
@for test in $(GIFS); do \ |
| 56 |
stem=`basename $${test} | sed -e "s/.gif$$//"`; \ |
| 57 |
echo "Remaking $${stem}.rgb"; \ |
| 58 |
$(UTILS)/gif2rgb -1 -o $${stem}.rgb $${test}; \ |
| 59 |
done |
| 60 |
|
| 61 |
gif2rgb-regress: $(GIF2RGB) |
| 62 |
@$(UTILS)/gif2rgb -c 3 -s 100 100 <gifgrid.rgb | $(UTILS)/gifbuild -d | sed "/sort flag/s/off/on/" | ./tapdiffer "checking gif2rgb idempotency" gifgrid.ico |
| 63 |
gif2rgb-rebuild: $(GIF2RGB) |
| 64 |
@echo "Rebuilding gif2rgb checkfile." |
| 65 |
@$(UTILS)/gif2rgb -c 3 -s 100 100 <gifgrid.rgb | $(UTILS)/gifbuild -d >gifgrid.ico |
| 66 |
|
| 67 |
gifbuild-regress: |
| 68 |
@$(UTILS)/gifbuild -d <$(PICS)/treescap.gif | ./tapdiffer "gifbuild: basic sanity check" treescap.ico |
| 69 |
@$(UTILS)/gifbuild <$(PICS)/sample.ico | $(UTILS)/gifbuild -d > [email protected]; $(UTILS)/gifbuild < [email protected] | $(UTILS)/gifbuild -d > [email protected]; |
| 70 |
@./tapdiffer <[email protected] "gifbuild: Checking idempotency on an icon file." [email protected]; rm [email protected]?.ico |
| 71 |
@$(UTILS)/gifbuild -d <$(PICS)/fire.gif > [email protected] |
| 72 |
@$(UTILS)/gifbuild < [email protected] > [email protected] |
| 73 |
@$(UTILS)/gifbuild -d < [email protected] > [email protected] |
| 74 |
@./tapdiffer <[email protected] "gifbuild: Checking idempotency on an animation." [email protected] |
| 75 |
@rm -f [email protected] [email protected] [email protected] |
| 76 |
|
| 77 |
gifclrmp-regress: |
| 78 |
@for test in $(GIFS); \ |
| 79 |
do \ |
| 80 |
stem=`basename $${test} | sed -e "s/.gif$$//"`; \ |
| •81 |
if ! $(UTILS)/gifclrmp <$${test} > $@.$${stem}.regress; \ |
| 82 |
then \ |
| 83 |
echo "not ok - gifclrmap: crashed on $${test}"; \ |
| 84 |
else \ |
| 85 |
./tapdiffer <$@.$${stem}.regress "gifclrmap: Checking colormap of $${test}" $${stem}.map; \ |
| 86 |
fi \ |
| 87 |
done |
| 88 |
@rm -f $@.*.regress |
| 89 |
gifclrmp-rebuild: |
| 90 |
@for test in $(GIFS); do \ |
| 91 |
stem=`basename $${test} | sed -e "s/.gif$$//"`; \ |
| 92 |
echo "Remaking $${stem}.map"; \ |
| 93 |
$(UTILS)/gifclrmp <$${test} >$${stem}.map; \ |
| 94 |
done |
| 95 |
|
| 96 |
gifecho-rebuild: |
| 97 |
@echo "Rebuilding gifecho test." |
| 98 |
@$(UTILS)/gifecho -t "foobar" | $(UTILS)/gifbuild -d >foobar.ico |
| 99 |
gifecho-regress: |
| 100 |
@$(UTILS)/gifecho -t "foobar" | $(UTILS)/gifbuild -d | ./tapdiffer "gifecho: Testing gifecho behavior" foobar.ico |
| 101 |
|
| 102 |
giffilter-regress: $(GIF2RGB) |
| 103 |
@for test in $(GIFS); \ |
| 104 |
do \ |
| 105 |
stem=`basename $${test} | sed -e "s/.gif$$//"`; \ |
| 106 |
$(UTILS)/giffilter <$${test} | $(UTILS)/gif2rgb | ./cmpdiffer "giffiltr: copy of $${test}" "$${stem}.rgb"; \ |
| 107 |
done |
| 108 |
|
| 109 |
giffix-rebuild: |
| 110 |
@echo "Rebuilding giffix test." |
| 111 |
@head --bytes=-20 <$(PICS)/treescap.gif | $(UTILS)/giffix 2>/dev/null | $(UTILS)/gifbuild -d >giffixed.ico |
| 112 |
giffix-regress: |
| 113 |
@head --bytes=-20 <$(PICS)/treescap.gif | $(UTILS)/giffix 2>/dev/null | $(UTILS)/gifbuild -d | ./tapdiffer "giffix: Testing giffix behavior" giffixed.ico |
| 114 |
|
| 115 |
gifinto-regress: |
| 116 |
@rm -f [email protected] |
| 117 |
@$(UTILS)/gifinto <$(PICS)/porsche.gif [email protected] |
| 118 |
@if test ! -f [email protected]; then echo "not ok - gifinto failed to create a file when it should have."; fi |
| 119 |
@rm -f [email protected] |
| 120 |
@echo "0123456789" | $(UTILS)/gifinto [email protected] 2>/dev/null |
| 121 |
@if test -f [email protected]; \ |
| 122 |
then \ |
| 123 |
echo "not ok - gifinto created a file when it shouldn't have."; \ |
| 124 |
else \ |
| 125 |
echo "ok - gifinto correctly refrained from file creation."; \ |
| 126 |
fi |
| 127 |
@rm -f [email protected] |
| 128 |
|
| 129 |
gifsponge-regress: $(GIF2RGB) |
| 130 |
@for test in $(GIFS); \ |
| 131 |
do \ |
| 132 |
stem=`basename $${test} | sed -e "s/.gif$$//"`; \ |
| 133 |
$(UTILS)/gifsponge <$${test} | $(UTILS)/gif2rgb | ./cmpdiffer "gifsponge: sink of $${test}" $${stem}.rgb; \ |
| 134 |
done |
| 135 |
|
| 136 |
giftext-regress: |
| 137 |
@for test in $(GIFS); \ |
| 138 |
do \ |
| 139 |
stem=`basename $${test} | sed -e "s/.gif$$//"`; \ |
| 140 |
$(UTILS)/giftext <$${test} | ./cmpdiffer "text dump of $${test}" $${stem}.dmp; \ |
| 141 |
done |
| 142 |
giftext-rebuild: |
| 143 |
@for test in $(GIFS); do \ |
| 144 |
stem=`basename $${test} | sed -e "s/.gif$$//"`; \ |
| 145 |
echo "Remaking $${stem}.dmp"; \ |
| 146 |
$(UTILS)/giftext <$${test} >$${stem}.dmp; \ |
| 147 |
done |
| 148 |
|
| 149 |
giftool-regress: $(GIF2RGB) |
| 150 |
@$(UTILS)/giftool <$(PICS)/gifgrid.gif | $(UTILS)/gif2rgb | ./cmpdiffer "giftool: expensive copy via giftool" gifgrid.rgb |
| 151 |
@$(UTILS)/giftool -i on <$(PICS)/treescap-interlaced.gif | $(UTILS)/gif2rgb | ./cmpdiffer "giftool: deinterlace" treescap.rgb |
| 152 |
@$(UTILS)/giftool -i off <$(PICS)/treescap.gif | $(UTILS)/gif2rgb | ./cmpdiffer "giftool: interlace" treescap-interlaced.rgb |
| 153 |
|
| 154 |
gifwedge-rebuild: |
| 155 |
@echo "Remaking the gifwedge test." |
| 156 |
@$(UTILS)/gifwedge >wedge.gif |
| 157 |
gifwedge-regress: |
| 158 |
@$(UTILS)/gifwedge | ./cmpdiffer "gifwedge: wedge generation." wedge.gif |