summaryrefslogtreecommitdiff
path: root/util/host_command_check.sh
diff options
context:
space:
mode:
authorVadim Bendebury <vbendeb@chromium.org>2017-12-07 18:28:20 -0800
committerchrome-bot <chrome-bot@chromium.org>2017-12-08 20:37:23 -0800
commit94774ad9df604dcb50ac91ffb94ab518d7a537cf (patch)
treeea8f615f07dffc7cfded0f26b1f2d94f33b7f587 /util/host_command_check.sh
parent7c96395355a6f483767be44776ae3cc5afa72fcf (diff)
downloadchrome-ec-94774ad9df604dcb50ac91ffb94ab518d7a537cf.tar.gz
util: do not run host command check unless needed
With the recent addition of the presubmit check progress display it became obvious that hook2 from ./PRESUBMIT.cfg takes quite a bit of time on each check. A closer examination has shown that this script scans the entire codebase on each patch to see if there have been some inconsistencies wrt EC host command definitions. Let's limit running this check only to patches which actually touch EC host commands in any way. BRANCH=none BUG=none TEST=verified that the check runs only when the 'EC_.*CMD' string is present in the diffs output of the patch Change-Id: I128dba48332142b8835cf36747ab290190e6bcef Signed-off-by: Vadim Bendebury <vbendeb@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/815951 Reviewed-by: Aseda Aboagye <aaboagye@chromium.org> Reviewed-by: Sam Hurst <shurst@google.com>
Diffstat (limited to 'util/host_command_check.sh')
-rwxr-xr-xutil/host_command_check.sh7
1 files changed, 7 insertions, 0 deletions
diff --git a/util/host_command_check.sh b/util/host_command_check.sh
index 57f0b8ffe3..62911bb0c3 100755
--- a/util/host_command_check.sh
+++ b/util/host_command_check.sh
@@ -80,6 +80,13 @@ should_check() {
}
main() {
+
+ # Do not run the check unless an EC_[xxx]CMD change is present.
+ if [[ -z "$(git diff "${PRESUBMIT_COMMIT}~" "${PRESUBMIT_COMMIT}" -U0 |
+ egrep 'EC_[^ ]*CMD')" ]]; then
+ exit 0
+ fi
+
ec_errors=()
ei=0
# Search all file occurrences of "EC_CMD" and store in array