diff options
Diffstat (limited to 'toolchain_utils_githooks/pre-push')
-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 |