albaltai | 64f3d59 | 2019-09-12 11:49:05 +0800 | [diff] [blame^] | 1 | #!/usr/bin/env bash |
| 2 | # |
| 3 | # Copyright 2019, The Android Open Source Project |
| 4 | # |
| 5 | # Licensed under the Apache License, Version 2.0 (the "License"); |
| 6 | # you may not use this file except in compliance with the License. |
| 7 | # You may obtain a copy of the License at |
| 8 | # |
| 9 | # http://www.apache.org/licenses/LICENSE-2.0 |
| 10 | # |
| 11 | # Unless required by applicable law or agreed to in writing, software |
| 12 | # distributed under the License is distributed on an "AS IS" BASIS, |
| 13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 14 | # See the License for the specific language governing permissions and |
| 15 | # limitations under the License. |
| 16 | |
| 17 | function run_functiontests() { |
| 18 | if ! m aidegen_functional_test; then |
| 19 | printf "\nFail to build aidegen_functional_test.\n" |
| 20 | exit 1 |
| 21 | fi |
| 22 | if ! aidegen_functional_test-dev -b; then |
| 23 | printf "\nFail to run aidegen_functional_test.\n" |
| 24 | exit 1 |
| 25 | fi |
| 26 | } |
| 27 | |
| 28 | function check_env() { |
| 29 | if [ -z "$ANDROID_BUILD_TOP" ]; then |
| 30 | printf "\nMissing ANDROID_BUILD_TOP env variable. Please run 'lunch' first.\n" |
| 31 | exit 1 |
| 32 | fi |
| 33 | function m() { |
| 34 | pushd $ANDROID_BUILD_TOP |
| 35 | build/soong/soong_ui.bash --make-mode "$@" |
| 36 | popd |
| 37 | } |
| 38 | } |
| 39 | |
| 40 | check_env |
| 41 | m clean |
| 42 | run_functiontests |