diff options
author | Gwendal Grignou <gwendal@chromium.org> | 2019-04-08 14:52:34 -0700 |
---|---|---|
committer | chrome-bot <chrome-bot@chromium.org> | 2019-04-26 00:17:31 -0700 |
commit | 5c931074f53de0bcac655d60e5867b3eb0959864 (patch) | |
tree | 2acb81ac19cad47cbd174ec8eb39789035951ecf /util/linux_ec_commands_h_check.sh | |
parent | d3ce30103e55fb8296259bd7d22f7d8c8d8e7a0c (diff) | |
download | chrome-ec-5c931074f53de0bcac655d60e5867b3eb0959864.tar.gz |
util: Add tool to generate cros_ec_commands.h
Add a rule to generate a new cros_ec_commands.h when ec_commands.h is
modified. The rule is checked when buildall is invoked.
At Presubmit stage, check a cros_ec_commands.h exists if ec_commands.h
is modified.
The CL author is responsible to upstream that file.
BUG=chromium:945948
BRANCH=none
Cq-Depend: chromium:1558853
TEST=Check manually cros_ec_commands.h is generated with
make build_cros_ec_commands
Check no bread crumbs are left-over when the rule fails.
Check checkpatch triggers when it finds an invalid syntax in the output
file.
Check ../../repohooks/pre-upload.py returns a meaningful error when
cros_ec_commands.h file is not present.
Change-Id: Ibc8ed7165914d39b5f0bd41643932a8514768925
Signed-off-by: Gwendal Grignou <gwendal@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/1559380
Commit-Ready: ChromeOS CL Exonerator Bot <chromiumos-cl-exonerator@appspot.gserviceaccount.com>
Reviewed-by: Brian Norris <briannorris@chromium.org>
Diffstat (limited to 'util/linux_ec_commands_h_check.sh')
-rwxr-xr-x | util/linux_ec_commands_h_check.sh | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/util/linux_ec_commands_h_check.sh b/util/linux_ec_commands_h_check.sh new file mode 100755 index 0000000000..4c55faca0a --- /dev/null +++ b/util/linux_ec_commands_h_check.sh @@ -0,0 +1,25 @@ +#!/bin/bash +# +# Copyright 2019 The Chromium OS Authors. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +set -e + +ec_commands_file_in="include/ec_commands.h" +ec_commands_file_out="build/kernel/include/linux/mfd/cros_ec_commands.h" + +# Check if ec_commands.h has changed. +echo ${PRESUBMIT_FILES} | grep -q "${ec_commands_file_in}" || exit 0 + +if [ ! -f "${ec_commands_file_out}" ]; then + echo "A new cros_ec_commands.h must be generated." + echo 'Please run "make buildall" or "make build_cros_ec_commands"'. + exit 1 +fi + +if [ "${ec_commands_file_out}" -ot "${ec_commands_file_in}" ]; then + echo "cros_ec_commands.h is out of date." + echo 'Please run "make buildall" or "make build_cros_ec_commands"'. + exit 1 +fi |