2021-01-22 19:44:05 +03:00
|
|
|
#!/usr/bin/env bash
|
2020-12-24 19:39:37 +03: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 21:08:39 +03:00
|
|
|
if ! grep -qF "${FILENAME}" Tests/AK/CMakeLists.txt ; then
|
2021-09-13 22:14:24 +03: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 19:39:37 +03:00
|
|
|
MISSING_FILES=y
|
|
|
|
fi
|
|
|
|
done < <(
|
2021-10-26 21:11:24 +03:00
|
|
|
git ls-files 'Tests/AK/Test*.cpp' | xargs basename
|
2020-12-24 19:39:37 +03:00
|
|
|
)
|
|
|
|
|
|
|
|
if [ "n" != "${MISSING_FILES}" ] ; then
|
2021-08-05 13:01:41 +03:00
|
|
|
echo "Some files are missing from the Tests/AK/CMakeLists.txt."
|
2020-12-24 19:39:37 +03: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
|