| Roland Levillain | 72f6774 | 2019-03-06 15:48:08 +0000 | [diff] [blame] | 1 | #! /bin/bash |
| 2 | # |
| 3 | # Copyright 2019 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 | usage() { |
| 18 | cat >&2 <<EOF |
| 19 | Determine the 32- or 64-bit architecture of a device and print the path to |
| 20 | native libraries installed on the device for testing purposes. |
| 21 | |
| 22 | Usage: |
| 23 | $0 --32 Select the 32-bit architecture |
| 24 | $0 --64 Select the 64-bit architecture |
| 25 | EOF |
| 26 | exit 1 |
| 27 | } |
| 28 | |
| 29 | if [[ $# -ne 1 ]]; then |
| 30 | usage |
| 31 | fi |
| 32 | |
| 33 | case "$1" in |
| 34 | (--32) TEST_DIRECTORY="nativetest";; |
| 35 | (--64) TEST_DIRECTORY="nativetest64";; |
| 36 | (*) usage;; |
| 37 | esac |
| 38 | |
| 39 | if [[ -z "$ANDROID_BUILD_TOP" ]]; then |
| 40 | echo 'ANDROID_BUILD_TOP environment variable is empty; did you forget to run `lunch`?' |
| 41 | exit 1 |
| 42 | fi |
| 43 | |
| 44 | bitness_flag=$1 |
| 45 | ISA=$("$ANDROID_BUILD_TOP/art/test/utils/get-device-isa" "$bitness_flag") |
| 46 | |
| 47 | echo "/data/${TEST_DIRECTORY}/art/${ISA}" |