• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1#!/bin/bash
2#
3# Copyright 2016 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
17if [ -z "$ANDROID_BUILD_TOP" ]; then
18  echo "Missing ANDROID_BUILD_TOP env variable. Run 'lunch' first."
19  exit 1
20fi
21
22avoid_list=(
23  "./testcases/template/host_binary_test/host_binary_test.py"
24  "./testcases/template/llvmfuzzer_test/llvmfuzzer_test.py"
25  "./testcases/template/hal_hidl_replay_test/hal_hidl_replay_test.py"
26  "./testcases/template/binary_test/binary_test.py"
27  "./testcases/template/gtest_binary_test/gtest_binary_test.py"
28  "./testcases/template/hal_hidl_host_test/hal_hidl_host_test.py"
29  "./testcases/template/mobly/mobly_test.py"
30  "./testcases/template/param_test/param_test.py"
31  "./testcases/template/cts_test/cts_test.py"
32  "./runners/host/base_test.py"
33  "./utils/python/controllers/android_device_test.py"
34  )
35
36#######################################
37# Checks if a given file is included in the list of files to avoid
38# Globals:
39# Arguments:
40#   $1: list of files to avoid
41#   $2: the given file
42# Returns:
43#   SUCCESS, if the given file exists in the list
44#   FAILURE, otherwise
45#######################################
46function contains_file() {
47  local -n arr=$1
48  for avoid in "${arr[@]}"; do
49    if [ "$2" = "$avoid" ]; then
50      return  # contains
51    fi
52  done
53  false  # not contains
54}
55
56# Runs all unit tests under test/vts.
57for t in $(find $VTS_FRAMEWORK_DIR -type f -name "*_test.py"); do
58  if contains_file avoid_list $t; then
59    continue
60  fi
61  echo "UNIT TEST", $t
62  PYTHONPATH=$ANDROID_BUILD_TOP/test:$ANDROID_BUILD_TOP/tools/test/connectivity/acts/framework python $t;
63done
64