Skip to content

Commit cadda39

Browse files
committed
Meta: Make check-jbig2-json.sh verify all jbig2 files are json-generated
Now that all our jbig2 test files are json-generated, let's keep it that way :^)
1 parent cb4230b commit cadda39

File tree

1 file changed

+14
-1
lines changed

1 file changed

+14
-1
lines changed

Meta/check-jbig2-json.sh

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,19 @@
22

33
set -eo pipefail
44

5+
jbig_files=(Tests/LibGfx/test-inputs/jbig2/*.jbig2)
6+
json_files=(Tests/LibGfx/test-inputs/jbig2/json/*.json)
7+
8+
if [ "${#jbig_files[@]}" -gt "${#json_files[@]}" ]; then
9+
echo "More jbig2 than json files. Don't add non-json-based jbig2 files."
10+
exit 1
11+
fi
12+
13+
if [ "${#jbig_files[@]}" -lt "${#json_files[@]}" ]; then
14+
echo "More json than jbig2 files. Did you forget to 'git add'?"
15+
exit 1
16+
fi
17+
518
trap 'git diff --exit-code' EXIT
619

720
script_path=$(cd -P -- "$(dirname -- "$0")" && pwd -P)
@@ -20,7 +33,7 @@ if [ -z "${JBIG2_FROM_JSON_BINARY:-}" ] ; then
2033
JBIG2_FROM_JSON_BINARY="Build/lagom/bin/jbig2-from-json"
2134
fi
2235

23-
for f in Tests/LibGfx/test-inputs/jbig2/json/*.json; do
36+
for f in "${json_files[@]}"; do
2437
f_jb2=Tests/LibGfx/test-inputs/jbig2/$(basename "${f%.json}.jbig2")
2538
"$JBIG2_FROM_JSON_BINARY" -o "$f_jb2" "$f"
2639
done

0 commit comments

Comments
 (0)