blob: 192ee6d9d6420f134cc22ee91eb27ef2f1432831 [file] [log] [blame]
Nicolas Geoffrayfbeca752015-05-29 10:54:12 +01001#!/bin/bash
2#
3# Copyright (C) 2015 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 [ ! -d art ]; then
18 echo "Script needs to be run at the root of the android tree"
19 exit 1
20fi
21
22common_targets="vogar vogar.jar core-tests apache-harmony-jdwp-tests-hostdex out/host/linux-x86/bin/adb jsr166-tests"
23android_root="/data/local/tmp/system"
24linker="linker"
25mode="target"
26j_arg="-j$(nproc)"
27make_command=
28
29if [[ "$TARGET_PRODUCT" == "armv8" ]]; then
30 linker="linker64"
31fi
32
33if [[ "$ART_TEST_ANDROID_ROOT" != "" ]]; then
34 android_root="$ART_TEST_ANDROID_ROOT"
35fi
36
37while true; do
38 if [[ "$1" == "--host" ]]; then
39 mode="host"
40 shift
41 elif [[ "$1" == "--target" ]]; then
42 mode="target"
43 shift
44 elif [[ "$1" == "--32" ]]; then
45 linker="linker"
46 shift
47 elif [[ "$1" == "--64" ]]; then
48 linker="linker64"
49 shift
50 elif [[ "$1" == "--android-root" ]]; then
51 shift
52 android_root=$1
53 shift
54 elif [[ "$1" == -j* ]]; then
55 j_arg = $1
56 shift
57 elif [[ "$1" == "" ]]; then
58 break
59 fi
60done
61
62if [[ $mode == "host" ]]; then
63 make_command="make $j_arg build-art-host-tests $common_targets"
64 echo "Executing $make_command"
65 $make_command
66elif [[ $mode == "target" ]]; then
67 # We need to provide our own linker in case the linker on the device
68 # is out of date.
69 env="TARGET_GLOBAL_LDFLAGS=-Wl,-dynamic-linker=$android_root/bin/$linker"
70 # Use '-e' to force the override of TARGET_GLOBAL_LDFLAGS.
71 # Also, we build extra tools that will be used by tests, so that
72 # they are compiled with our own linker.
73 make_command="make -e $j_arg build-art-target-tests $common_targets libjavacrypto linker toybox toolbox sh"
74 echo "Executing env $env $make_command"
75 env $env $make_command
76fi
77