Tri Vo | 05f0189 | 2017-03-02 11:28:31 -0800 | [diff] [blame] | 1 | #!/bin/bash |
| 2 | |
Sam Chiu | 9eb214e | 2018-05-09 14:29:35 +0000 | [diff] [blame] | 3 | ACLOUD_DIR=`dirname $0` |
Kevin Cheng | b596388 | 2018-05-09 00:06:27 -0700 | [diff] [blame] | 4 | RED='\033[0;31m' |
| 5 | GREEN='\033[0;32m' |
| 6 | NC='\033[0m' # No Color |
Sam Chiu | 9eb214e | 2018-05-09 14:29:35 +0000 | [diff] [blame] | 7 | |
Tri Vo | 05f0189 | 2017-03-02 11:28:31 -0800 | [diff] [blame] | 8 | if [ -z "$ANDROID_BUILD_TOP" ]; then |
| 9 | echo "Missing ANDROID_BUILD_TOP env variable. Run 'lunch' first." |
| 10 | exit 1 |
| 11 | fi |
| 12 | |
Kevin Cheng | b596388 | 2018-05-09 00:06:27 -0700 | [diff] [blame] | 13 | rc=0 |
Tri Vo | 05f0189 | 2017-03-02 11:28:31 -0800 | [diff] [blame] | 14 | # Runs all unit tests under tools/acloud. |
Sam Chiu | 9eb214e | 2018-05-09 14:29:35 +0000 | [diff] [blame] | 15 | for t in $(find $ACLOUD_DIR -type f -name "*_test.py"); |
| 16 | do |
Kevin Cheng | b596388 | 2018-05-09 00:06:27 -0700 | [diff] [blame] | 17 | if ! PYTHONPATH=$ANDROID_BUILD_TOP/tools python $t; then |
| 18 | rc=1 |
| 19 | echo -e "${RED}$t failed${NC}" |
| 20 | fi |
Tri Vo | 05f0189 | 2017-03-02 11:28:31 -0800 | [diff] [blame] | 21 | done |
Kevin Cheng | b596388 | 2018-05-09 00:06:27 -0700 | [diff] [blame] | 22 | |
| 23 | if [[ $rc -eq 0 ]]; then |
| 24 | echo -e "${GREEN}All unittests pass${NC}!" |
| 25 | else |
| 26 | echo -e "${RED}There was a unittest failure${NC}" |
| 27 | fi |
| 28 | exit $rc |