zephyr/tests/compliance/checkpatch.sh
Inaky Perez-Gonzalez aba4b555f4 testcases: sample static testcase to run checkpatch on the source
This is a sample static testcase (so it needs no target machine) to
run checkpatch as a testcase and produce output only if it fails.

Change-Id: I055c0125ac785058e101faa68eb5aaff9f7caf16
Signed-off-by: Inaky Perez-Gonzalez <inaky.perez-gonzalez@intel.com>
2016-06-14 23:49:57 +00:00

25 lines
691 B
Bash
Executable File

#! /bin/bash -e
#
# @testcase static defaults=none
# @eval shcmd %(thisfile)s %(srcdir)s/../../
# @tags bat
#
# If checkpatch.pl is not on your path, you can:
# 1 - put it in your path (copy or symlink)
# 2 - export CPPPATH to the path where it is
#
# (1) is easier
#
set -eu -o pipefail
cd $1 || exit 127
# If no modifications to the tree, check the previous commit;
# otherwise, show the current modifications
if git diff-index HEAD --quiet; then
git show HEAD || exit 127
else
git diff HEAD || exit 127
fi \
| ${CPPATH:-scripts/}checkpatch.pl \
${CPOPTS:---no-tree --patch --show-types --mailback --terse --showfile --ignore FILE_PATH_CHANGES } \
-