diff options
author | Vic (Chun-Ju) Yang <victoryang@chromium.org> | 2014-02-06 16:45:28 +0800 |
---|---|---|
committer | chrome-internal-fetch <chrome-internal-fetch@google.com> | 2014-03-28 21:27:40 +0000 |
commit | 614698f98635db6d89980a1ffcad50a71d5852a6 (patch) | |
tree | 2419faa5a3e4743f86b60eba52c2873b01da620a | |
parent | 3c90074ecd213ff8dde9dbf9885666cd27dc6ae4 (diff) | |
download | chrome-ec-614698f98635db6d89980a1ffcad50a71d5852a6.tar.gz |
Add presubmit check for unit test
This enforces that "make buildall" runs at least once after the last
file change.
TEST=Try to upload without running "make buildall"
TEST=Change a file without re-running "make buildall", and try to
upload.
BUG=None
BRANCH=None
Change-Id: If2b23cb036bb0f220d570eb12d8569824a4edf84
Original-Change-Id: Ia4abb3c0e17cf4d559975574f398d74c7986c89f
Signed-off-by: Vic (Chun-Ju) Yang <victoryang@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/185116
Reviewed-by: Dave Parker <dparker@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/192168
Commit-Queue: Dave Parker <dparker@chromium.org>
Tested-by: Dave Parker <dparker@chromium.org>
Reviewed-by: Randall Spangler <rspangler@chromium.org>
-rw-r--r-- | .gitignore | 1 | ||||
-rw-r--r-- | Makefile.rules | 2 | ||||
-rw-r--r-- | PRESUBMIT.cfg | 2 | ||||
-rwxr-xr-x | util/presubmit_check.sh | 17 |
4 files changed, 22 insertions, 0 deletions
diff --git a/.gitignore b/.gitignore index 1e7812abbb..9c5f02bad6 100644 --- a/.gitignore +++ b/.gitignore @@ -4,3 +4,4 @@ private/ *.pyc tags cscope.out +.tests-passed diff --git a/Makefile.rules b/Makefile.rules index 103a12c0ac..8a324fa6e1 100644 --- a/Makefile.rules +++ b/Makefile.rules @@ -66,6 +66,8 @@ targ_if_prog = $(if $(shell which $(1) 2>/dev/null),$(2),) all: $(out)/$(PROJECT).bin utils buildall: $(foreach b, $(boards), proj-$(b)) runtests + @touch .tests-passed + proj-%: @echo "======= building $*"; \ $(MAKE) --no-print-directory BOARD=$* V=$(V) diff --git a/PRESUBMIT.cfg b/PRESUBMIT.cfg index 2e8cdb6618..d02e3f3703 100644 --- a/PRESUBMIT.cfg +++ b/PRESUBMIT.cfg @@ -4,3 +4,5 @@ # The indentation is checked by checkpatch not the python script tab_check: false +[Hook Scripts] +hook0 = util/presubmit_check.sh 2>&1 diff --git a/util/presubmit_check.sh b/util/presubmit_check.sh new file mode 100755 index 0000000000..220522083e --- /dev/null +++ b/util/presubmit_check.sh @@ -0,0 +1,17 @@ +#!/bin/bash +# +# Copyright (c) 2014 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. + +if [[ ! -e .tests-passed ]]; then + echo 'Unit tests have not passed. Please run "make buildall -j".' + exit 1 +fi +changed=$(find ${PRESUBMIT_FILES} -newer .tests-passed) +if [[ -n "${changed}" ]]; then + echo "Files have changed since last time unit tests passed:" + echo "${changed}" | sed -e 's/^/ /' + echo 'Please run "make buildall -j".' + exit 1 +fi |