Add test/nia-checksums-of-data.txt

This commit is contained in:
Nigel Tao committed 2021-10-07 16:49:38 +11:00
1 parent eb6703425a
commit 62125d8967
3 files changed
+161 -1

No files matched your search

+25 -1
View File
@@ -70,12 +70,19 @@ wuffs test -skipgen -mimic
wuffs bench -skipgen -mimic -reps=1 -iterscale=1
./build-example.sh
./build-fuzz.sh
# ----
echo "Running gen/bin/example-crc32"
JSON_THINGS_CRC32=$(gen/bin/example-crc32 < test/data/json-things.formatted.json)
if [ "$JSON_THINGS_CRC32" != "cdcc7e35" ]; then
echo "example-crc32 failed on json-things data"
exit 1
fi
# ----
echo "Running gen/bin/example-jsonptr"
JSON_THINGS_CRC32=$(gen/bin/example-jsonptr < test/data/json-things.unformatted.json | gen/bin/example-crc32)
if [ "$JSON_THINGS_CRC32" != "cdcc7e35" ]; then
@@ -83,8 +90,25 @@ if [ "$JSON_THINGS_CRC32" != "cdcc7e35" ]; then
exit 1
fi
./build-fuzz.sh
# ----
echo "Running gen/bin/example-convert-to-nia"
set +e
script/print-nia-checksums.sh | \
diff --unified test/nia-checksums-of-data.txt /dev/stdin
if [ $? != 0 ]; then
echo "Unexpected change in test/nia-checksums-of-data.txt"
exit 1
fi
set -e
# ----
for f in gen/bin/fuzz-*; do
echo "Running $f"
$f test/data > /dev/null
done
# ----
echo "DONE: build-all.sh"
+74
View File
@@ -0,0 +1,74 @@
#!/bin/bash -eu
# Copyright 2021 The Wuffs Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# ----------------
# This script prints the CRC-32 checksum of the decoded pixels (in the NIA
# format, see doc/spec/nie-spec.md) of every image given as a command line
# argument: if a file then itself, if a directory then the files under it. It
# skips any non-image file found (non-image meaning not decodable by Wuffs'
# standard library).
#
# It is not perfect. It can have false positives and false negatives.
# Nonetheless, running it regularly (compiled against the in-development
# release/c/wuffs-unsupported-snapshot.c) can help detect regressions.
#
# "False positive" means that a non-image file can produce a non-zero checksum.
# Any file (containing binary data) starting with two '\x00' NUL bytes can
# sometimes be mistaken for a WBMP-formatted image file.
#
# "False negative" means that an image file that produces an all-zero checksum
# will be skipped.
if [ ! -e wuffs-root-directory.txt ]; then
echo "$0 should be run from the Wuffs root directory."
exit 1
elif [ ! -e gen/bin/example-convert-to-nia ]; then
echo "Run \"./build-example.sh example/convert-to-nia\" first."
exit 1
elif [ ! -e gen/bin/example-crc32 ]; then
echo "Run \"./build-example.sh example/crc32\" first."
exit 1
fi
sources=$@
if [ $# -eq 0 ]; then
sources=test/data
fi
# ----
handle() {
local c=$(gen/bin/example-convert-to-nia <$1 2>/dev/null | gen/bin/example-crc32)
if [ "$c" != "00000000" ]; then
echo $c $1
fi
}
# ----
echo "# Generated by script/print-nia-checksums.sh"
for f in $sources; do
if [ -f $f ]; then
handle $f
elif [ -d $f ]; then
for g in `find $f -type f | sort`; do
handle $g
done
else
echo "Could not open $f"
exit 1
fi
done
+62
View File
@@ -0,0 +1,62 @@
# Generated by script/print-nia-checksums.sh
76e40058 test/data/animated-red-blue.gif
912861f4 test/data/archive.iso
f9a10dac test/data/artificial/gif-background-color.gif
36e7d9c7 test/data/artificial/gif-empty-palette.gif
db4c30eb test/data/artificial/gif-frame-out-of-bounds.gif
fdcc644f test/data/artificial/gif-metadata-empty.gif
fdcc644f test/data/artificial/gif-metadata-full.gif
6d03b5f3 test/data/artificial/gif-multiple-graphic-controls.gif
47c877fd test/data/artificial/gif-multiple-loop-counts.gif
76c44866 test/data/artificial/gif-no-frames.gif
6ec818c3 test/data/artificial/gif-pixel-data-none.gif
5e57adb2 test/data/artificial/gif-pixel-data-not-enough.gif
3e29f88a test/data/artificial/gif-pixel-data-too-much.gif
f50d1d50 test/data/artificial/gif-small-frame-interlaced.gif
beaec397 test/data/artificial/gif-transparent-index.gif
6ec818c3 test/data/artificial/gif-zero-width-frame.gif
912861f4 test/data/australian-abc-local-stations.tokens
076cb375 test/data/bricks-color.bmp
076cb375 test/data/bricks-color.png
f36c2e80 test/data/bricks-dither.bmp
3fc62e1e test/data/bricks-dither.gif
f36c2e80 test/data/bricks-dither.no-ancillary.png
f36c2e80 test/data/bricks-dither.png
c2bce675 test/data/bricks-gray.bmp
0e16e6eb test/data/bricks-gray.gif
c2bce675 test/data/bricks-gray.no-ancillary.png
c2bce675 test/data/bricks-gray.png
7aebfe6c test/data/bricks-nodither.bmp
b641fef2 test/data/bricks-nodither.gif
7aebfe6c test/data/bricks-nodither.png
ae2e547d test/data/bricks-nodither.wbmp
912861f4 test/data/cbor-rfc-7049-examples.tokens
3014b4c0 test/data/gifplayer-muybridge.gif
030f5a48 test/data/harvesters.bmp
0d213dc4 test/data/harvesters.gif
e776c90f test/data/hat.bmp
a161a63a test/data/hat.gif
e776c90f test/data/hat.png
d30bfe5d test/data/hat.wbmp
33a44f22 test/data/hibiscus.primitive.bmp
e948122d test/data/hibiscus.primitive.gif
33a44f22 test/data/hibiscus.primitive.png
60040742 test/data/hibiscus.regular.bmp
7b8dda15 test/data/hibiscus.regular.gif
60040742 test/data/hibiscus.regular.png
dcbb225a test/data/hippopotamus.bmp
21e17862 test/data/hippopotamus.interlaced.gif
dcbb225a test/data/hippopotamus.interlaced.png
a80781a1 test/data/hippopotamus.interlaced.truncated.gif
1f11edb9 test/data/hippopotamus.masked-with-muybridge.gif
7e6acf01 test/data/hippopotamus.masked-with-muybridge.png
21e17862 test/data/hippopotamus.regular.gif
dcbb225a test/data/hippopotamus.regular.png
aa7e021c test/data/json-quirks.tokens
912861f4 test/data/json-things.unformatted.tokens
2dccfe56 test/data/muybridge-frame-000.wbmp
db2733f5 test/data/muybridge.gif
bf7e8c96 test/data/pjw-thumbnail.bmp
73d48c08 test/data/pjw-thumbnail.gif
bf7e8c96 test/data/pjw-thumbnail.png
75060601 test/data/rgb24png.bmp