• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1#!/bin/bash -e
2
3source $(dirname $0)/../envsetup.sh
4
5unset TARGET_PRODUCT TARGET_BUILD_VARIANT TARGET_PLATFORM_VERSION
6
7function check_lunch
8(
9    echo lunch $1
10    set +e
11    lunch $1 > /dev/null 2> /dev/null
12    set -e
13    [ "$TARGET_PRODUCT" = "$2" ] || ( echo "lunch $1: expected TARGET_PRODUCT='$2', got '$TARGET_PRODUCT'" && exit 1 )
14    [ "$TARGET_BUILD_VARIANT" = "$3" ] || ( echo "lunch $1: expected TARGET_BUILD_VARIANT='$3', got '$TARGET_BUILD_VARIANT'" && exit 1 )
15    [ "$TARGET_PLATFORM_VERSION" = "$4" ] || ( echo "lunch $1: expected TARGET_PLATFORM_VERSION='$4', got '$TARGET_PLATFORM_VERSION'" && exit 1 )
16)
17
18default_version=$(get_build_var DEFAULT_PLATFORM_VERSION)
19valid_version=PPR1
20
21# lunch tests
22check_lunch "aosp_arm64"                                "aosp_arm64" "eng"       ""
23check_lunch "aosp_arm64-userdebug"                      "aosp_arm64" "userdebug" ""
24check_lunch "aosp_arm64-userdebug-$default_version"     "aosp_arm64" "userdebug" "$default_version"
25check_lunch "aosp_arm64-userdebug-$valid_version"       "aosp_arm64" "userdebug" "$valid_version"
26check_lunch "abc"                                       "" "" ""
27check_lunch "aosp_arm64-abc"                            "" "" ""
28check_lunch "aosp_arm64-userdebug-abc"                  "" "" ""
29check_lunch "aosp_arm64-abc-$valid_version"             "" "" ""
30check_lunch "abc-userdebug-$valid_version"              "" "" ""
31check_lunch "-"                                         "" "" ""
32check_lunch "--"                                        "" "" ""
33check_lunch "-userdebug"                                "" "" ""
34check_lunch "-userdebug-"                               "" "" ""
35check_lunch "-userdebug-$valid_version"                 "" "" ""
36check_lunch "aosp_arm64-userdebug-$valid_version-"      "" "" ""
37check_lunch "aosp_arm64-userdebug-$valid_version-abc"   "" "" ""
38