summaryrefslogtreecommitdiff
path: root/Meta/check-ak-test-files.sh
blob: 0ac82bd95860b94a7eda1e04eb59b0dffe2f303f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
#!/usr/bin/env bash

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.
    if ! grep -qP "${FILENAME}" Tests/AK/CMakeLists.txt ; then
        echo "Tests/AK/CMakeLists.txt is missing the test file ${FILENAME}"
        MISSING_FILES=y
    fi
done < <(
    git ls-files 'Tests/AK/Test*.cpp' | xargs -i basename {}
)

if [ "n" != "${MISSING_FILES}" ] ; then
    echo "Some files are missing from the Tests/AK/CMakeLists.txt."
    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