From 02dc828ecb5451f528a4dded4a339ef0f98e9ad7 Mon Sep 17 00:00:00 2001 From: "Reece H. Dunn" Date: Tue, 3 Dec 2019 19:50:28 +0000 Subject: [PATCH] Add a test to ensure data/source files are not marked as executable. --- .gitignore | 2 ++ Makefile.am | 3 ++- ...-executable-files-with-executable-bit.test | 21 +++++++++++++++++++ 3 files changed, 25 insertions(+), 1 deletion(-) create mode 100755 tests/non-executable-files-with-executable-bit.test diff --git a/.gitignore b/.gitignore index 748ed7a3..3e9796af 100644 --- a/.gitignore +++ b/.gitignore @@ -101,6 +101,7 @@ src/espeakedit src/speak-ng tests/*.test +tests/*.check !tests/language-phonemes.test !tests/language-pronunciation.test !tests/language-numbers-cardinal.test @@ -108,6 +109,7 @@ tests/*.test !tests/language-replace.test !tests/ssml.test !tests/translate.test +!tests/non-executable-files-with-executable-bit.test espeak-ng.pc diff --git a/Makefile.am b/Makefile.am index 38ac099b..907b6bdf 100644 --- a/Makefile.am +++ b/Makefile.am @@ -252,7 +252,8 @@ check: tests/encoding.check \ tests/language-replace.check \ tests/language-pronunciation.check \ tests/language-numbers-cardinal.check \ - tests/language-numbers-ordinal.check + tests/language-numbers-ordinal.check \ + tests/non-executable-files-with-executable-bit.check ##### fuzzer: diff --git a/tests/non-executable-files-with-executable-bit.test b/tests/non-executable-files-with-executable-bit.test new file mode 100755 index 00000000..c9f090fb --- /dev/null +++ b/tests/non-executable-files-with-executable-bit.test @@ -0,0 +1,21 @@ +#!/bin/sh + +echo -n "testing files for executable bits that shouldn't be executable ... " + +find * -executable -type f | \ + grep -vE "compile|config\.(guess|status|sub)|configure|depcomp|install-sh|libtool|missing" | # Ignore autotools output \ + grep -vE "*\.test|src(/\.libs)?/(e?speak-ng|.*\.so\..*)" | # Ignore built programs and libraries \ + grep -vE "*.\.sh|tools/emoji" | # Ignore helper scripts \ + grep -vE "src/ucd-tools/tools/(.*\.py|mkencodingtable)" | # Ignore ucd-tools helper scripts \ + tee tests/non-executable-files-with-executable-bit.check > /dev/null + +if [ -s tests/non-executable-files-with-executable-bit.check ] ; then + echo "found" + cat tests/non-executable-files-with-executable-bit.check + false +else + rm tests/non-executable-files-with-executable-bit.check + echo "none found" + true +fi +