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# Usage: 18# build/build_test.sh 19 20export MAKE_ARGS=$@ 21export ROOT_DIR=$(dirname $(readlink -f $0)) 22export NET_TEST=${ROOT_DIR}/../kernel/tests/net/test 23 24# if device has its own build.config.net_test in the 25# root (via manifest copy rule) then use it, otherwise 26# use the default one in the build/ directory. if the 27# BUILD_CONFIG is already specified in the environment, 28# it overrides everything (unless it does not exist.) 29if [ -z "$BUILD_CONFIG" ]; then 30 BUILD_CONFIG=build.config.net_test 31fi 32if [ ! -e $BUILD_CONFIG ]; then 33 BUILD_CONFIG=build/${BUILD_CONFIG} 34fi 35export BUILD_CONFIG 36 37test=all_tests.sh 38set -e 39source ${ROOT_DIR}/envsetup.sh 40export OUT_DIR=$(readlink -m ${OUT_DIR:-${ROOT_DIR}/out/${BRANCH}}) 41mkdir -p ${OUT_DIR} 42 43# build.config.net_test sets KERNEL_DIR to "private/*", which doesn't work for 44# common kernels, where the code is in "common/". Check for that here. We could 45# also require that each of these kernels have their own build.config.net_test, 46# but that complicates the manifests. 47if ! [ -f $KERNEL_DIR/Makefile ] && [ -f common/Makefile ]; then 48 KERNEL_DIR=common 49fi 50export KERNEL_DIR=$(readlink -m ${KERNEL_DIR}) 51 52echo "========================================================" 53echo " Building kernel and running tests " 54echo " Using KERNEL_DIR: " ${KERNEL_DIR} 55echo " Using OUT_DIR : " ${OUT_DIR} 56 57cd ${OUT_DIR} 58$NET_TEST/run_net_test.sh --builder $test 59echo $? 60echo "======Finished running tests======" 61