mirror of
https://github.com/KhronosGroup/OpenCL-CTS.git
synced 2026-03-19 14:09:03 +00:00
* ci: use ubuntu-22.04 instead of 20.04 Signed-off-by: Kevin Petit <kevin.petit@arm.com> * bump clang-format version Oldest supported by 22.04 * update check-format script --------- Signed-off-by: Kevin Petit <kevin.petit@arm.com>
18 lines
625 B
Bash
Executable File
18 lines
625 B
Bash
Executable File
#!/usr/bin/env bash
|
|
|
|
# Arg used to specify non-'origin/main' comparison branch
|
|
ORIGIN_BRANCH=${1:-"origin/main"}
|
|
CLANG_BINARY=${2:-"`which clang-format-11`"}
|
|
|
|
# Run git-clang-format to check for violations
|
|
CLANG_FORMAT_OUTPUT=$(git-clang-format --diff $ORIGIN_BRANCH --extensions c,cpp,h,hpp --binary $CLANG_BINARY)
|
|
|
|
# Check for no-ops
|
|
grep '^no modified files to format$' <<<"$CLANG_FORMAT_OUTPUT" && exit 0
|
|
grep '^clang-format did not modify any files$' <<<"$CLANG_FORMAT_OUTPUT" && exit 0
|
|
|
|
# Dump formatting diff and signal failure
|
|
echo -e "\n==== FORMATTING VIOLATIONS DETECTED ====\n"
|
|
echo "$CLANG_FORMAT_OUTPUT"
|
|
exit 1
|