summaryrefslogtreecommitdiff
path: root/util/presubmit_check.sh
diff options
context:
space:
mode:
authorAseda Aboagye <aaboagye@google.com>2015-12-17 14:06:03 -0800
committerchrome-bot <chrome-bot@chromium.org>2016-01-04 16:26:22 -0800
commitc6773e676536d82ee0649865138713123a7c8445 (patch)
treea1071ce2fc9ff3ec4fb2169ba1ca48ee9e7d0940 /util/presubmit_check.sh
parentec7927a20d4fd1db35e482a69da1e9915552322f (diff)
downloadchrome-ec-c6773e676536d82ee0649865138713123a7c8445.tar.gz
util: ec3po: Add presubmit check for ec3po.stabilize-smaug-7800.B
Added presubmit check to make sure that when any ec3po files are modified, the unit tests should be run as well. BUG=None BRANCH=None TEST=Touched a unit test file, tried repo upload and received an error about running unit tests. Ran run_tests.sh and all tests passed. Tried to repo upload again and this time it succeeded. TEST=Created a failure in one unit test, ran run_tests.sh and verified that the failure was caught and the CL wouldn't pass the presubmit check. Change-Id: I4df4a0fd1107292f693749188491f6286360f557 Signed-off-by: Aseda Aboagye <aaboagye@google.com> Reviewed-on: https://chromium-review.googlesource.com/319211 Commit-Ready: Aseda Aboagye <aaboagye@chromium.org> Tested-by: Aseda Aboagye <aaboagye@chromium.org> Reviewed-by: Randall Spangler <rspangler@chromium.org>
Diffstat (limited to 'util/presubmit_check.sh')
-rwxr-xr-xutil/presubmit_check.sh17
1 files changed, 17 insertions, 0 deletions
diff --git a/util/presubmit_check.sh b/util/presubmit_check.sh
index 220522083e..41045042f1 100755
--- a/util/presubmit_check.sh
+++ b/util/presubmit_check.sh
@@ -8,10 +8,27 @@ 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)
+ec3po_files=$(echo "${PRESUBMIT_FILES}" | grep util/ec3po/)
+# Filter out ec3po files from changed files.
+changed=$(echo "${changed}" | grep -v util/ec3po/)
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
+
+if [[ ! -e util/ec3po/.tests-passed ]]; then
+ echo 'Unit tests have not passed. Please run "util/ec3po/run_tests.sh".'
+ exit 1
+fi
+
+changed_ec3po_files=$(find ${ec3po_files} -newer util/ec3po/.tests-passed)
+if [[ -n ${changed_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