Sam Delmerico | 4f4d069 | 2022-09-02 17:00:33 -0400 | [diff] [blame] | 1 | #!/usr/bin/env bash |
| 2 | # Copyright (C) 2022 The Android Open Source Project |
| 3 | # |
| 4 | # Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | # you may not use this file except in compliance with the License. |
| 6 | # You may obtain a copy of the License at |
| 7 | # |
| 8 | # http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | # |
| 10 | # Unless required by applicable law or agreed to in writing, software |
| 11 | # distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | # See the License for the specific language governing permissions and |
| 14 | # limitations under the License. |
| 15 | |
| 16 | source $(dirname $0)/../envsetup.sh |
| 17 | |
| 18 | unset TARGET_PRODUCT TARGET_BUILD_VARIANT TARGET_PLATFORM_VERSION |
| 19 | |
| 20 | function check_lunch |
| 21 | ( |
| 22 | echo lunch $1 |
| 23 | set +e |
| 24 | lunch $1 > /dev/null 2> /dev/null |
| 25 | set -e |
| 26 | [ "$TARGET_PRODUCT" = "$2" ] || ( echo "lunch $1: expected TARGET_PRODUCT='$2', got '$TARGET_PRODUCT'" && exit 1 ) |
| 27 | [ "$TARGET_BUILD_VARIANT" = "$3" ] || ( echo "lunch $1: expected TARGET_BUILD_VARIANT='$3', got '$TARGET_BUILD_VARIANT'" && exit 1 ) |
| 28 | [ "$TARGET_PLATFORM_VERSION" = "$4" ] || ( echo "lunch $1: expected TARGET_PLATFORM_VERSION='$4', got '$TARGET_PLATFORM_VERSION'" && exit 1 ) |
| 29 | ) |
| 30 | |
Joe Onorato | 22b1c02 | 2023-06-05 16:43:55 -0700 | [diff] [blame] | 31 | default_version=$(get_build_var RELEASE_PLATFORM_VERSION) |
Sam Delmerico | 4f4d069 | 2022-09-02 17:00:33 -0400 | [diff] [blame] | 32 | |
| 33 | # lunch tests |
| 34 | check_lunch "aosp_arm64" "aosp_arm64" "eng" "" |
| 35 | check_lunch "aosp_arm64-userdebug" "aosp_arm64" "userdebug" "" |
| 36 | check_lunch "aosp_arm64-userdebug-$default_version" "aosp_arm64" "userdebug" "$default_version" |
| 37 | check_lunch "abc" "" "" "" |
| 38 | check_lunch "aosp_arm64-abc" "" "" "" |
| 39 | check_lunch "aosp_arm64-userdebug-abc" "" "" "" |
| 40 | check_lunch "aosp_arm64-abc-$default_version" "" "" "" |
| 41 | check_lunch "abc-userdebug-$default_version" "" "" "" |
| 42 | check_lunch "-" "" "" "" |
| 43 | check_lunch "--" "" "" "" |
| 44 | check_lunch "-userdebug" "" "" "" |
| 45 | check_lunch "-userdebug-" "" "" "" |
| 46 | check_lunch "-userdebug-$default_version" "" "" "" |
| 47 | check_lunch "aosp_arm64-userdebug-$default_version-" "" "" "" |
| 48 | check_lunch "aosp_arm64-userdebug-$default_version-abc" "" "" "" |