blob: 9b142ee6abbfc202d9bfee953649e5b746a5b24d [file] [log] [blame]
Sam Delmerico4f4d0692022-09-02 17:00:33 -04001#!/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
16source $(dirname $0)/../envsetup.sh
17
18unset TARGET_PRODUCT TARGET_BUILD_VARIANT TARGET_PLATFORM_VERSION
19
20function 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 Onorato22b1c022023-06-05 16:43:55 -070031default_version=$(get_build_var RELEASE_PLATFORM_VERSION)
Sam Delmerico4f4d0692022-09-02 17:00:33 -040032
33# lunch tests
34check_lunch "aosp_arm64" "aosp_arm64" "eng" ""
35check_lunch "aosp_arm64-userdebug" "aosp_arm64" "userdebug" ""
36check_lunch "aosp_arm64-userdebug-$default_version" "aosp_arm64" "userdebug" "$default_version"
37check_lunch "abc" "" "" ""
38check_lunch "aosp_arm64-abc" "" "" ""
39check_lunch "aosp_arm64-userdebug-abc" "" "" ""
40check_lunch "aosp_arm64-abc-$default_version" "" "" ""
41check_lunch "abc-userdebug-$default_version" "" "" ""
42check_lunch "-" "" "" ""
43check_lunch "--" "" "" ""
44check_lunch "-userdebug" "" "" ""
45check_lunch "-userdebug-" "" "" ""
46check_lunch "-userdebug-$default_version" "" "" ""
47check_lunch "aosp_arm64-userdebug-$default_version-" "" "" ""
48check_lunch "aosp_arm64-userdebug-$default_version-abc" "" "" ""