github.com/westcoastroms/westcoastroms-build@v0.0.0-20190928114312-2350e5a73030/build/make/tests/envsetup_tests.sh (about)

     1  #!/bin/bash -e
     2  
     3  source $(dirname $0)/../envsetup.sh
     4  
     5  unset TARGET_PRODUCT TARGET_BUILD_VARIANT TARGET_PLATFORM_VERSION
     6  
     7  function 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  
    18  default_version=$(get_build_var DEFAULT_PLATFORM_VERSION)
    19  valid_version=PPR1
    20  
    21  # lunch tests
    22  check_lunch "aosp_arm64"                                "aosp_arm64" "eng"       ""
    23  check_lunch "aosp_arm64-userdebug"                      "aosp_arm64" "userdebug" ""
    24  check_lunch "aosp_arm64-userdebug-$default_version"     "aosp_arm64" "userdebug" "$default_version"
    25  check_lunch "aosp_arm64-userdebug-$valid_version"       "aosp_arm64" "userdebug" "$valid_version"
    26  check_lunch "abc"                                       "" "" ""
    27  check_lunch "aosp_arm64-abc"                            "" "" ""
    28  check_lunch "aosp_arm64-userdebug-abc"                  "" "" ""
    29  check_lunch "aosp_arm64-abc-$valid_version"             "" "" ""
    30  check_lunch "abc-userdebug-$valid_version"              "" "" ""
    31  check_lunch "-"                                         "" "" ""
    32  check_lunch "--"                                        "" "" ""
    33  check_lunch "-userdebug"                                "" "" ""
    34  check_lunch "-userdebug-"                               "" "" ""
    35  check_lunch "-userdebug-$valid_version"                 "" "" ""
    36  check_lunch "aosp_arm64-userdebug-$valid_version-"      "" "" ""
    37  check_lunch "aosp_arm64-userdebug-$valid_version-abc"   "" "" ""