diff --git a/.gitignore b/.gitignore index 3e9796af..cccd6a58 100644 --- a/.gitignore +++ b/.gitignore @@ -110,6 +110,7 @@ tests/*.check !tests/ssml.test !tests/translate.test !tests/non-executable-files-with-executable-bit.test +!tests/bom.test espeak-ng.pc diff --git a/Makefile.am b/Makefile.am index a8c2200c..c79a2963 100644 --- a/Makefile.am +++ b/Makefile.am @@ -256,7 +256,8 @@ check: tests/encoding.check \ tests/language-pronunciation.check \ tests/language-numbers-cardinal.check \ tests/language-numbers-ordinal.check \ - tests/non-executable-files-with-executable-bit.check + tests/non-executable-files-with-executable-bit.check \ + tests/bom.check ##### fuzzer: diff --git a/tests/bom.test b/tests/bom.test new file mode 100755 index 00000000..ae95e4bf --- /dev/null +++ b/tests/bom.test @@ -0,0 +1,22 @@ +#!/bin/bash +# This script checks for Byte Order Marks in source files +# which in some places may break compilation/runtime of eSpeak NG +# Look for more at: https://en.wikipedia.org/wiki/Byte_order_mark + +echo -n "testing for Byte Order Marks in source files ... " + +# TODO checking for other encodings (e.g. UTF-16, UTF-32, UTF-7) needs more elaborate search, +# otherwise it shows many false positives + +egrep -rlI $'\xEF\xBB\xBF' . | tee tests/bom.check >/dev/null # UTF-8 + +if [ -s tests/bom.check ] ; then + echo "found:" + cat tests/bom.check + false +else + rm tests/bom.check + echo "none found" + true +fi +