summaryrefslogtreecommitdiff
path: root/build_test.sh
blob: 17adaf5f5045ff20dd39c7002a5a56b0c8fe2986 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
#!/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.

# Usage:
#   build/build_test.sh

export MAKE_ARGS=$@
export ROOT_DIR=$(dirname $(readlink -f $0))
export NET_TEST=${ROOT_DIR}/../kernel/tests/net/test

# if device has its own build.config.net_test in the
# root (via manifest copy rule) then use it, otherwise
# use the default one in the build/ directory. if the
# BUILD_CONFIG is already specified in the environment,
# it overrides everything (unless it does not exist.)
if [ -z "$BUILD_CONFIG" ]; then
  BUILD_CONFIG=build.config.net_test
fi
if [ ! -e $BUILD_CONFIG ]; then
  BUILD_CONFIG=build/${BUILD_CONFIG}
fi
export BUILD_CONFIG

test=all_tests.sh
set -e
source ${ROOT_DIR}/_setup_env.sh
export OUT_DIR=$(readlink -m ${OUT_DIR:-${ROOT_DIR}/out/${BRANCH}})
mkdir -p ${OUT_DIR}

# build.config.net_test sets KERNEL_DIR to "private/*", which doesn't work for
# common kernels, where the code is in "common/". Check for that here. We could
# also require that each of these kernels have their own build.config.net_test,
# but that complicates the manifests.
if ! [ -f $KERNEL_DIR/Makefile ] && [ -f common/Makefile ]; then
  KERNEL_DIR=common
fi
export KERNEL_DIR=$(readlink -m ${KERNEL_DIR})

echo "========================================================"
echo " Building kernel and running tests "
echo "    Using KERNEL_DIR: " ${KERNEL_DIR}
echo "    Using OUT_DIR   : " ${OUT_DIR}

cd ${OUT_DIR}
$NET_TEST/run_net_test.sh --builder $test
echo $?
echo "======Finished running tests======"