• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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
17serial_no=$1
18if [ -z "$serial_no" ]
19then
20  echo "Must provide serial number of the testing device."
21  exit
22fi
23
24local_trace_dir=$2
25if [ -z "$local_trace_dir" ]
26then
27  local_trace_dir=/usr/local/backup/cts-traces
28fi
29
30test_list=$3
31if [ -z "$test_list" ]
32then
33  test_list=${ANDROID_BUILD_TOP}/test/vts/script/cts_test_list.txt
34fi
35
36# allow write to /vendor partition
37adb -s $serial_no root
38adb -s $serial_no disable-verity
39adb -s $serial_no reboot
40adb -s $serial_no wait-for-device
41adb -s $serial_no root
42adb -s $serial_no remount
43adb -s $serial_no shell setenforce 0
44adb -s $serial_no shell chmod 777 -R data/local/tmp
45
46# push profiler libs
47adb -s $serial_no push ${ANDROID_BUILD_TOP}/out/host/linux-x86/vts/android-vts/testcases/DATA/lib64/*-vts.profiler.so vendor/lib64/
48adb -s $serial_no push ${ANDROID_BUILD_TOP}/out/host/linux-x86/vts/android-vts/testcases/DATA/lib/*-vts.profiler.so vendor/lib/
49adb -s $serial_no push ${ANDROID_BUILD_TOP}/out/host/linux-x86/vts/android-vts/testcases/DATA/lib64/libvts_* vendor/lib64/
50adb -s $serial_no push ${ANDROID_BUILD_TOP}/out/host/linux-x86/vts/android-vts/testcases/DATA/lib/libvts_* vendor/lib/
51
52# push vts_profiling_configure
53adb -s $serial_no push ${ANDROID_BUILD_TOP}/out/host/linux-x86/vts/android-vts/testcases/DATA/bin/vts_profiling_configure /data/local/tmp/
54
55# get cts testcases
56tests=()
57while read -r test
58do
59  tests+=($test)
60done < "$test_list"
61
62# run cts testcases
63for i in ${tests[@]}
64do
65  echo Running $i
66  adb -s $serial_no shell rm /data/local/tmp/*.vts.trace
67  adb -s $serial_no shell ./data/local/tmp/vts_profiling_configure enable /vendor/lib/ /vendor/lib64/
68  cts-tradefed run commandAndExit cts -s $serial_no --primary-abi-only --skip-device-info \
69  --skip-system-status-check com.android.compatibility.common.tradefed.targetprep.NetworkConnectivityChecker \
70  --skip-system-status-check com.android.tradefed.suite.checker.KeyguardStatusChecker -m $i
71  # In case device restart during the test run.
72  adb -s $serial_no root
73  adb -s $serial_no shell setenforce 0
74  adb -s $serial_no shell ls /data/local/tmp/*.vts.trace > temp
75  trace_path=$local_trace_dir/$i
76  rm -rf $trace_path
77  mkdir -p $trace_path
78  while read -r trace
79  do
80    adb -s $serial_no pull $trace $trace_path
81  done < "temp"
82done
83
84echo "done"
85