diff options
author | Caroline Tice <cmtice@google.com> | 2015-12-17 11:35:20 -0800 |
---|---|---|
committer | chrome-bot <chrome-bot@chromium.org> | 2015-12-18 01:51:31 +0000 |
commit | 76cdacea0fef665b8540e78b79fc5dca83d43882 (patch) | |
tree | 740a955e15ea0ea1fe603225b2c3cff1d64f6cd4 /toolchain_utils_githooks | |
parent | c3fdcc2da9c4c56f007199affb5cfa2ae6860ee8 (diff) | |
download | toolchain-utils-76cdacea0fef665b8540e78b79fc5dca83d43882.tar.gz |
Create pre-push file, to run unittests before uploading CL.
This CL creates a pre-push file, to optionally run unittests
when people do 'git push'. The file will need to be copied
into .git/hooks when people set up their toolchain-utils (similar
to the way they need to get the commit-msg file).
BUG=chromium:567918
TEST=Tested in .git/hooks in my toolchain-utils tree.
Change-Id: I706e399554c89fca645b995332d17cb081021088
Reviewed-on: https://chrome-internal-review.googlesource.com/242523
Commit-Ready: Caroline Tice <cmtice@google.com>
Tested-by: Caroline Tice <cmtice@google.com>
Reviewed-by: Yunlian Jiang <yunlian@google.com>
Diffstat (limited to 'toolchain_utils_githooks')
-rwxr-xr-x | toolchain_utils_githooks/pre-push | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/toolchain_utils_githooks/pre-push b/toolchain_utils_githooks/pre-push new file mode 100755 index 00000000..2eff76ef --- /dev/null +++ b/toolchain_utils_githooks/pre-push @@ -0,0 +1,30 @@ +#!/bin/sh +# +# Copyright (c) 2015 Google Inc. +# +# This is a pre-push hook that allows the user to run the unit tests +# before uploading a CL for review. + +run_UnitTests() { + save_dir=`pwd` + status=0 + valid=0 + exec < /dev/tty + while [ $valid -eq 0 ] ; do + read -p "Run unit tests? [y/n] " choice + case "$choice" in + n|N ) valid=1 ;; + y|Y ) valid=1; cd crosperf; ./run_tests.sh; status=$? ; + cd $save_dir;; + * ) echo "Must choose y or n." + esac + done + if [ $status -ne 0 ] + then + exit $status + fi +} + +run_UnitTests + +exit 0 |