Matthias Maennich | 6652d74 | 2019-02-01 22:20:44 +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 | # Usage: |
| 18 | # build/build_test.sh |
| 19 | |
| 20 | export MAKE_ARGS=$@ |
| 21 | export ROOT_DIR=$(dirname $(readlink -f $0)) |
| 22 | export 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.) |
| 29 | if [ -z "$BUILD_CONFIG" ]; then |
| 30 | BUILD_CONFIG=build.config.net_test |
| 31 | fi |
| 32 | if [ ! -e $BUILD_CONFIG ]; then |
| 33 | BUILD_CONFIG=build/${BUILD_CONFIG} |
| 34 | fi |
| 35 | export BUILD_CONFIG |
| 36 | |
| 37 | test=all_tests.sh |
| 38 | set -e |
Matthias Maennich | fbe5364 | 2019-08-16 10:55:49 +0100 | [diff] [blame] | 39 | source ${ROOT_DIR}/_setup_env.sh |
Matthias Maennich | 6652d74 | 2019-02-01 22:20:44 +0000 | [diff] [blame] | 40 | export OUT_DIR=$(readlink -m ${OUT_DIR:-${ROOT_DIR}/out/${BRANCH}}) |
| 41 | mkdir -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. |
| 47 | if ! [ -f $KERNEL_DIR/Makefile ] && [ -f common/Makefile ]; then |
| 48 | KERNEL_DIR=common |
| 49 | fi |
| 50 | export KERNEL_DIR=$(readlink -m ${KERNEL_DIR}) |
| 51 | |
| 52 | echo "========================================================" |
| 53 | echo " Building kernel and running tests " |
| 54 | echo " Using KERNEL_DIR: " ${KERNEL_DIR} |
| 55 | echo " Using OUT_DIR : " ${OUT_DIR} |
| 56 | |
| 57 | cd ${OUT_DIR} |
| 58 | $NET_TEST/run_net_test.sh --builder $test |
| 59 | echo $? |
| 60 | echo "======Finished running tests======" |