2021-01-22 16:44:05 +00:00
|
|
|
#!/usr/bin/env bash
|
2020-12-24 16:39:37 +00:00
|
|
|
|
|
|
|
set -eo pipefail
|
|
|
|
|
|
|
|
script_path=$(cd -P -- "$(dirname -- "$0")" && pwd -P)
|
|
|
|
cd "${script_path}/.."
|
|
|
|
|
|
|
|
MISSING_FILES=n
|
|
|
|
|
|
|
|
while IFS= read -r FILENAME; do
|
|
|
|
# Simply search whether the CMakeLists.txt *ever* mention the test files.
|
2021-10-26 18:08:39 +00:00
|
|
|
if ! grep -qF "${FILENAME}" Tests/AK/CMakeLists.txt ; then
|
2021-09-13 19:14:24 +00:00
|
|
|
echo "Tests/AK/CMakeLists.txt is either missing the test file ${FILENAME} or is not in the commit's staged changes"
|
2020-12-24 16:39:37 +00:00
|
|
|
MISSING_FILES=y
|
|
|
|
fi
|
|
|
|
done < <(
|
2021-10-26 18:11:24 +00:00
|
|
|
git ls-files 'Tests/AK/Test*.cpp' | xargs basename
|
2020-12-24 16:39:37 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
if [ "n" != "${MISSING_FILES}" ] ; then
|
2021-08-05 10:01:41 +00:00
|
|
|
echo "Some files are missing from the Tests/AK/CMakeLists.txt."
|
2020-12-24 16:39:37 +00:00
|
|
|
echo "If a new test file is being added, ensure it is in the CMakeLists.txt."
|
|
|
|
echo "This ensures the new tests are always run."
|
|
|
|
exit 1
|
|
|
|
fi
|