1#!/bin/bash
2#
3# Copyright 2016 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
17function vts_multidevice_target_setup {
18  DEVICE=$1
19
20  pushd ${ANDROID_BUILD_TOP}
21  adb root
22  adb shell mkdir -p /data/local/tmp/32
23  adb shell mkdir -p /data/local/tmp/64
24  adb push ${ANDROID_BUILD_TOP}/out/target/product/${DEVICE}/system/bin/vts_hal_driver32 /data/local/tmp/32/
25  adb push ${ANDROID_BUILD_TOP}/out/target/product/${DEVICE}/system/bin/vts_hal_driver64 /data/local/tmp/64/
26  adb push ${ANDROID_BUILD_TOP}/out/target/product/${DEVICE}/system/bin/vts_shell_driver32 /data/local/tmp/32/
27  adb push ${ANDROID_BUILD_TOP}/out/target/product/${DEVICE}/system/bin/vts_shell_driver64 /data/local/tmp/64/
28  adb push ${ANDROID_BUILD_TOP}/out/target/product/${DEVICE}/system/bin/vts_hal_agent32 /data/local/tmp/32/
29  adb push ${ANDROID_BUILD_TOP}/out/target/product/${DEVICE}/system/bin/vts_hal_agent64 /data/local/tmp/64/
30
31  echo "install vts framework packages"
32  adb push ${ANDROID_BUILD_TOP}/out/target/product/${DEVICE}/system/lib/libvts_common.so /data/local/tmp/32/
33  adb push ${ANDROID_BUILD_TOP}/out/target/product/${DEVICE}/system/lib64/libvts_common.so /data/local/tmp/64/
34  adb push ${ANDROID_BUILD_TOP}/out/target/product/${DEVICE}/system/lib/libvts_interfacespecification.so /data/local/tmp/32/
35  adb push ${ANDROID_BUILD_TOP}/out/target/product/${DEVICE}/system/lib64/libvts_interfacespecification.so /data/local/tmp/64/
36  adb push ${ANDROID_BUILD_TOP}/out/target/product/${DEVICE}/system/lib/libvts_drivercomm.so /data/local/tmp/32/
37  adb push ${ANDROID_BUILD_TOP}/out/target/product/${DEVICE}/system/lib64/libvts_drivercomm.so /data/local/tmp/64/
38  adb push ${ANDROID_BUILD_TOP}/out/target/product/${DEVICE}/system/lib/libvts_datatype.so /data/local/tmp/32/
39  adb push ${ANDROID_BUILD_TOP}/out/target/product/${DEVICE}/system/lib64/libvts_datatype.so /data/local/tmp/64/
40  adb push ${ANDROID_BUILD_TOP}/out/target/product/${DEVICE}/system/lib/libvts_measurement.so /data/local/tmp/32/
41  adb push ${ANDROID_BUILD_TOP}/out/target/product/${DEVICE}/system/lib64/libvts_measurement.so /data/local/tmp/64/
42  adb push ${ANDROID_BUILD_TOP}/out/target/product/${DEVICE}/system/lib/libvts_codecoverage.so /data/local/tmp/32/
43  adb push ${ANDROID_BUILD_TOP}/out/target/product/${DEVICE}/system/lib64/libvts_codecoverage.so /data/local/tmp/64/
44  adb push ${ANDROID_BUILD_TOP}/out/target/product/${DEVICE}/system/lib/libvts_multidevice_proto.so /data/local/tmp/32/
45  adb push ${ANDROID_BUILD_TOP}/out/target/product/${DEVICE}/system/lib64/libvts_multidevice_proto.so /data/local/tmp/64/
46
47  echo "install system packages that are not always installed by default"
48  adb push ${ANDROID_BUILD_TOP}/out/host/linux-x86/vts/android-vts/testcases/DATA/lib/libprotobuf-cpp-full.so /data/local/tmp/32/
49  adb push ${ANDROID_BUILD_TOP}/out/host/linux-x86/vts/android-vts/testcases/DATA/lib64/libprotobuf-cpp-full.so /data/local/tmp/64/
50
51  echo "install vts drivers for hidl"
52  adb push ${ANDROID_BUILD_TOP}/out/host/linux-x86/vts/android-vts/testcases/DATA/lib/android.hardware.*@*-vts.driver.so /data/local/tmp/32/
53  adb push ${ANDROID_BUILD_TOP}/out/host/linux-x86/vts/android-vts/testcases/DATA/lib64/android.hardware.*@*-vts.driver.so /data/local/tmp/64/
54
55  echo "install hal packages"
56  adb shell mkdir -p /data/local/tmp/32/hw
57  adb shell mkdir -p /data/local/tmp/64/hw
58  adb push ${ANDROID_BUILD_TOP}/out/target/product/${DEVICE}/system/lib/hw/lights.vts.so /data/local/tmp/32/hw/
59  adb push ${ANDROID_BUILD_TOP}/out/target/product/${DEVICE}/system/lib64/hw/lights.vts.so /data/local/tmp/64/hw/
60
61  adb push ${ANDROID_BUILD_TOP}/out/target/product/${DEVICE}/obj_arm/SHARED_LIBRARIES/android.hardware.tests.libhwbinder@1.0_intermediates/LINKED/android.hardware.tests.libhwbinder@1.0.so /data/local/tmp/32/
62  adb push ${ANDROID_BUILD_TOP}/out/target/product/${DEVICE}/obj/SHARED_LIBRARIES/android.hardware.tests.libhwbinder@1.0_intermediates/LINKED/android.hardware.tests.libhwbinder@1.0.so /data/local/tmp/64/
63
64  adb push ${ANDROID_BUILD_TOP}/out/target/product/${DEVICE}/obj_arm/NATIVE_TESTS/libhwbinder_benchmark_intermediates/LINKED/libhwbinder_benchmark /data/local/tmp/32/
65  adb push ${ANDROID_BUILD_TOP}/out/target/product/${DEVICE}/obj/NATIVE_TESTS/libhwbinder_benchmark_intermediates/LINKED/libhwbinder_benchmark /data/local/tmp/64/libhwbinder_benchmark64
66
67  # uncomment for hidl in non-treble devices
68  # adb push ${ANDROID_BUILD_TOP}/out/target/product/${DEVICE}/system/lib/android.hardware.nfc@1.0-vts.driver.so /data/local/tmp/32/hw/
69  # adb push ${ANDROID_BUILD_TOP}/out/target/product/${DEVICE}/system/lib64/android.hardware.nfc@1.0-vts.driver.so /data/local/tmp/64/hw/
70  # adb push images/${DEVICE}/32/libhwbinder.so /data/local/tmp/32/libhwbinder.so
71  # adb push images/${DEVICE}/64/libhwbinder.so /data/local/tmp/64/libhwbinder.so
72
73  adb shell mkdir -p /data/local/tmp/spec
74  adb push ${ANDROID_BUILD_TOP}/test/vts/specification/hal/conventional /data/local/tmp/spec/hal/conventional
75  adb push ${ANDROID_BUILD_TOP}/test/vts/specification/lib /data/local/tmp/spec/lib
76  hidl-gen -o ${ANDROID_BUILD_TOP}/output -L vts -r android.hardware:hardware/interfaces -r android.hidl:system/libhidl/transport android.hardware.camera.provider@2.4
77  hidl-gen -o ${ANDROID_BUILD_TOP}/output -L vts -r android.hardware:hardware/interfaces -r android.hidl:system/libhidl/transport android.hardware.camera.common@1.0
78  hidl-gen -o ${ANDROID_BUILD_TOP}/output -L vts -r android.hardware:hardware/interfaces -r android.hidl:system/libhidl/transport android.hardware.camera.device@1.0
79  hidl-gen -o ${ANDROID_BUILD_TOP}/output -L vts -r android.hardware:hardware/interfaces -r android.hidl:system/libhidl/transport android.hardware.camera.device@3.2
80  hidl-gen -o ${ANDROID_BUILD_TOP}/output -L vts -r android.hardware:hardware/interfaces -r android.hidl:system/libhidl/transport android.hardware.camera.metadata@3.2
81  hidl-gen -o ${ANDROID_BUILD_TOP}/output -L vts -r android.hardware:hardware/interfaces -r android.hidl:system/libhidl/transport android.hardware.gnss@1.0
82  hidl-gen -o ${ANDROID_BUILD_TOP}/output -L vts -r android.hardware:hardware/interfaces -r android.hidl:system/libhidl/transport android.hardware.nfc@1.0
83  hidl-gen -o ${ANDROID_BUILD_TOP}/output -L vts -r android.hardware:hardware/interfaces -r android.hidl:system/libhidl/transport android.hardware.vr@1.0
84  hidl-gen -o ${ANDROID_BUILD_TOP}/output -L vts -r android.hardware:hardware/interfaces -r android.hidl:system/libhidl/transport android.hardware.automotive.vehicle@2.0
85  hidl-gen -o ${ANDROID_BUILD_TOP}/output -L vts -r android.hardware:hardware/interfaces -r android.hidl:system/libhidl/transport android.hardware.automotive.vehicle@2.1
86  hidl-gen -o ${ANDROID_BUILD_TOP}/output -L vts -r android.hardware:hardware/interfaces -r android.hidl:system/libhidl/transport android.hardware.sensors@1.0
87  hidl-gen -o ${ANDROID_BUILD_TOP}/output -L vts -r android.hardware:hardware/interfaces -r android.hidl:system/libhidl/transport android.hardware.tv.cec@1.0
88  hidl-gen -o ${ANDROID_BUILD_TOP}/output -L vts -r android.hardware:hardware/interfaces -r android.hidl:system/libhidl/transport android.hardware.vibrator@1.0
89  hidl-gen -o ${ANDROID_BUILD_TOP}/output -L vts -r android.hardware:hardware/interfaces -r android.hidl:system/libhidl/transport android.hardware.contexthub@1.0
90  adb push ${ANDROID_BUILD_TOP}/output/android/hardware /data/local/tmp/spec/android/
91  adb push ${ANDROID_BUILD_TOP}/test/vts/specification/lib/ndk/bionic/1.0/libcV1.vts /data/local/tmp/spec/lib/ndk/bionic/1.0/libcV1.vts
92
93  echo "install asan packages"
94  # asan
95  adb push ${ANDROID_BUILD_TOP}/prebuilts/clang/host/linux-x86/clang-2812033/lib64/clang/3.8/lib/linux/libclang_rt.asan-aarch64-android.so /data/local/tmp/libclang_rt.asan-aarch64-android.so
96
97  adb shell chmod 755 /data/local/tmp/32/vts_hal_driver32
98  adb shell chmod 755 /data/local/tmp/64/vts_hal_driver64
99  adb shell chmod 755 /data/local/tmp/32/vts_shell_driver32
100  adb shell chmod 755 /data/local/tmp/64/vts_shell_driver64
101  adb shell chmod 755 /data/local/tmp/32/vts_hal_agent32
102  adb shell chmod 755 /data/local/tmp/64/vts_hal_agent64
103  popd
104}
105
106vts_multidevice_target_setup $1
107