blob: 602eac342cefc656ee106021058e8d0b3c75ae61 [file] [log] [blame]
Nicolas Geoffray5b93aef2019-01-21 13:44:58 +00001#!/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 {
Martin Stjernholm70ae00d2019-02-15 22:41:14 +000024 # 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")
Nicolas Geoffray5b93aef2019-01-21 13:44:58 +000026}
27
28function fail {
29 failing_tests+=($1)
30}
31
32add_tests "/data/nativetest"
33add_tests "/data/nativetest64"
34
35for i in $all_tests; do
Martin Stjernholm70ae00d2019-02-15 22:41:14 +000036 echo $i
Nicolas Geoffray5b93aef2019-01-21 13:44:58 +000037 ${ADB} shell "chroot $ART_TEST_CHROOT env LD_LIBRARY_PATH= ANDROID_ROOT='/system' ANDROID_RUNTIME_ROOT=/system $i" || fail $i
38done
39
Nicolas Geoffray13031e52019-01-22 09:05:07 +000040if [ -n "$failing_tests" ]; then
Nicolas Geoffray5b93aef2019-01-21 13:44:58 +000041 for i in "${failing_tests[@]}"; do
42 echo "Failed test: $i"
43 done
44 exit 1
45fi