blob: e093e7aafa0a0e96acb753497abebdeaaa1022b1 [file] [log] [blame]
Tri Vo05f01892017-03-02 11:28:31 -08001#!/bin/bash
2
Sam Chiu9eb214e2018-05-09 14:29:35 +00003ACLOUD_DIR=`dirname $0`
Kevin Chengb5963882018-05-09 00:06:27 -07004RED='\033[0;31m'
5GREEN='\033[0;32m'
6NC='\033[0m' # No Color
Sam Chiu9eb214e2018-05-09 14:29:35 +00007
Tri Vo05f01892017-03-02 11:28:31 -08008if [ -z "$ANDROID_BUILD_TOP" ]; then
9 echo "Missing ANDROID_BUILD_TOP env variable. Run 'lunch' first."
10 exit 1
11fi
12
Kevin Chengb5963882018-05-09 00:06:27 -070013rc=0
Tri Vo05f01892017-03-02 11:28:31 -080014# Runs all unit tests under tools/acloud.
Sam Chiu9eb214e2018-05-09 14:29:35 +000015for t in $(find $ACLOUD_DIR -type f -name "*_test.py");
16do
Kevin Chengb5963882018-05-09 00:06:27 -070017 if ! PYTHONPATH=$ANDROID_BUILD_TOP/tools python $t; then
18 rc=1
19 echo -e "${RED}$t failed${NC}"
20 fi
Tri Vo05f01892017-03-02 11:28:31 -080021done
Kevin Chengb5963882018-05-09 00:06:27 -070022
23if [[ $rc -eq 0 ]]; then
24 echo -e "${GREEN}All unittests pass${NC}!"
25else
26 echo -e "${RED}There was a unittest failure${NC}"
27fi
28exit $rc