Nicolas Geoffray | 5b93aef | 2019-01-21 13:44:58 +0000 | [diff] [blame] | 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 | |
| 19 | ADB="${ADB:-adb}" |
| 20 | all_tests=() |
| 21 | failing_tests=() |
| 22 | |
| 23 | function add_tests { |
Martin Stjernholm | 70ae00d | 2019-02-15 22:41:14 +0000 | [diff] [blame] | 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") |
Nicolas Geoffray | 5b93aef | 2019-01-21 13:44:58 +0000 | [diff] [blame] | 26 | } |
| 27 | |
| 28 | function fail { |
| 29 | failing_tests+=($1) |
| 30 | } |
| 31 | |
| 32 | add_tests "/data/nativetest" |
| 33 | add_tests "/data/nativetest64" |
| 34 | |
| 35 | for i in $all_tests; do |
Martin Stjernholm | 70ae00d | 2019-02-15 22:41:14 +0000 | [diff] [blame] | 36 | echo $i |
Nicolas Geoffray | 5b93aef | 2019-01-21 13:44:58 +0000 | [diff] [blame] | 37 | ${ADB} shell "chroot $ART_TEST_CHROOT env LD_LIBRARY_PATH= ANDROID_ROOT='/system' ANDROID_RUNTIME_ROOT=/system $i" || fail $i |
| 38 | done |
| 39 | |
Nicolas Geoffray | 13031e5 | 2019-01-22 09:05:07 +0000 | [diff] [blame] | 40 | if [ -n "$failing_tests" ]; then |
Nicolas Geoffray | 5b93aef | 2019-01-21 13:44:58 +0000 | [diff] [blame] | 41 | for i in "${failing_tests[@]}"; do |
| 42 | echo "Failed test: $i" |
| 43 | done |
| 44 | exit 1 |
| 45 | fi |