Cody Northrop | 055a6ab | 2017-04-17 09:35:43 -0600 | [diff] [blame] | 1 | #!/bin/bash |
| 2 | |
| 3 | # Copyright 2017 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 | set -e |
| 18 | |
| 19 | # |
| 20 | # Parse parameters |
| 21 | # |
| 22 | |
| 23 | function printUsage { |
| 24 | echo "Supported parameters are:" |
| 25 | echo " -s|--serial <target device serial number> (optional)" |
| 26 | echo |
| 27 | echo "i.e. ${0##*/} -s <serial number>" |
| 28 | exit 1 |
| 29 | } |
| 30 | |
| 31 | if [[ $(($# % 2)) -ne 0 ]] |
| 32 | then |
| 33 | echo Parameters must be provided in pairs. |
| 34 | echo parameter count = $# |
| 35 | echo |
| 36 | printUsage |
| 37 | exit 1 |
| 38 | fi |
| 39 | |
| 40 | while [[ $# -gt 0 ]] |
| 41 | do |
| 42 | case $1 in |
| 43 | -s|--serial) |
| 44 | # include the flag, because we need to leave it off if not provided |
| 45 | serial="$2" |
| 46 | shift 2 |
| 47 | ;; |
| 48 | -*) |
| 49 | # unknown option |
| 50 | echo Unknown option: $1 |
| 51 | echo |
| 52 | printUsage |
| 53 | exit 1 |
| 54 | ;; |
| 55 | esac |
| 56 | done |
| 57 | |
| 58 | if [[ $serial ]]; then |
| 59 | echo serial = "${serial}" |
| 60 | serialFlag="-s $serial" |
| 61 | if [[ $(adb devices) != *"$serial"* ]] |
| 62 | then |
| 63 | echo Device not found: "${serial}" |
| 64 | echo |
| 65 | printUsage |
| 66 | exit 1 |
| 67 | fi |
| 68 | else |
| 69 | echo Using device $(adb get-serialno) |
| 70 | fi |
| 71 | |
| 72 | # Install everything built by build_all.sh |
| 73 | echo "adb $serialFlag install -r bin/VulkanLayerValidationTests.apk" |
| 74 | adb $serialFlag install -r bin/VulkanLayerValidationTests.apk |
Cody Northrop | 055a6ab | 2017-04-17 09:35:43 -0600 | [diff] [blame] | 75 | |
| 76 | exit $? |