blob: 972e82766728cc606150f6c50cbea6a628afc83c [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
Nicolas Geoffray5e0199b2015-09-21 11:11:40 +010022common_targets="vogar vogar.jar core-tests apache-harmony-jdwp-tests-hostdex jsr166-tests"
Nicolas Geoffrayfbeca752015-05-29 10:54:12 +010023android_root="/data/local/tmp/system"
24linker="linker"
25mode="target"
26j_arg="-j$(nproc)"
Roland Levillainb8b93562015-08-20 17:49:56 +010027showcommands=
Nicolas Geoffrayfbeca752015-05-29 10:54:12 +010028make_command=
29
Roland Levillain1f039c42015-09-02 11:43:59 +010030case "$TARGET_PRODUCT" in
31 (armv8|mips64r6) linker="linker64";;
32esac
Nicolas Geoffrayfbeca752015-05-29 10:54:12 +010033
34if [[ "$ART_TEST_ANDROID_ROOT" != "" ]]; then
35 android_root="$ART_TEST_ANDROID_ROOT"
36fi
37
38while true; do
39 if [[ "$1" == "--host" ]]; then
40 mode="host"
41 shift
42 elif [[ "$1" == "--target" ]]; then
43 mode="target"
44 shift
45 elif [[ "$1" == "--32" ]]; then
46 linker="linker"
47 shift
48 elif [[ "$1" == "--64" ]]; then
49 linker="linker64"
50 shift
51 elif [[ "$1" == "--android-root" ]]; then
52 shift
53 android_root=$1
54 shift
55 elif [[ "$1" == -j* ]]; then
Nicolas Geoffray667b99e2015-05-29 12:17:06 +010056 j_arg=$1
Nicolas Geoffrayfbeca752015-05-29 10:54:12 +010057 shift
Roland Levillainb8b93562015-08-20 17:49:56 +010058 elif [[ "$1" == "--showcommands" ]]; then
59 showcommands="showcommands"
60 shift
Nicolas Geoffrayfbeca752015-05-29 10:54:12 +010061 elif [[ "$1" == "" ]]; then
62 break
63 fi
64done
65
66if [[ $mode == "host" ]]; then
Nicolas Geoffray666dd652015-09-21 11:20:20 +010067 make_command="make $j_arg build-art-host-tests $common_targets out/host/linux-x86/lib/libjavacoretests.so out/host/linux-x86/lib64/libjavacoretests.so"
Nicolas Geoffrayfbeca752015-05-29 10:54:12 +010068 echo "Executing $make_command"
69 $make_command
70elif [[ $mode == "target" ]]; then
Nicolas Geoffraycdaf4772015-09-28 16:08:42 +010071 # Disable NINJA for building on target, it does not support setting environment variables
72 # within the make command.
73 env="$env USE_NINJA=false"
74 # Build extra tools that will be used by tests, so that
75 # they are compiled with our own linker.
Nicolas Geoffrayfbeca752015-05-29 10:54:12 +010076 # We need to provide our own linker in case the linker on the device
77 # is out of date.
Nicolas Geoffraycdaf4772015-09-28 16:08:42 +010078 make_command="make TARGET_LINKER=$android_root/bin/$linker $j_arg $showcommands build-art-target-tests $common_targets libjavacrypto libjavacoretests linker toybox toolbox sh out/host/linux-x86/bin/adb"
Nicolas Geoffrayfbeca752015-05-29 10:54:12 +010079 echo "Executing env $env $make_command"
80 env $env $make_command
81fi
82