blob: be6e207c8ccfbc9b0d77310c5d52073dc66fddaf [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}"
Vladimir Markoba253182019-05-09 11:53:18 +010020all_tests=
Nicolas Geoffray5b93aef2019-01-21 13:44:58 +000021failing_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.
Vladimir Markoba253182019-05-09 11:53:18 +010025 local found_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 all_tests+=" $found_tests"
Nicolas Geoffray5b93aef2019-01-21 13:44:58 +000027}
28
29function fail {
30 failing_tests+=($1)
31}
32
33add_tests "/data/nativetest"
34add_tests "/data/nativetest64"
35
36for i in $all_tests; do
Martin Stjernholm70ae00d2019-02-15 22:41:14 +000037 echo $i
Neil Fuller26a5dd62019-03-13 15:16:35 +000038 ${ADB} shell "chroot $ART_TEST_CHROOT env LD_LIBRARY_PATH= ANDROID_ROOT='/system' ANDROID_RUNTIME_ROOT=/system ANDROID_TZDATA_ROOT='/system' $i" || fail $i
Nicolas Geoffray5b93aef2019-01-21 13:44:58 +000039done
40
Nicolas Geoffray13031e52019-01-22 09:05:07 +000041if [ -n "$failing_tests" ]; then
Nicolas Geoffray5b93aef2019-01-21 13:44:58 +000042 for i in "${failing_tests[@]}"; do
43 echo "Failed test: $i"
44 done
45 exit 1
46fi