diff options
author | Nicolas Boichat <drinkcat@chromium.org> | 2017-08-29 08:44:13 +0800 |
---|---|---|
committer | chrome-bot <chrome-bot@chromium.org> | 2017-08-29 22:08:20 -0700 |
commit | 2777b7771e788a7c2205c907710b703c48efedc5 (patch) | |
tree | 4ca5c44a99d4c0e6d0bdb2413a55d159e5b14c9e /util/presubmit_check.sh | |
parent | c1e5671e561c82c9532cb29b17fc7cf4061ab20a (diff) | |
download | chrome-ec-2777b7771e788a7c2205c907710b703c48efedc5.tar.gz |
presubmit_check: Check unittests results on extra/stack_analyzer
BRANCH=none
BUG=none
TEST=util/presubmit_check.sh
Change-Id: I6078377603719de1d633660c69ad3a40b29ffadf
Signed-off-by: Nicolas Boichat <drinkcat@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/640191
Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
Reviewed-by: Che-yu Wu <cheyuw@google.com>
Diffstat (limited to 'util/presubmit_check.sh')
-rwxr-xr-x | util/presubmit_check.sh | 39 |
1 files changed, 25 insertions, 14 deletions
diff --git a/util/presubmit_check.sh b/util/presubmit_check.sh index b4024dbfd8..b11c8dec47 100755 --- a/util/presubmit_check.sh +++ b/util/presubmit_check.sh @@ -9,10 +9,14 @@ if [[ ! -e .tests-passed ]]; then exit 1 fi +# Directories that need to be tested by separate unit tests. +unittest_dirs="util/ec3po/ extra/stack_analyzer/" + changed=$(find ${PRESUBMIT_FILES} -newer .tests-passed) -ec3po_files=$(echo "${PRESUBMIT_FILES}" | grep util/ec3po/) -# Filter out ec3po files from changed files. They're handled separately. -changed=$(echo "${changed}" | grep -v util/ec3po/) +# Filter out unittest_dirs files from changed files. They're handled separately. +for dir in $unittest_dirs; do + changed=$(echo "${changed}" | grep -v "${dir}") +done # Filter out flash_ec since it's not part of any unit tests. changed=$(echo "${changed}" | grep -v util/flash_ec) # Filter out this file itself. @@ -24,15 +28,22 @@ if [[ -n "${changed}" ]]; then exit 1 fi -if [[ ! -e util/ec3po/.tests-passed ]] && [[ -n "${ec3po_files}" ]]; then - echo 'Unit tests have not passed. Please run "util/ec3po/run_tests.sh".' - exit 1 -fi +for dir in $unittest_dirs; do + dir_files=$(echo "${PRESUBMIT_FILES}" | grep "${dir}") + if [[ -z "${dir_files}" ]]; then + continue + fi -changed_ec3po_files=$(find ${ec3po_files} -newer util/ec3po/.tests-passed) -if [[ -n "${changed_ec3po_files}" ]] && [[ -n "${ec3po_files}" ]]; then - echo "Files have changed since last time EC-3PO unit tests passed:" - echo "${changed_ec3po_files}" | sed -e 's/^/ /' - echo 'Please run "util/ec3po/run_tests.sh".' - exit 1 -fi + if [[ ! -e "${dir}/.tests-passed" ]]; then + echo "Unit tests have not passed. Please run \"${dir}run_tests.sh\"." + exit 1 + fi + + changed_files=$(find ${dir_files} -newer "${dir}/.tests-passed") + if [[ -n "${changed_files}" ]] && [[ -n "${dir_files}" ]]; then + echo "Files have changed since last time unit tests passed:" + echo "${changed_files}" | sed -e 's/^/ /' + echo "Please run \"${dir}run_tests.sh\"." + exit 1 + fi +done |