1#!/bin/bash 2# 3# Copyright (C) 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# Script to run all gtests located under $ART_TEST_CHROOT/data/nativetest{64} 18 19ADB="${ADB:-adb}" 20all_tests=() 21failing_tests=() 22 23function add_tests { 24 # Search for *_test and *_tests executables, but skip e.g. libfoo_test.so. 25 all_tests+=$(${ADB} shell "test -d $ART_TEST_CHROOT/$1 && chroot $ART_TEST_CHROOT find $1 -type f -perm /ugo+x -name \*_test\* \! -name \*.so") 26} 27 28function fail { 29 failing_tests+=($1) 30} 31 32add_tests "/data/nativetest" 33add_tests "/data/nativetest64" 34 35for i in $all_tests; do 36 echo $i 37 ${ADB} shell "chroot $ART_TEST_CHROOT env LD_LIBRARY_PATH= ANDROID_ROOT='/system' ANDROID_RUNTIME_ROOT=/system ANDROID_TZDATA_ROOT='/system' $i" || fail $i 38done 39 40if [ -n "$failing_tests" ]; then 41 for i in "${failing_tests[@]}"; do 42 echo "Failed test: $i" 43 done 44 exit 1 45fi 46