blob: 0f98e3125a19771ceecfd9d286029fb113b814e4 [file] [log] [blame]
#! /bin/bash
#
# Copyright (C) 2019 The Android Open Source Project
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# Script to run all gtests located under $ART_TEST_CHROOT/data/nativetest{64}
if [[ -z "$ART_TEST_CHROOT" ]]; then
echo 'ART_TEST_CHROOT environment variable is empty; please set it before running this script.'
exit 1
fi
ADB="${ADB:-adb}"
all_tests=
failing_tests=()
function add_tests {
# Search for *_test and *_tests executables, but skip e.g. libfoo_test.so.
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")
all_tests+=" $found_tests"
}
function fail {
failing_tests+=($1)
}
add_tests "/data/nativetest"
add_tests "/data/nativetest64"
for i in $all_tests; do
echo "$i"
${ADB} shell "chroot $ART_TEST_CHROOT env ANDROID_RUNTIME_ROOT='/apex/com.android.runtime' ANDROID_TZDATA_ROOT='/apex/com.android.tzdata' $i" || fail $i
done
if [ -n "$failing_tests" ]; then
for i in "${failing_tests[@]}"; do
echo "Failed test: $i"
done
exit 1
fi