Test all crates and format on pre-commit

This commit is contained in:
Adam Wright
2016-02-15 13:44:28 -08:00
committed by Adam Wright
parent 8957d2dac3
commit e2756edd72
2 changed files with 24 additions and 11 deletions

View File

@@ -52,3 +52,11 @@ fi
# If there are whitespace errors, print the offending file names and fail.
exec git diff-index --check --cached $against --
YELLOW='\033[0;33m'
NC='\033[0m' # No Color
function cargo_format() {
echo ${YELLOW}[PRECOMMIT]${NC} Formatting $1 ...
cargo fmt --manifest-path $1/Cargo.toml &>/dev/null
}

View File

@@ -17,18 +17,23 @@ then
exit 1
fi
printf "${YELLOW}[PRESUBMIT]${NC} Running tests ... "
TEST_RESULT=0
cargo test --manifest-path tarpc/Cargo.toml &>/dev/null
if [ "$?" != "0" ];
then
printf "${RED}FAILED${NC}"
TEST_RESULT=1
else
printf "${GREEN}ok${NC}"
fi
printf "\n"
function cargo_test() {
printf "${YELLOW}[PREPUSH]${NC} Testing $1 ... "
cargo test --manifest-path $1/Cargo.toml &>/dev/null
if [ "$?" != "0" ];
then
printf "${RED}FAILED${NC}"
TEST_RESULT=1
else
printf "${GREEN}ok${NC}"
fi
printf "\n"
}
cargo_test tarpc
cargo_test tarpc_examples
RESULT=0
if [ "$TEST_RESULT" == "1" ];