15d1ac920fdaef5d4ec8f66bb734488cd9660b024jeffhao#!/bin/bash 25d1ac920fdaef5d4ec8f66bb734488cd9660b024jeffhao# 35d1ac920fdaef5d4ec8f66bb734488cd9660b024jeffhao# Copyright (C) 2007 The Android Open Source Project 45d1ac920fdaef5d4ec8f66bb734488cd9660b024jeffhao# 55d1ac920fdaef5d4ec8f66bb734488cd9660b024jeffhao# Licensed under the Apache License, Version 2.0 (the "License"); 65d1ac920fdaef5d4ec8f66bb734488cd9660b024jeffhao# you may not use this file except in compliance with the License. 75d1ac920fdaef5d4ec8f66bb734488cd9660b024jeffhao# You may obtain a copy of the License at 85d1ac920fdaef5d4ec8f66bb734488cd9660b024jeffhao# 95d1ac920fdaef5d4ec8f66bb734488cd9660b024jeffhao# http://www.apache.org/licenses/LICENSE-2.0 105d1ac920fdaef5d4ec8f66bb734488cd9660b024jeffhao# 115d1ac920fdaef5d4ec8f66bb734488cd9660b024jeffhao# Unless required by applicable law or agreed to in writing, software 125d1ac920fdaef5d4ec8f66bb734488cd9660b024jeffhao# distributed under the License is distributed on an "AS IS" BASIS, 135d1ac920fdaef5d4ec8f66bb734488cd9660b024jeffhao# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 145d1ac920fdaef5d4ec8f66bb734488cd9660b024jeffhao# See the License for the specific language governing permissions and 155d1ac920fdaef5d4ec8f66bb734488cd9660b024jeffhao# limitations under the License. 165d1ac920fdaef5d4ec8f66bb734488cd9660b024jeffhao 175d1ac920fdaef5d4ec8f66bb734488cd9660b024jeffhao# Set up prog to be the path of this script, including following symlinks, 185d1ac920fdaef5d4ec8f66bb734488cd9660b024jeffhao# and set up progdir to be the fully-qualified pathname of its directory. 195d1ac920fdaef5d4ec8f66bb734488cd9660b024jeffhaoprog="$0" 20deb48a0b5bd1da4d5dce64454d2ff44e3fca875aAndreas Gampeargs="$@" 215d1ac920fdaef5d4ec8f66bb734488cd9660b024jeffhaowhile [ -h "${prog}" ]; do 225d1ac920fdaef5d4ec8f66bb734488cd9660b024jeffhao newProg=`/bin/ls -ld "${prog}"` 235d1ac920fdaef5d4ec8f66bb734488cd9660b024jeffhao newProg=`expr "${newProg}" : ".* -> \(.*\)$"` 245d1ac920fdaef5d4ec8f66bb734488cd9660b024jeffhao if expr "x${newProg}" : 'x/' >/dev/null; then 255d1ac920fdaef5d4ec8f66bb734488cd9660b024jeffhao prog="${newProg}" 265d1ac920fdaef5d4ec8f66bb734488cd9660b024jeffhao else 275d1ac920fdaef5d4ec8f66bb734488cd9660b024jeffhao progdir=`dirname "${prog}"` 285d1ac920fdaef5d4ec8f66bb734488cd9660b024jeffhao prog="${progdir}/${newProg}" 295d1ac920fdaef5d4ec8f66bb734488cd9660b024jeffhao fi 305d1ac920fdaef5d4ec8f66bb734488cd9660b024jeffhaodone 315d1ac920fdaef5d4ec8f66bb734488cd9660b024jeffhaooldwd=`pwd` 325d1ac920fdaef5d4ec8f66bb734488cd9660b024jeffhaoprogdir=`dirname "${prog}"` 335d1ac920fdaef5d4ec8f66bb734488cd9660b024jeffhaocd "${progdir}" 345d1ac920fdaef5d4ec8f66bb734488cd9660b024jeffhaoprogdir=`pwd` 355d1ac920fdaef5d4ec8f66bb734488cd9660b024jeffhaoprog="${progdir}"/`basename "${prog}"` 36105215d007639a6fc35b1ef9705ac138f51f35b2Brian Carlstromtest_dir="test-$$" 375a79fdecffbea657ebecd4cf19078925239eb1c3Andreas Gampeif [ -z "$TMPDIR" ]; then 385a79fdecffbea657ebecd4cf19078925239eb1c3Andreas Gampe tmp_dir="/tmp/$USER/${test_dir}" 395a79fdecffbea657ebecd4cf19078925239eb1c3Andreas Gampeelse 405a79fdecffbea657ebecd4cf19078925239eb1c3Andreas Gampe tmp_dir="${TMPDIR}/$USER/${test_dir}" 415a79fdecffbea657ebecd4cf19078925239eb1c3Andreas Gampefi 422c27f2ccf316aebf96cf365d33d2834a8206444dDavid Brazdilchecker="${progdir}/../tools/checker/checker.py" 435d1ac920fdaef5d4ec8f66bb734488cd9660b024jeffhaoexport JAVA="java" 44f45c3f897286b464223477130a918092f4569b2eVladimir Markoexport JAVAC="javac -g -source 1.7 -target 1.7 -Xlint:-options" 451a58b7f6f14a5ed9355e8e447cae25fb41467f09Nicolas Geoffrayexport RUN="${progdir}/etc/run-test-jar" 46105215d007639a6fc35b1ef9705ac138f51f35b2Brian Carlstromexport DEX_LOCATION=/data/run-test/${test_dir} 47c717eef208ab07ebd4b0f818d55e7adcd420a5adElliott Hughesexport NEED_DEX="true" 481c5b6da7a2ffef1bb14f30f41a3bbd78d3db7b18Nicolas Geoffrayexport USE_JACK="true" 49f0fe04cbaf189702e9dad7252ed834cb4735c877Alex Lightexport SMALI_ARGS="--experimental" 505d1ac920fdaef5d4ec8f66bb734488cd9660b024jeffhao 514407e61aa4cd75e6f31919cfca6a544d18b88c53Tsu Chiang Chuang# If dx was not set by the environment variable, assume it is in the path. 524407e61aa4cd75e6f31919cfca6a544d18b88c53Tsu Chiang Chuangif [ -z "$DX" ]; then 534407e61aa4cd75e6f31919cfca6a544d18b88c53Tsu Chiang Chuang export DX="dx" 544407e61aa4cd75e6f31919cfca6a544d18b88c53Tsu Chiang Chuangfi 554407e61aa4cd75e6f31919cfca6a544d18b88c53Tsu Chiang Chuang 566674f8ae6bb390e61cfdccb6e5825ac952584f2dTsu Chiang Chuang# If jasmin was not set by the environment variable, assume it is in the path. 576674f8ae6bb390e61cfdccb6e5825ac952584f2dTsu Chiang Chuangif [ -z "$JASMIN" ]; then 586674f8ae6bb390e61cfdccb6e5825ac952584f2dTsu Chiang Chuang export JASMIN="jasmin" 596674f8ae6bb390e61cfdccb6e5825ac952584f2dTsu Chiang Chuangfi 606674f8ae6bb390e61cfdccb6e5825ac952584f2dTsu Chiang Chuang 618fda9f2aec6820ebf1bd550412ec99d9eb3ffa9eAndreas Gampe# If smali was not set by the environment variable, assume it is in the path. 628fda9f2aec6820ebf1bd550412ec99d9eb3ffa9eAndreas Gampeif [ -z "$SMALI" ]; then 638fda9f2aec6820ebf1bd550412ec99d9eb3ffa9eAndreas Gampe export SMALI="smali" 648fda9f2aec6820ebf1bd550412ec99d9eb3ffa9eAndreas Gampefi 658fda9f2aec6820ebf1bd550412ec99d9eb3ffa9eAndreas Gampe 668fda9f2aec6820ebf1bd550412ec99d9eb3ffa9eAndreas Gampe# If dexmerger was not set by the environment variable, assume it is in the path. 678fda9f2aec6820ebf1bd550412ec99d9eb3ffa9eAndreas Gampeif [ -z "$DXMERGER" ]; then 688fda9f2aec6820ebf1bd550412ec99d9eb3ffa9eAndreas Gampe export DXMERGER="dexmerger" 698fda9f2aec6820ebf1bd550412ec99d9eb3ffa9eAndreas Gampefi 708fda9f2aec6820ebf1bd550412ec99d9eb3ffa9eAndreas Gampe 7119ac0276208f0afef6ba8a4ab34b74a59b8d11d7Sebastien Hertz# If jack was not set by the environment variable, assume it is in the path. 7219ac0276208f0afef6ba8a4ab34b74a59b8d11d7Sebastien Hertzif [ -z "$JACK" ]; then 7319ac0276208f0afef6ba8a4ab34b74a59b8d11d7Sebastien Hertz export JACK="jack" 7419ac0276208f0afef6ba8a4ab34b74a59b8d11d7Sebastien Hertzfi 7519ac0276208f0afef6ba8a4ab34b74a59b8d11d7Sebastien Hertz 7619ac0276208f0afef6ba8a4ab34b74a59b8d11d7Sebastien Hertz# ANDROID_BUILD_TOP is not set in a build environment. 7719ac0276208f0afef6ba8a4ab34b74a59b8d11d7Sebastien Hertzif [ -z "$ANDROID_BUILD_TOP" ]; then 7819ac0276208f0afef6ba8a4ab34b74a59b8d11d7Sebastien Hertz export ANDROID_BUILD_TOP=$oldwd 7919ac0276208f0afef6ba8a4ab34b74a59b8d11d7Sebastien Hertzfi 8019ac0276208f0afef6ba8a4ab34b74a59b8d11d7Sebastien Hertz 8119ac0276208f0afef6ba8a4ab34b74a59b8d11d7Sebastien Hertz# If JACK_CLASSPATH is not set, assume it only contains core-libart. 8219ac0276208f0afef6ba8a4ab34b74a59b8d11d7Sebastien Hertzif [ -z "$JACK_CLASSPATH" ]; then 83121b25e246b7012cfd895f205855c6102da48305Przemyslaw Szczepaniak export JACK_CLASSPATH="${OUT_DIR:-$ANDROID_BUILD_TOP/out}/host/common/obj/JAVA_LIBRARIES/core-libart-hostdex_intermediates/classes.jack:${OUT_DIR:-$ANDROID_BUILD_TOP/out}/host/common/obj/JAVA_LIBRARIES/core-oj-hostdex_intermediates/classes.jack" 8419ac0276208f0afef6ba8a4ab34b74a59b8d11d7Sebastien Hertzfi 8519ac0276208f0afef6ba8a4ab34b74a59b8d11d7Sebastien Hertz 8619ac0276208f0afef6ba8a4ab34b74a59b8d11d7Sebastien Hertzexport JACK="$JACK -g -cp $JACK_CLASSPATH" 876674f8ae6bb390e61cfdccb6e5825ac952584f2dTsu Chiang Chuang 885d1ac920fdaef5d4ec8f66bb734488cd9660b024jeffhaoinfo="info.txt" 895d1ac920fdaef5d4ec8f66bb734488cd9660b024jeffhaobuild="build" 905d1ac920fdaef5d4ec8f66bb734488cd9660b024jeffhaorun="run" 915d1ac920fdaef5d4ec8f66bb734488cd9660b024jeffhaoexpected="expected.txt" 921c83cbc4a817acbd7f9abb5b29a2d418a958e6a1Andreas Gampecheck_cmd="check" 935d1ac920fdaef5d4ec8f66bb734488cd9660b024jeffhaooutput="output.txt" 945d1ac920fdaef5d4ec8f66bb734488cd9660b024jeffhaobuild_output="build-output.txt" 9524128c663fb4d34c36cc3134e2c7e53cd99ab9e5David Brazdilcfg_output="graph.cfg" 961d4184d65dc199a5ba720245632493b7520d9edfHiroshi Yamauchistrace_output="strace-output.txt" 97dc959ea822b100740424fc2eee4037512bde82c2Brian Carlstromlib="libartd.so" 98031768a340634e2dbdec1aebb2bb3fe509b2f1f6Mathieu Chartiertestlib="arttestd" 995d1ac920fdaef5d4ec8f66bb734488cd9660b024jeffhaorun_args="--quiet" 1004846d13744f07e82571d2882acc823d811ec942dDavid Brazdilbuild_args="" 1015d1ac920fdaef5d4ec8f66bb734488cd9660b024jeffhao 10291de25fd88ed755be5d72db80c93da364d97e16fAlex Lightquiet="no" 103a3d90fb449e2fba87211a7de323faff63cba41fcNicolas Geoffraydebuggable="no" 1049d722533b0ef6547ee0ab5286f65af98451c36e4Alex Lightprebuild_mode="yes" 1052613de48e04b582f1af90fd567a34253ebe757c4Brian Carlstromtarget_mode="yes" 1065d1ac920fdaef5d4ec8f66bb734488cd9660b024jeffhaodev_mode="no" 1075d1ac920fdaef5d4ec8f66bb734488cd9660b024jeffhaoupdate_mode="no" 108a59dd80f9f48cb750d329d4d4af2d99d72b484d1Alex Lightdebug_mode="no" 109a59dd80f9f48cb750d329d4d4af2d99d72b484d1Alex Lightrelocate="yes" 110201803fb1acd15b9daae51d816e1b08aededdc41Jeff Haoruntime="art" 1115d1ac920fdaef5d4ec8f66bb734488cd9660b024jeffhaousage="no" 112011fade82899fe3607789ca061e3a6c7fa4c71f4Tsu Chiang Chuangbuild_only="no" 1132fe07927610177e9b83809e5bdb6d2b3d835a076Andreas Gampesuffix64="" 11485139a3b78d942c810a157687dee0fb6a67207aeJeff Haotrace="false" 1157526d783ab68ed1dd53c763c75895cb432532b0fAndreas Gampetrace_stream="false" 116e7873ecb240aef520f7a7933028fa58708baf761Alex Lightbasic_verify="false" 117e7873ecb240aef520f7a7933028fa58708baf761Alex Lightgc_verify="false" 118e7873ecb240aef520f7a7933028fa58708baf761Alex Lightgc_stress="false" 1191d4184d65dc199a5ba720245632493b7520d9edfHiroshi Yamauchistrace="false" 120bfac14acef0c2327ef8c28f146dd17d009aa8669Alex Lightalways_clean="no" 12105f30e1e4b62bec72d3d3f90f5e87210cc5067c8Igor Murashkinnever_clean="no" 12203a112d23694afffe9808082e7144b7e8744a4bdAlex Lighthave_dex2oat="yes" 12303a112d23694afffe9808082e7144b7e8744a4bdAlex Lighthave_patchoat="yes" 12403a112d23694afffe9808082e7144b7e8744a4bdAlex Lighthave_image="yes" 12563fc30e201a74dbad9422a6dbd4c39e4b60ac4c5Andreas Gampeimage_suffix="" 126c23c9c93aade8dd99d23ad796888cbf2f7f96a47Andreas Gampepic_image_suffix="" 127dcdc85bbd569f0ee66c331b4219c19304a616214Jeff Haomulti_image_suffix="" 128c8f23fc19726245da6a11fa2d92e319b9d26c019Nicolas Geoffrayandroid_root="/system" 1295d1ac920fdaef5d4ec8f66bb734488cd9660b024jeffhao 1305d1ac920fdaef5d4ec8f66bb734488cd9660b024jeffhaowhile true; do 1315d1ac920fdaef5d4ec8f66bb734488cd9660b024jeffhao if [ "x$1" = "x--host" ]; then 1322613de48e04b582f1af90fd567a34253ebe757c4Brian Carlstrom target_mode="no" 133b92bcabcbb28f69fe99e1c2f2e5559ab2c47aa60TDYa DEX_LOCATION=$tmp_dir 1341a58b7f6f14a5ed9355e8e447cae25fb41467f09Nicolas Geoffray run_args="${run_args} --host" 1355d1ac920fdaef5d4ec8f66bb734488cd9660b024jeffhao shift 13691de25fd88ed755be5d72db80c93da364d97e16fAlex Light elif [ "x$1" = "x--quiet" ]; then 13791de25fd88ed755be5d72db80c93da364d97e16fAlex Light quiet="yes" 13891de25fd88ed755be5d72db80c93da364d97e16fAlex Light shift 139eb7c144a6aff7da673ba53d501c46f00311d4d7fAlex Light elif [ "x$1" = "x--use-java-home" ]; then 140eb7c144a6aff7da673ba53d501c46f00311d4d7fAlex Light if [ -n "${JAVA_HOME}" ]; then 141eb7c144a6aff7da673ba53d501c46f00311d4d7fAlex Light export JAVA="${JAVA_HOME}/bin/java" 142eb7c144a6aff7da673ba53d501c46f00311d4d7fAlex Light export JAVAC="${JAVA_HOME}/bin/javac -g" 143eb7c144a6aff7da673ba53d501c46f00311d4d7fAlex Light else 144eb7c144a6aff7da673ba53d501c46f00311d4d7fAlex Light echo "Passed --use-java-home without JAVA_HOME variable set!" 145eb7c144a6aff7da673ba53d501c46f00311d4d7fAlex Light usage="yes" 146eb7c144a6aff7da673ba53d501c46f00311d4d7fAlex Light fi 147eb7c144a6aff7da673ba53d501c46f00311d4d7fAlex Light shift 14858bcc40e42d0438d3a71149ac53420d50a71fd8cElliott Hughes elif [ "x$1" = "x--jvm" ]; then 1492613de48e04b582f1af90fd567a34253ebe757c4Brian Carlstrom target_mode="no" 150201803fb1acd15b9daae51d816e1b08aededdc41Jeff Hao runtime="jvm" 15101afdbab72f5e8c230f3d73a3a61d630670db9abBrian Carlstrom prebuild_mode="no" 152c717eef208ab07ebd4b0f818d55e7adcd420a5adElliott Hughes NEED_DEX="false" 15319ac0276208f0afef6ba8a4ab34b74a59b8d11d7Sebastien Hertz USE_JACK="false" 154288a4a2bff0ba8840c6fa0dee3c7c9f1934fa530Nicolas Geoffray run_args="${run_args} --jvm" 155eb7c144a6aff7da673ba53d501c46f00311d4d7fAlex Light build_args="${build_args} --jvm" 1565d1ac920fdaef5d4ec8f66bb734488cd9660b024jeffhao shift 15758bcc40e42d0438d3a71149ac53420d50a71fd8cElliott Hughes elif [ "x$1" = "x-O" ]; then 158dc959ea822b100740424fc2eee4037512bde82c2Brian Carlstrom lib="libart.so" 159031768a340634e2dbdec1aebb2bb3fe509b2f1f6Mathieu Chartier testlib="arttest" 160dc959ea822b100740424fc2eee4037512bde82c2Brian Carlstrom shift 161dc959ea822b100740424fc2eee4037512bde82c2Brian Carlstrom elif [ "x$1" = "x--dalvik" ]; then 162dc959ea822b100740424fc2eee4037512bde82c2Brian Carlstrom lib="libdvm.so" 163201803fb1acd15b9daae51d816e1b08aededdc41Jeff Hao runtime="dalvik" 164dc959ea822b100740424fc2eee4037512bde82c2Brian Carlstrom shift 16503a112d23694afffe9808082e7144b7e8744a4bdAlex Light elif [ "x$1" = "x--no-dex2oat" ]; then 16603a112d23694afffe9808082e7144b7e8744a4bdAlex Light have_dex2oat="no" 16703a112d23694afffe9808082e7144b7e8744a4bdAlex Light shift 16803a112d23694afffe9808082e7144b7e8744a4bdAlex Light elif [ "x$1" = "x--no-patchoat" ]; then 16903a112d23694afffe9808082e7144b7e8744a4bdAlex Light have_patchoat="no" 17003a112d23694afffe9808082e7144b7e8744a4bdAlex Light shift 17103a112d23694afffe9808082e7144b7e8744a4bdAlex Light elif [ "x$1" = "x--no-image" ]; then 17203a112d23694afffe9808082e7144b7e8744a4bdAlex Light have_image="no" 17303a112d23694afffe9808082e7144b7e8744a4bdAlex Light shift 174c23c9c93aade8dd99d23ad796888cbf2f7f96a47Andreas Gampe elif [ "x$1" = "x--pic-image" ]; then 175c23c9c93aade8dd99d23ad796888cbf2f7f96a47Andreas Gampe pic_image_suffix="-pic" 176c23c9c93aade8dd99d23ad796888cbf2f7f96a47Andreas Gampe shift 177dcdc85bbd569f0ee66c331b4219c19304a616214Jeff Hao elif [ "x$1" = "x--multi-image" ]; then 178dcdc85bbd569f0ee66c331b4219c19304a616214Jeff Hao multi_image_suffix="-multi" 179dcdc85bbd569f0ee66c331b4219c19304a616214Jeff Hao shift 180c23c9c93aade8dd99d23ad796888cbf2f7f96a47Andreas Gampe elif [ "x$1" = "x--pic-test" ]; then 181c23c9c93aade8dd99d23ad796888cbf2f7f96a47Andreas Gampe run_args="${run_args} --pic-test" 182c23c9c93aade8dd99d23ad796888cbf2f7f96a47Andreas Gampe shift 183a59dd80f9f48cb750d329d4d4af2d99d72b484d1Alex Light elif [ "x$1" = "x--relocate" ]; then 184a59dd80f9f48cb750d329d4d4af2d99d72b484d1Alex Light relocate="yes" 185a59dd80f9f48cb750d329d4d4af2d99d72b484d1Alex Light shift 186a59dd80f9f48cb750d329d4d4af2d99d72b484d1Alex Light elif [ "x$1" = "x--no-relocate" ]; then 187a59dd80f9f48cb750d329d4d4af2d99d72b484d1Alex Light relocate="no" 188a59dd80f9f48cb750d329d4d4af2d99d72b484d1Alex Light shift 189a59dd80f9f48cb750d329d4d4af2d99d72b484d1Alex Light elif [ "x$1" = "x--prebuild" ]; then 1905fd18ba0902df62c4e1237712f03c44b8109ce8aNicolas Geoffray run_args="${run_args} --prebuild" 191a59dd80f9f48cb750d329d4d4af2d99d72b484d1Alex Light prebuild_mode="yes" 192a59dd80f9f48cb750d329d4d4af2d99d72b484d1Alex Light shift; 1931153ae16f243adb30fc8509c619025d30408c74aRichard Uhler elif [ "x$1" = "x--strip-dex" ]; then 1941153ae16f243adb30fc8509c619025d30408c74aRichard Uhler run_args="${run_args} --strip-dex" 1951153ae16f243adb30fc8509c619025d30408c74aRichard Uhler shift; 19643c162f059e6463119aa1efd0841374ca7b4f789Nicolas Geoffray elif [ "x$1" = "x--debuggable" ]; then 19743c162f059e6463119aa1efd0841374ca7b4f789Nicolas Geoffray run_args="${run_args} -Xcompiler-option --debuggable" 198a3d90fb449e2fba87211a7de323faff63cba41fcNicolas Geoffray debuggable="yes" 19943c162f059e6463119aa1efd0841374ca7b4f789Nicolas Geoffray shift; 200a59dd80f9f48cb750d329d4d4af2d99d72b484d1Alex Light elif [ "x$1" = "x--no-prebuild" ]; then 2015fd18ba0902df62c4e1237712f03c44b8109ce8aNicolas Geoffray run_args="${run_args} --no-prebuild" 202a59dd80f9f48cb750d329d4d4af2d99d72b484d1Alex Light prebuild_mode="no" 203a59dd80f9f48cb750d329d4d4af2d99d72b484d1Alex Light shift; 204e7873ecb240aef520f7a7933028fa58708baf761Alex Light elif [ "x$1" = "x--gcverify" ]; then 205e7873ecb240aef520f7a7933028fa58708baf761Alex Light basic_verify="true" 206e7873ecb240aef520f7a7933028fa58708baf761Alex Light gc_verify="true" 207e7873ecb240aef520f7a7933028fa58708baf761Alex Light shift 208e7873ecb240aef520f7a7933028fa58708baf761Alex Light elif [ "x$1" = "x--gcstress" ]; then 209e7873ecb240aef520f7a7933028fa58708baf761Alex Light basic_verify="true" 210e7873ecb240aef520f7a7933028fa58708baf761Alex Light gc_stress="true" 211e7873ecb240aef520f7a7933028fa58708baf761Alex Light shift 212dc959ea822b100740424fc2eee4037512bde82c2Brian Carlstrom elif [ "x$1" = "x--image" ]; then 213dc959ea822b100740424fc2eee4037512bde82c2Brian Carlstrom shift 214dc959ea822b100740424fc2eee4037512bde82c2Brian Carlstrom image="$1" 215dc959ea822b100740424fc2eee4037512bde82c2Brian Carlstrom run_args="${run_args} --image $image" 2167c04610d42cad31e6593ae1561ed855aceac1d7aElliott Hughes shift 21792cf83e001357329cbf41fa15a6e053fab6f4933Nicolas Geoffray elif [ "x$1" = "x-Xcompiler-option" ]; then 21892cf83e001357329cbf41fa15a6e053fab6f4933Nicolas Geoffray shift 21992cf83e001357329cbf41fa15a6e053fab6f4933Nicolas Geoffray option="$1" 22092cf83e001357329cbf41fa15a6e053fab6f4933Nicolas Geoffray run_args="${run_args} -Xcompiler-option $option" 22192cf83e001357329cbf41fa15a6e053fab6f4933Nicolas Geoffray shift 222769a5ad7d2caee5eb4c0ed382ac79cc8c4b9bd23Mathieu Chartier elif [ "x$1" = "x--runtime-option" ]; then 223769a5ad7d2caee5eb4c0ed382ac79cc8c4b9bd23Mathieu Chartier shift 224769a5ad7d2caee5eb4c0ed382ac79cc8c4b9bd23Mathieu Chartier option="$1" 225769a5ad7d2caee5eb4c0ed382ac79cc8c4b9bd23Mathieu Chartier run_args="${run_args} --runtime-option $option" 226769a5ad7d2caee5eb4c0ed382ac79cc8c4b9bd23Mathieu Chartier shift 227c0a8a80a3d45aa6040ce6c10108bcb96a14dc9c6Mathieu Chartier elif [ "x$1" = "x--gdb-arg" ]; then 228c0a8a80a3d45aa6040ce6c10108bcb96a14dc9c6Mathieu Chartier shift 229c0a8a80a3d45aa6040ce6c10108bcb96a14dc9c6Mathieu Chartier gdb_arg="$1" 230c0a8a80a3d45aa6040ce6c10108bcb96a14dc9c6Mathieu Chartier run_args="${run_args} --gdb-arg $gdb_arg" 231c0a8a80a3d45aa6040ce6c10108bcb96a14dc9c6Mathieu Chartier shift 2325d1ac920fdaef5d4ec8f66bb734488cd9660b024jeffhao elif [ "x$1" = "x--debug" ]; then 2335d1ac920fdaef5d4ec8f66bb734488cd9660b024jeffhao run_args="${run_args} --debug" 2345d1ac920fdaef5d4ec8f66bb734488cd9660b024jeffhao shift 2355d1ac920fdaef5d4ec8f66bb734488cd9660b024jeffhao elif [ "x$1" = "x--gdb" ]; then 2365d1ac920fdaef5d4ec8f66bb734488cd9660b024jeffhao run_args="${run_args} --gdb" 2375d1ac920fdaef5d4ec8f66bb734488cd9660b024jeffhao dev_mode="yes" 2385d1ac920fdaef5d4ec8f66bb734488cd9660b024jeffhao shift 2391d4184d65dc199a5ba720245632493b7520d9edfHiroshi Yamauchi elif [ "x$1" = "x--strace" ]; then 2401d4184d65dc199a5ba720245632493b7520d9edfHiroshi Yamauchi strace="yes" 2411d4184d65dc199a5ba720245632493b7520d9edfHiroshi Yamauchi run_args="${run_args} --invoke-with strace --invoke-with -o --invoke-with $tmp_dir/$strace_output" 2421d4184d65dc199a5ba720245632493b7520d9edfHiroshi Yamauchi shift 2435d1ac920fdaef5d4ec8f66bb734488cd9660b024jeffhao elif [ "x$1" = "x--zygote" ]; then 2445d1ac920fdaef5d4ec8f66bb734488cd9660b024jeffhao run_args="${run_args} --zygote" 2455d1ac920fdaef5d4ec8f66bb734488cd9660b024jeffhao shift 2460dff3f4d41ce8308d1973f317463941abbf79b81jeffhao elif [ "x$1" = "x--interpreter" ]; then 2477bcfcb80a31f57a84d754e00bca8698829365208Andreas Gampe run_args="${run_args} --interpreter --runtime-option -XOatFileManagerCompilerFilter:verify-at-runtime" 24863fc30e201a74dbad9422a6dbd4c39e4b60ac4c5Andreas Gampe image_suffix="-interpreter" 24963fc30e201a74dbad9422a6dbd4c39e4b60ac4c5Andreas Gampe shift 250e5f13e57ff8fa36342beb33830b3ec5942a61ccaMathieu Chartier elif [ "x$1" = "x--jit" ]; then 2517bcfcb80a31f57a84d754e00bca8698829365208Andreas Gampe run_args="${run_args} --jit --runtime-option -XOatFileManagerCompilerFilter:verify-at-runtime" 2528a159fdc17d478b2a3e49705045e51ab19842a34Andreas Gampe image_suffix="-jit" 253e5f13e57ff8fa36342beb33830b3ec5942a61ccaMathieu Chartier shift 25463fc30e201a74dbad9422a6dbd4c39e4b60ac4c5Andreas Gampe elif [ "x$1" = "x--optimizing" ]; then 25563fc30e201a74dbad9422a6dbd4c39e4b60ac4c5Andreas Gampe run_args="${run_args} -Xcompiler-option --compiler-backend=Optimizing" 25663fc30e201a74dbad9422a6dbd4c39e4b60ac4c5Andreas Gampe image_suffix="-optimizing" 2570dff3f4d41ce8308d1973f317463941abbf79b81jeffhao shift 2585d1ac920fdaef5d4ec8f66bb734488cd9660b024jeffhao elif [ "x$1" = "x--no-verify" ]; then 2597bcfcb80a31f57a84d754e00bca8698829365208Andreas Gampe run_args="${run_args} --no-verify --runtime-option -XOatFileManagerCompilerFilter:verify-none" 2605d1ac920fdaef5d4ec8f66bb734488cd9660b024jeffhao shift 2617617abdb402fd0419daa3eefb2ad059ccbb8b6dbIgor Murashkin elif [ "x$1" = "x--verify-soft-fail" ]; then 2627bcfcb80a31f57a84d754e00bca8698829365208Andreas Gampe run_args="${run_args} --verify-soft-fail --runtime-option -XOatFileManagerCompilerFilter:verify-at-runtime" 263825570c844b447beabfc7497d04fbd61c69cf28bAndreas Gampe image_suffix="-interp-ac" 2647617abdb402fd0419daa3eefb2ad059ccbb8b6dbIgor Murashkin shift 2655d1ac920fdaef5d4ec8f66bb734488cd9660b024jeffhao elif [ "x$1" = "x--no-optimize" ]; then 2665d1ac920fdaef5d4ec8f66bb734488cd9660b024jeffhao run_args="${run_args} --no-optimize" 2675d1ac920fdaef5d4ec8f66bb734488cd9660b024jeffhao shift 2685d1ac920fdaef5d4ec8f66bb734488cd9660b024jeffhao elif [ "x$1" = "x--no-precise" ]; then 2695d1ac920fdaef5d4ec8f66bb734488cd9660b024jeffhao run_args="${run_args} --no-precise" 2705d1ac920fdaef5d4ec8f66bb734488cd9660b024jeffhao shift 2717c04610d42cad31e6593ae1561ed855aceac1d7aElliott Hughes elif [ "x$1" = "x--invoke-with" ]; then 2727c04610d42cad31e6593ae1561ed855aceac1d7aElliott Hughes shift 2737c04610d42cad31e6593ae1561ed855aceac1d7aElliott Hughes what="$1" 274dc959ea822b100740424fc2eee4037512bde82c2Brian Carlstrom if [ "x$what" = "x" ]; then 275dc959ea822b100740424fc2eee4037512bde82c2Brian Carlstrom echo "$0 missing argument to --invoke-with" 1>&2 276dc959ea822b100740424fc2eee4037512bde82c2Brian Carlstrom usage="yes" 277dc959ea822b100740424fc2eee4037512bde82c2Brian Carlstrom break 278dc959ea822b100740424fc2eee4037512bde82c2Brian Carlstrom fi 2790e033673670733c0809815e3662bb5a501cdb492Ian Rogers run_args="${run_args} --invoke-with ${what}" 2805d1ac920fdaef5d4ec8f66bb734488cd9660b024jeffhao shift 2815d1ac920fdaef5d4ec8f66bb734488cd9660b024jeffhao elif [ "x$1" = "x--dev" ]; then 2825d1ac920fdaef5d4ec8f66bb734488cd9660b024jeffhao run_args="${run_args} --dev" 2835d1ac920fdaef5d4ec8f66bb734488cd9660b024jeffhao dev_mode="yes" 2845d1ac920fdaef5d4ec8f66bb734488cd9660b024jeffhao shift 285011fade82899fe3607789ca061e3a6c7fa4c71f4Tsu Chiang Chuang elif [ "x$1" = "x--build-only" ]; then 286011fade82899fe3607789ca061e3a6c7fa4c71f4Tsu Chiang Chuang build_only="yes" 287011fade82899fe3607789ca061e3a6c7fa4c71f4Tsu Chiang Chuang shift 28819ac0276208f0afef6ba8a4ab34b74a59b8d11d7Sebastien Hertz elif [ "x$1" = "x--build-with-javac-dx" ]; then 28919ac0276208f0afef6ba8a4ab34b74a59b8d11d7Sebastien Hertz USE_JACK="false" 29019ac0276208f0afef6ba8a4ab34b74a59b8d11d7Sebastien Hertz shift 29119ac0276208f0afef6ba8a4ab34b74a59b8d11d7Sebastien Hertz elif [ "x$1" = "x--build-with-jack" ]; then 29219ac0276208f0afef6ba8a4ab34b74a59b8d11d7Sebastien Hertz USE_JACK="true" 29319ac0276208f0afef6ba8a4ab34b74a59b8d11d7Sebastien Hertz shift 294011fade82899fe3607789ca061e3a6c7fa4c71f4Tsu Chiang Chuang elif [ "x$1" = "x--output-path" ]; then 295011fade82899fe3607789ca061e3a6c7fa4c71f4Tsu Chiang Chuang shift 296011fade82899fe3607789ca061e3a6c7fa4c71f4Tsu Chiang Chuang tmp_dir=$1 297dc959ea822b100740424fc2eee4037512bde82c2Brian Carlstrom if [ "x$tmp_dir" = "x" ]; then 298dc959ea822b100740424fc2eee4037512bde82c2Brian Carlstrom echo "$0 missing argument to --output-path" 1>&2 299dc959ea822b100740424fc2eee4037512bde82c2Brian Carlstrom usage="yes" 300dc959ea822b100740424fc2eee4037512bde82c2Brian Carlstrom break 301dc959ea822b100740424fc2eee4037512bde82c2Brian Carlstrom fi 302011fade82899fe3607789ca061e3a6c7fa4c71f4Tsu Chiang Chuang shift 303c8f23fc19726245da6a11fa2d92e319b9d26c019Nicolas Geoffray elif [ "x$1" = "x--android-root" ]; then 304c8f23fc19726245da6a11fa2d92e319b9d26c019Nicolas Geoffray shift 305c8f23fc19726245da6a11fa2d92e319b9d26c019Nicolas Geoffray if [ "x$1" = "x" ]; then 306c8f23fc19726245da6a11fa2d92e319b9d26c019Nicolas Geoffray echo "$0 missing argument to --android-root" 1>&2 307c8f23fc19726245da6a11fa2d92e319b9d26c019Nicolas Geoffray usage="yes" 308c8f23fc19726245da6a11fa2d92e319b9d26c019Nicolas Geoffray break 309c8f23fc19726245da6a11fa2d92e319b9d26c019Nicolas Geoffray fi 310c8f23fc19726245da6a11fa2d92e319b9d26c019Nicolas Geoffray android_root="$1" 311c8f23fc19726245da6a11fa2d92e319b9d26c019Nicolas Geoffray run_args="${run_args} --android-root $1" 312c8f23fc19726245da6a11fa2d92e319b9d26c019Nicolas Geoffray shift 3135d1ac920fdaef5d4ec8f66bb734488cd9660b024jeffhao elif [ "x$1" = "x--update" ]; then 3145d1ac920fdaef5d4ec8f66bb734488cd9660b024jeffhao update_mode="yes" 3155d1ac920fdaef5d4ec8f66bb734488cd9660b024jeffhao shift 3165d1ac920fdaef5d4ec8f66bb734488cd9660b024jeffhao elif [ "x$1" = "x--help" ]; then 3175d1ac920fdaef5d4ec8f66bb734488cd9660b024jeffhao usage="yes" 3185d1ac920fdaef5d4ec8f66bb734488cd9660b024jeffhao shift 319afbaa1aab02cfe519d00336870b1bcd24b61378dAndreas Gampe elif [ "x$1" = "x--64" ]; then 320afbaa1aab02cfe519d00336870b1bcd24b61378dAndreas Gampe run_args="${run_args} --64" 3212fe07927610177e9b83809e5bdb6d2b3d835a076Andreas Gampe suffix64="64" 322afbaa1aab02cfe519d00336870b1bcd24b61378dAndreas Gampe shift 32307aaac812c5935fc5c4023f843697fc96a42ea87Sebastien Hertz elif [ "x$1" = "x--trace" ]; then 32485139a3b78d942c810a157687dee0fb6a67207aeJeff Hao trace="true" 32507aaac812c5935fc5c4023f843697fc96a42ea87Sebastien Hertz shift 3267526d783ab68ed1dd53c763c75895cb432532b0fAndreas Gampe elif [ "x$1" = "x--stream" ]; then 3277526d783ab68ed1dd53c763c75895cb432532b0fAndreas Gampe trace_stream="true" 3287526d783ab68ed1dd53c763c75895cb432532b0fAndreas Gampe shift 329bfac14acef0c2327ef8c28f146dd17d009aa8669Alex Light elif [ "x$1" = "x--always-clean" ]; then 330bfac14acef0c2327ef8c28f146dd17d009aa8669Alex Light always_clean="yes" 331bfac14acef0c2327ef8c28f146dd17d009aa8669Alex Light shift 33205f30e1e4b62bec72d3d3f90f5e87210cc5067c8Igor Murashkin elif [ "x$1" = "x--never-clean" ]; then 33305f30e1e4b62bec72d3d3f90f5e87210cc5067c8Igor Murashkin never_clean="yes" 33405f30e1e4b62bec72d3d3f90f5e87210cc5067c8Igor Murashkin shift 335e21dc3db191df04c100620965bee4617b3b24397Andreas Gampe elif [ "x$1" = "x--dex2oat-swap" ]; then 336e21dc3db191df04c100620965bee4617b3b24397Andreas Gampe run_args="${run_args} --dex2oat-swap" 337e21dc3db191df04c100620965bee4617b3b24397Andreas Gampe shift 3384d2ef33723c1d7df269ee82cdfac98e59d95b53dAndreas Gampe elif [ "x$1" = "x--instruction-set-features" ]; then 3394d2ef33723c1d7df269ee82cdfac98e59d95b53dAndreas Gampe shift 3404d2ef33723c1d7df269ee82cdfac98e59d95b53dAndreas Gampe run_args="${run_args} --instruction-set-features $1" 3414d2ef33723c1d7df269ee82cdfac98e59d95b53dAndreas Gampe shift 3425d1ac920fdaef5d4ec8f66bb734488cd9660b024jeffhao elif expr "x$1" : "x--" >/dev/null 2>&1; then 3437c04610d42cad31e6593ae1561ed855aceac1d7aElliott Hughes echo "unknown $0 option: $1" 1>&2 3445d1ac920fdaef5d4ec8f66bb734488cd9660b024jeffhao usage="yes" 3455d1ac920fdaef5d4ec8f66bb734488cd9660b024jeffhao break 3465d1ac920fdaef5d4ec8f66bb734488cd9660b024jeffhao else 3475d1ac920fdaef5d4ec8f66bb734488cd9660b024jeffhao break 3485d1ac920fdaef5d4ec8f66bb734488cd9660b024jeffhao fi 3495d1ac920fdaef5d4ec8f66bb734488cd9660b024jeffhaodone 3503a12cfeb539b64ae116eb6313adca802457ba6fbAndreas Gampe 35191de25fd88ed755be5d72db80c93da364d97e16fAlex Light# Allocate file descriptor real_stderr and redirect it to the shell's error 35291de25fd88ed755be5d72db80c93da364d97e16fAlex Light# output (fd 2). 35391de25fd88ed755be5d72db80c93da364d97e16fAlex Lightif [ ${BASH_VERSINFO[1]} -ge 4 ] && [ ${BASH_VERSINFO[2]} -ge 1 ]; then 35491de25fd88ed755be5d72db80c93da364d97e16fAlex Light exec {real_stderr}>&2 35591de25fd88ed755be5d72db80c93da364d97e16fAlex Lightelse 35691de25fd88ed755be5d72db80c93da364d97e16fAlex Light # In bash before version 4.1 we need to do a manual search for free file 35791de25fd88ed755be5d72db80c93da364d97e16fAlex Light # descriptors. 35891de25fd88ed755be5d72db80c93da364d97e16fAlex Light FD=3 35991de25fd88ed755be5d72db80c93da364d97e16fAlex Light while [ -e /dev/fd/$FD ]; do FD=$((FD + 1)); done 36091de25fd88ed755be5d72db80c93da364d97e16fAlex Light real_stderr=$FD 36191de25fd88ed755be5d72db80c93da364d97e16fAlex Light eval "exec ${real_stderr}>&2" 36291de25fd88ed755be5d72db80c93da364d97e16fAlex Lightfi 36391de25fd88ed755be5d72db80c93da364d97e16fAlex Lightif [ "$quiet" = "yes" ]; then 36491de25fd88ed755be5d72db80c93da364d97e16fAlex Light # Force the default standard output and error to go to /dev/null so we will 36591de25fd88ed755be5d72db80c93da364d97e16fAlex Light # not print them. 36691de25fd88ed755be5d72db80c93da364d97e16fAlex Light exec 1>/dev/null 36791de25fd88ed755be5d72db80c93da364d97e16fAlex Light exec 2>/dev/null 36891de25fd88ed755be5d72db80c93da364d97e16fAlex Lightfi 36991de25fd88ed755be5d72db80c93da364d97e16fAlex Light 37091de25fd88ed755be5d72db80c93da364d97e16fAlex Lightfunction err_echo() { 37191de25fd88ed755be5d72db80c93da364d97e16fAlex Light echo "$@" 1>&${real_stderr} 37291de25fd88ed755be5d72db80c93da364d97e16fAlex Light} 37391de25fd88ed755be5d72db80c93da364d97e16fAlex Light 3743a12cfeb539b64ae116eb6313adca802457ba6fbAndreas Gampe# tmp_dir may be relative, resolve. 3753a12cfeb539b64ae116eb6313adca802457ba6fbAndreas Gampe# 3763a12cfeb539b64ae116eb6313adca802457ba6fbAndreas Gampe# Cannot use realpath, as it does not exist on Mac. 3773a12cfeb539b64ae116eb6313adca802457ba6fbAndreas Gampe# Cannot us a simple "cd", as the path might not be created yet. 378c580e04a861699d8a359e4464905b81d9cf5b926Brian Carlstrom# Cannot use readlink -m, as it does not exist on Mac. 379c580e04a861699d8a359e4464905b81d9cf5b926Brian Carlstrom# Fallback to nuclear option: 380907b699026d5558df43fdf48541278dc9b110a8eAndreas Gampenoncanonical_tmp_dir=$tmp_dir 381c580e04a861699d8a359e4464905b81d9cf5b926Brian Carlstromtmp_dir="`cd $oldwd ; python -c "import os; print os.path.realpath('$tmp_dir')"`" 38281c56e73558dee0a8e537a12a210d4bc0ef01a62Dmitry Petrochenkomkdir -p $tmp_dir 3835d1ac920fdaef5d4ec8f66bb734488cd9660b024jeffhao 384e7873ecb240aef520f7a7933028fa58708baf761Alex Lightif [ "$basic_verify" = "true" ]; then 385312baf19603ff7d2b223fd7b1ef817171a97f9d0Hiroshi Yamauchi # Set HspaceCompactForOOMMinIntervalMs to zero to run hspace compaction for OOM more frequently in tests. 386312baf19603ff7d2b223fd7b1ef817171a97f9d0Hiroshi Yamauchi run_args="${run_args} --runtime-option -Xgc:preverify --runtime-option -Xgc:postverify --runtime-option -XX:HspaceCompactForOOMMinIntervalMs=0" 387e7873ecb240aef520f7a7933028fa58708baf761Alex Lightfi 388e7873ecb240aef520f7a7933028fa58708baf761Alex Lightif [ "$gc_verify" = "true" ]; then 389e7873ecb240aef520f7a7933028fa58708baf761Alex Light run_args="${run_args} --runtime-option -Xgc:preverify_rosalloc --runtime-option -Xgc:postverify_rosalloc" 390e7873ecb240aef520f7a7933028fa58708baf761Alex Lightfi 391e7873ecb240aef520f7a7933028fa58708baf761Alex Lightif [ "$gc_stress" = "true" ]; then 39297acf19053813bbfb5b957e51b9dd6efc16351b6Alex Light run_args="${run_args} --gc-stress --runtime-option -Xgc:SS,gcstress --runtime-option -Xms2m --runtime-option -Xmx16m" 393e7873ecb240aef520f7a7933028fa58708baf761Alex Lightfi 39485139a3b78d942c810a157687dee0fb6a67207aeJeff Haoif [ "$trace" = "true" ]; then 3957526d783ab68ed1dd53c763c75895cb432532b0fAndreas Gampe run_args="${run_args} --runtime-option -Xmethod-trace --runtime-option -Xmethod-trace-file-size:2000000" 3967526d783ab68ed1dd53c763c75895cb432532b0fAndreas Gampe if [ "$trace_stream" = "true" ]; then 3977526d783ab68ed1dd53c763c75895cb432532b0fAndreas Gampe # Streaming mode uses the file size as the buffer size. So output gets really large. Drop 3987526d783ab68ed1dd53c763c75895cb432532b0fAndreas Gampe # the ability to analyze the file and just write to /dev/null. 3997526d783ab68ed1dd53c763c75895cb432532b0fAndreas Gampe run_args="${run_args} --runtime-option -Xmethod-trace-file:/dev/null" 4007526d783ab68ed1dd53c763c75895cb432532b0fAndreas Gampe # Enable streaming mode. 4017526d783ab68ed1dd53c763c75895cb432532b0fAndreas Gampe run_args="${run_args} --runtime-option -Xmethod-trace-stream" 4027526d783ab68ed1dd53c763c75895cb432532b0fAndreas Gampe else 4037526d783ab68ed1dd53c763c75895cb432532b0fAndreas Gampe run_args="${run_args} --runtime-option -Xmethod-trace-file:${DEX_LOCATION}/trace.bin" 4047526d783ab68ed1dd53c763c75895cb432532b0fAndreas Gampe fi 4057526d783ab68ed1dd53c763c75895cb432532b0fAndreas Gampeelif [ "$trace_stream" = "true" ]; then 40691de25fd88ed755be5d72db80c93da364d97e16fAlex Light err_echo "Cannot use --stream without --trace." 4077526d783ab68ed1dd53c763c75895cb432532b0fAndreas Gampe exit 1 40885139a3b78d942c810a157687dee0fb6a67207aeJeff Haofi 40985139a3b78d942c810a157687dee0fb6a67207aeJeff Hao 4101c83cbc4a817acbd7f9abb5b29a2d418a958e6a1Andreas Gampe# Most interesting target architecture variables are Makefile variables, not environment variables. 4116fbcc12a1e8c2b98ed89a290becd23e5eb38692dNicolas Geoffray# Try to map the suffix64 flag and what we find in ${ANDROID_PRODUCT_OUT}/data/art-test to an architecture name. 412853a4c3a165380544ddbaaf6e6e092f2b7ed539bDavid Brazdilfunction guess_target_arch_name() { 4136fbcc12a1e8c2b98ed89a290becd23e5eb38692dNicolas Geoffray grep32bit=`ls ${ANDROID_PRODUCT_OUT}/data/art-test | grep -E '^(arm|x86|mips)$'` 4141a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe grep64bit=`ls ${ANDROID_PRODUCT_OUT}/data/art-test | grep -E '^(arm64|x86_64|mips64)$'` 4151c83cbc4a817acbd7f9abb5b29a2d418a958e6a1Andreas Gampe if [ "x${suffix64}" = "x64" ]; then 4161c83cbc4a817acbd7f9abb5b29a2d418a958e6a1Andreas Gampe target_arch_name=${grep64bit} 4171c83cbc4a817acbd7f9abb5b29a2d418a958e6a1Andreas Gampe else 4181c83cbc4a817acbd7f9abb5b29a2d418a958e6a1Andreas Gampe target_arch_name=${grep32bit} 4191c83cbc4a817acbd7f9abb5b29a2d418a958e6a1Andreas Gampe fi 4201c83cbc4a817acbd7f9abb5b29a2d418a958e6a1Andreas Gampe} 4211c83cbc4a817acbd7f9abb5b29a2d418a958e6a1Andreas Gampe 422853a4c3a165380544ddbaaf6e6e092f2b7ed539bDavid Brazdilfunction guess_host_arch_name() { 423853a4c3a165380544ddbaaf6e6e092f2b7ed539bDavid Brazdil if [ "x${suffix64}" = "x64" ]; then 424853a4c3a165380544ddbaaf6e6e092f2b7ed539bDavid Brazdil host_arch_name="x86_64" 425853a4c3a165380544ddbaaf6e6e092f2b7ed539bDavid Brazdil else 426853a4c3a165380544ddbaaf6e6e092f2b7ed539bDavid Brazdil host_arch_name="x86" 427853a4c3a165380544ddbaaf6e6e092f2b7ed539bDavid Brazdil fi 428853a4c3a165380544ddbaaf6e6e092f2b7ed539bDavid Brazdil} 429853a4c3a165380544ddbaaf6e6e092f2b7ed539bDavid Brazdil 430a59dd80f9f48cb750d329d4d4af2d99d72b484d1Alex Lightif [ "$target_mode" = "no" ]; then 431a59dd80f9f48cb750d329d4d4af2d99d72b484d1Alex Light if [ "$runtime" = "jvm" ]; then 432a59dd80f9f48cb750d329d4d4af2d99d72b484d1Alex Light if [ "$prebuild_mode" = "yes" ]; then 43391de25fd88ed755be5d72db80c93da364d97e16fAlex Light err_echo "--prebuild with --jvm is unsupported" 434a59dd80f9f48cb750d329d4d4af2d99d72b484d1Alex Light exit 1; 435a59dd80f9f48cb750d329d4d4af2d99d72b484d1Alex Light fi 436a59dd80f9f48cb750d329d4d4af2d99d72b484d1Alex Light fi 437a59dd80f9f48cb750d329d4d4af2d99d72b484d1Alex Lightfi 438a59dd80f9f48cb750d329d4d4af2d99d72b484d1Alex Light 43903a112d23694afffe9808082e7144b7e8744a4bdAlex Lightif [ "$have_patchoat" = "no" ]; then 44003a112d23694afffe9808082e7144b7e8744a4bdAlex Light run_args="${run_args} --no-patchoat" 44103a112d23694afffe9808082e7144b7e8744a4bdAlex Lightfi 44203a112d23694afffe9808082e7144b7e8744a4bdAlex Light 44303a112d23694afffe9808082e7144b7e8744a4bdAlex Lightif [ "$have_dex2oat" = "no" ]; then 44403a112d23694afffe9808082e7144b7e8744a4bdAlex Light run_args="${run_args} --no-dex2oat" 44503a112d23694afffe9808082e7144b7e8744a4bdAlex Lightfi 44603a112d23694afffe9808082e7144b7e8744a4bdAlex Light 447201803fb1acd15b9daae51d816e1b08aededdc41Jeff Haoif [ ! "$runtime" = "jvm" ]; then 448201803fb1acd15b9daae51d816e1b08aededdc41Jeff Hao run_args="${run_args} --lib $lib" 449201803fb1acd15b9daae51d816e1b08aededdc41Jeff Haofi 450dc959ea822b100740424fc2eee4037512bde82c2Brian Carlstrom 451201803fb1acd15b9daae51d816e1b08aededdc41Jeff Haoif [ "$runtime" = "dalvik" ]; then 452dc959ea822b100740424fc2eee4037512bde82c2Brian Carlstrom if [ "$target_mode" = "no" ]; then 4536fbcc12a1e8c2b98ed89a290becd23e5eb38692dNicolas Geoffray framework="${ANDROID_PRODUCT_OUT}/system/framework" 45450be66fedd7575c58f419f013b1499845a41112aAndreas Gampe bpath="${framework}/core-libart.jar:${framework}/core-oj.jar:${framework}/conscrypt.jar:${framework}/okhttp.jar:${framework}/bouncycastle.jar:${framework}/ext.jar" 4551153ae16f243adb30fc8509c619025d30408c74aRichard Uhler run_args="${run_args} --boot --runtime-option -Xbootclasspath:${bpath}" 456dc959ea822b100740424fc2eee4037512bde82c2Brian Carlstrom else 457dc959ea822b100740424fc2eee4037512bde82c2Brian Carlstrom true # defaults to using target BOOTCLASSPATH 458dc959ea822b100740424fc2eee4037512bde82c2Brian Carlstrom fi 459201803fb1acd15b9daae51d816e1b08aededdc41Jeff Haoelif [ "$runtime" = "art" ]; then 460201803fb1acd15b9daae51d816e1b08aededdc41Jeff Hao if [ "$target_mode" = "no" ]; then 46119ac0276208f0afef6ba8a4ab34b74a59b8d11d7Sebastien Hertz # ANDROID_HOST_OUT is not set in a build environment. 462435348618590b0d5674fb4d9bbc022c6488e11b3Brian Carlstrom if [ -z "$ANDROID_HOST_OUT" ]; then 4636a439bc85bbe4076c152ebf86a721d5c827384f8Alex Light export ANDROID_HOST_OUT=${OUT_DIR:-$ANDROID_BUILD_TOP/out/}host/linux-x86 464435348618590b0d5674fb4d9bbc022c6488e11b3Brian Carlstrom fi 465853a4c3a165380544ddbaaf6e6e092f2b7ed539bDavid Brazdil guess_host_arch_name 466dcdc85bbd569f0ee66c331b4219c19304a616214Jeff Hao run_args="${run_args} --boot ${ANDROID_HOST_OUT}/framework/core${image_suffix}${pic_image_suffix}${multi_image_suffix}.art" 4671c83cbc4a817acbd7f9abb5b29a2d418a958e6a1Andreas Gampe run_args="${run_args} --runtime-option -Djava.library.path=${ANDROID_HOST_OUT}/lib${suffix64}" 468201803fb1acd15b9daae51d816e1b08aededdc41Jeff Hao else 469853a4c3a165380544ddbaaf6e6e092f2b7ed539bDavid Brazdil guess_target_arch_name 4701c951926e1d3e732eaa76d489ca35e80bec0e890Dimitry Ivanov run_args="${run_args} --runtime-option -Djava.library.path=/data/art-test/${target_arch_name}:/system/lib${suffix64}" 471dcdc85bbd569f0ee66c331b4219c19304a616214Jeff Hao run_args="${run_args} --boot /data/art-test/core${image_suffix}${pic_image_suffix}${multi_image_suffix}.art" 472201803fb1acd15b9daae51d816e1b08aededdc41Jeff Hao fi 473a59dd80f9f48cb750d329d4d4af2d99d72b484d1Alex Light if [ "$relocate" = "yes" ]; then 474a59dd80f9f48cb750d329d4d4af2d99d72b484d1Alex Light run_args="${run_args} --relocate" 475a59dd80f9f48cb750d329d4d4af2d99d72b484d1Alex Light else 476a59dd80f9f48cb750d329d4d4af2d99d72b484d1Alex Light run_args="${run_args} --no-relocate" 477a59dd80f9f48cb750d329d4d4af2d99d72b484d1Alex Light fi 4783f1dc56914177993b1b018bf21ce7d39d7feecdaAndreas Gampeelif [ "$runtime" = "jvm" ]; then 4793f1dc56914177993b1b018bf21ce7d39d7feecdaAndreas Gampe # TODO: Detect whether the host is 32-bit or 64-bit. 4803f1dc56914177993b1b018bf21ce7d39d7feecdaAndreas Gampe run_args="${run_args} --runtime-option -Djava.library.path=${ANDROID_HOST_OUT}/lib64" 481dc959ea822b100740424fc2eee4037512bde82c2Brian Carlstromfi 482dc959ea822b100740424fc2eee4037512bde82c2Brian Carlstrom 48303a112d23694afffe9808082e7144b7e8744a4bdAlex Lightif [ "$have_image" = "no" ]; then 4841ef4ce87e54a595a67263e550916b97a1b468b99Alex Light if [ "$runtime" != "art" ]; then 48591de25fd88ed755be5d72db80c93da364d97e16fAlex Light err_echo "--no-image is only supported on the art runtime" 4861ef4ce87e54a595a67263e550916b97a1b468b99Alex Light exit 1 4871ef4ce87e54a595a67263e550916b97a1b468b99Alex Light fi 4881ef4ce87e54a595a67263e550916b97a1b468b99Alex Light if [ "$target_mode" = "no" ]; then 4891ef4ce87e54a595a67263e550916b97a1b468b99Alex Light framework="${ANDROID_HOST_OUT}/framework" 4901ef4ce87e54a595a67263e550916b97a1b468b99Alex Light bpath_suffix="-hostdex" 4911ef4ce87e54a595a67263e550916b97a1b468b99Alex Light else 492c8f23fc19726245da6a11fa2d92e319b9d26c019Nicolas Geoffray framework="${android_root}/framework" 4931ef4ce87e54a595a67263e550916b97a1b468b99Alex Light bpath_suffix="" 4941ef4ce87e54a595a67263e550916b97a1b468b99Alex Light fi 4951ef4ce87e54a595a67263e550916b97a1b468b99Alex Light # TODO If the target was compiled WITH_DEXPREOPT=true then these tests will 4961ef4ce87e54a595a67263e550916b97a1b468b99Alex Light # fail since these jar files will be stripped. 4971ef4ce87e54a595a67263e550916b97a1b468b99Alex Light bpath="${framework}/core-libart${bpath_suffix}.jar" 498d50687efe56a0516e0df17f65e8fce43681b3c42Narayan Kamath bpath="${bpath}:${framework}/core-oj${bpath_suffix}.jar" 4991ef4ce87e54a595a67263e550916b97a1b468b99Alex Light bpath="${bpath}:${framework}/conscrypt${bpath_suffix}.jar" 5001ef4ce87e54a595a67263e550916b97a1b468b99Alex Light bpath="${bpath}:${framework}/okhttp${bpath_suffix}.jar" 5011ef4ce87e54a595a67263e550916b97a1b468b99Alex Light bpath="${bpath}:${framework}/bouncycastle${bpath_suffix}.jar" 5021ef4ce87e54a595a67263e550916b97a1b468b99Alex Light # Pass down the bootclasspath 5031ef4ce87e54a595a67263e550916b97a1b468b99Alex Light run_args="${run_args} --runtime-option -Xbootclasspath:${bpath}" 50403a112d23694afffe9808082e7144b7e8744a4bdAlex Light run_args="${run_args} --no-image" 50503a112d23694afffe9808082e7144b7e8744a4bdAlex Lightfi 50603a112d23694afffe9808082e7144b7e8744a4bdAlex Light 5075d1ac920fdaef5d4ec8f66bb734488cd9660b024jeffhaoif [ "$dev_mode" = "yes" -a "$update_mode" = "yes" ]; then 50891de25fd88ed755be5d72db80c93da364d97e16fAlex Light err_echo "--dev and --update are mutually exclusive" 50991de25fd88ed755be5d72db80c93da364d97e16fAlex Light usage="yes" 51091de25fd88ed755be5d72db80c93da364d97e16fAlex Lightfi 51191de25fd88ed755be5d72db80c93da364d97e16fAlex Light 51291de25fd88ed755be5d72db80c93da364d97e16fAlex Lightif [ "$dev_mode" = "yes" -a "$quiet" = "yes" ]; then 51391de25fd88ed755be5d72db80c93da364d97e16fAlex Light err_echo "--dev and --quiet are mutually exclusive" 5145d1ac920fdaef5d4ec8f66bb734488cd9660b024jeffhao usage="yes" 5155d1ac920fdaef5d4ec8f66bb734488cd9660b024jeffhaofi 5165d1ac920fdaef5d4ec8f66bb734488cd9660b024jeffhao 5175d1ac920fdaef5d4ec8f66bb734488cd9660b024jeffhaoif [ "$usage" = "no" ]; then 5185d1ac920fdaef5d4ec8f66bb734488cd9660b024jeffhao if [ "x$1" = "x" -o "x$1" = "x-" ]; then 5195d1ac920fdaef5d4ec8f66bb734488cd9660b024jeffhao test_dir=`basename "$oldwd"` 5205d1ac920fdaef5d4ec8f66bb734488cd9660b024jeffhao else 5215d1ac920fdaef5d4ec8f66bb734488cd9660b024jeffhao test_dir="$1" 5225d1ac920fdaef5d4ec8f66bb734488cd9660b024jeffhao fi 5235d1ac920fdaef5d4ec8f66bb734488cd9660b024jeffhao 5245d1ac920fdaef5d4ec8f66bb734488cd9660b024jeffhao if [ '!' -d "$test_dir" ]; then 5255d1ac920fdaef5d4ec8f66bb734488cd9660b024jeffhao td2=`echo ${test_dir}-*` 5265d1ac920fdaef5d4ec8f66bb734488cd9660b024jeffhao if [ '!' -d "$td2" ]; then 52791de25fd88ed755be5d72db80c93da364d97e16fAlex Light err_echo "${test_dir}: no such test directory" 5285d1ac920fdaef5d4ec8f66bb734488cd9660b024jeffhao usage="yes" 5295d1ac920fdaef5d4ec8f66bb734488cd9660b024jeffhao fi 5305d1ac920fdaef5d4ec8f66bb734488cd9660b024jeffhao test_dir="$td2" 5315d1ac920fdaef5d4ec8f66bb734488cd9660b024jeffhao fi 5325d1ac920fdaef5d4ec8f66bb734488cd9660b024jeffhao # Shift to get rid of the test name argument. The rest of the arguments 5335d1ac920fdaef5d4ec8f66bb734488cd9660b024jeffhao # will get passed to the test run. 5345d1ac920fdaef5d4ec8f66bb734488cd9660b024jeffhao shift 5355d1ac920fdaef5d4ec8f66bb734488cd9660b024jeffhaofi 5365d1ac920fdaef5d4ec8f66bb734488cd9660b024jeffhao 5375d1ac920fdaef5d4ec8f66bb734488cd9660b024jeffhaoif [ "$usage" = "yes" ]; then 5385d1ac920fdaef5d4ec8f66bb734488cd9660b024jeffhao prog=`basename $prog` 5395d1ac920fdaef5d4ec8f66bb734488cd9660b024jeffhao ( 5405d1ac920fdaef5d4ec8f66bb734488cd9660b024jeffhao echo "usage:" 5415d1ac920fdaef5d4ec8f66bb734488cd9660b024jeffhao echo " $prog --help Print this message." 5425d1ac920fdaef5d4ec8f66bb734488cd9660b024jeffhao echo " $prog [options] [test-name] Run test normally." 5435d1ac920fdaef5d4ec8f66bb734488cd9660b024jeffhao echo " $prog --dev [options] [test-name] Development mode" \ 5445d1ac920fdaef5d4ec8f66bb734488cd9660b024jeffhao "(dumps to stdout)." 5455d1ac920fdaef5d4ec8f66bb734488cd9660b024jeffhao echo " $prog --update [options] [test-name] Update mode" \ 5465d1ac920fdaef5d4ec8f66bb734488cd9660b024jeffhao "(replaces expected.txt)." 5475d1ac920fdaef5d4ec8f66bb734488cd9660b024jeffhao echo ' Omitting the test name or specifying "-" will use the' \ 5485d1ac920fdaef5d4ec8f66bb734488cd9660b024jeffhao "current directory." 5495d1ac920fdaef5d4ec8f66bb734488cd9660b024jeffhao echo " Runtime Options:" 550c8f23fc19726245da6a11fa2d92e319b9d26c019Nicolas Geoffray echo " -O Run non-debug rather than debug build (off by default)." 551c8f23fc19726245da6a11fa2d92e319b9d26c019Nicolas Geoffray echo " -Xcompiler-option Pass an option to the compiler." 552c8f23fc19726245da6a11fa2d92e319b9d26c019Nicolas Geoffray echo " --runtime-option Pass an option to the runtime." 553c8f23fc19726245da6a11fa2d92e319b9d26c019Nicolas Geoffray echo " --debug Wait for a debugger to attach." 55443c162f059e6463119aa1efd0841374ca7b4f789Nicolas Geoffray echo " --debuggable Whether to compile Java code for a debugger." 555c8f23fc19726245da6a11fa2d92e319b9d26c019Nicolas Geoffray echo " --gdb Run under gdb; incompatible with some tests." 556fadfee95bca395989b63f9befcb5ed8ef8528859Alex Light echo " --gdb-arg Pass an option to gdb." 557c8f23fc19726245da6a11fa2d92e319b9d26c019Nicolas Geoffray echo " --build-only Build test files only (off by default)." 55819ac0276208f0afef6ba8a4ab34b74a59b8d11d7Sebastien Hertz echo " --build-with-javac-dx Build test files with javac and dx (on by default)." 55919ac0276208f0afef6ba8a4ab34b74a59b8d11d7Sebastien Hertz echo " --build-with-jack Build test files with jack and jill (off by default)." 560c8f23fc19726245da6a11fa2d92e319b9d26c019Nicolas Geoffray echo " --interpreter Enable interpreter only mode (off by default)." 561e5f13e57ff8fa36342beb33830b3ec5942a61ccaMathieu Chartier echo " --jit Enable jit (off by default)." 5620e071250e1291656f2211c5869c649fb459d5c9bNicolas Geoffray echo " --optimizing Enable optimizing compiler (default)." 563c8f23fc19726245da6a11fa2d92e319b9d26c019Nicolas Geoffray echo " --no-verify Turn off verification (on by default)." 5647617abdb402fd0419daa3eefb2ad059ccbb8b6dbIgor Murashkin echo " --verify-soft-fail Force soft fail verification (off by default)." 5657617abdb402fd0419daa3eefb2ad059ccbb8b6dbIgor Murashkin echo " Verification is enabled if neither --no-verify" 5667617abdb402fd0419daa3eefb2ad059ccbb8b6dbIgor Murashkin echo " nor --verify-soft-fail is specified." 567c8f23fc19726245da6a11fa2d92e319b9d26c019Nicolas Geoffray echo " --no-optimize Turn off optimization (on by default)." 568c8f23fc19726245da6a11fa2d92e319b9d26c019Nicolas Geoffray echo " --no-precise Turn off precise GC (on by default)." 569c8f23fc19726245da6a11fa2d92e319b9d26c019Nicolas Geoffray echo " --zygote Spawn the process from the Zygote." \ 5705d1ac920fdaef5d4ec8f66bb734488cd9660b024jeffhao "If used, then the" 571c8f23fc19726245da6a11fa2d92e319b9d26c019Nicolas Geoffray echo " other runtime options are ignored." 572c8f23fc19726245da6a11fa2d92e319b9d26c019Nicolas Geoffray echo " --no-dex2oat Run as though dex2oat was failing." 573c8f23fc19726245da6a11fa2d92e319b9d26c019Nicolas Geoffray echo " --no-patchoat Run as though patchoat was failing." 574c8f23fc19726245da6a11fa2d92e319b9d26c019Nicolas Geoffray echo " --prebuild Run dex2oat on the files before starting test. (default)" 575c8f23fc19726245da6a11fa2d92e319b9d26c019Nicolas Geoffray echo " --no-prebuild Do not run dex2oat on the files before starting" 576c8f23fc19726245da6a11fa2d92e319b9d26c019Nicolas Geoffray echo " the test." 5771153ae16f243adb30fc8509c619025d30408c74aRichard Uhler echo " --strip-dex Strip the dex files before starting test." 578c8f23fc19726245da6a11fa2d92e319b9d26c019Nicolas Geoffray echo " --relocate Force the use of relocating in the test, making" 579c8f23fc19726245da6a11fa2d92e319b9d26c019Nicolas Geoffray echo " the image and oat files be relocated to a random" 580c8f23fc19726245da6a11fa2d92e319b9d26c019Nicolas Geoffray echo " address before running. (default)" 581c8f23fc19726245da6a11fa2d92e319b9d26c019Nicolas Geoffray echo " --no-relocate Force the use of no relocating in the test" 582fadfee95bca395989b63f9befcb5ed8ef8528859Alex Light echo " --image Run the test using a precompiled boot image. (default)" 583fadfee95bca395989b63f9befcb5ed8ef8528859Alex Light echo " --no-image Run the test without a precompiled boot image." 584c8f23fc19726245da6a11fa2d92e319b9d26c019Nicolas Geoffray echo " --host Use the host-mode virtual machine." 585c8f23fc19726245da6a11fa2d92e319b9d26c019Nicolas Geoffray echo " --invoke-with Pass --invoke-with option to runtime." 586c8f23fc19726245da6a11fa2d92e319b9d26c019Nicolas Geoffray echo " --dalvik Use Dalvik (off by default)." 587c8f23fc19726245da6a11fa2d92e319b9d26c019Nicolas Geoffray echo " --jvm Use a host-local RI virtual machine." 588eb7c144a6aff7da673ba53d501c46f00311d4d7fAlex Light echo " --use-java-home Use the JAVA_HOME environment variable" 589eb7c144a6aff7da673ba53d501c46f00311d4d7fAlex Light echo " to find the java compiler and runtime" 590eb7c144a6aff7da673ba53d501c46f00311d4d7fAlex Light echo " (if applicable) to run the test with." 591c8f23fc19726245da6a11fa2d92e319b9d26c019Nicolas Geoffray echo " --output-path [path] Location where to store the build" \ 592011fade82899fe3607789ca061e3a6c7fa4c71f4Tsu Chiang Chuang "files." 593c8f23fc19726245da6a11fa2d92e319b9d26c019Nicolas Geoffray echo " --64 Run the test in 64-bit mode" 594c8f23fc19726245da6a11fa2d92e319b9d26c019Nicolas Geoffray echo " --trace Run with method tracing" 595fadfee95bca395989b63f9befcb5ed8ef8528859Alex Light echo " --strace Run with syscall tracing from strace." 5967526d783ab68ed1dd53c763c75895cb432532b0fAndreas Gampe echo " --stream Run method tracing in streaming mode (requires --trace)" 597c8f23fc19726245da6a11fa2d92e319b9d26c019Nicolas Geoffray echo " --gcstress Run with gc stress testing" 598c8f23fc19726245da6a11fa2d92e319b9d26c019Nicolas Geoffray echo " --gcverify Run with gc verification" 599c8f23fc19726245da6a11fa2d92e319b9d26c019Nicolas Geoffray echo " --always-clean Delete the test files even if the test fails." 60005f30e1e4b62bec72d3d3f90f5e87210cc5067c8Igor Murashkin echo " --never-clean Keep the test files even if the test succeeds." 601c8f23fc19726245da6a11fa2d92e319b9d26c019Nicolas Geoffray echo " --android-root [path] The path on target for the android root. (/system by default)." 60243c162f059e6463119aa1efd0841374ca7b4f789Nicolas Geoffray echo " --dex2oat-swap Use a dex2oat swap file." 6034d2ef33723c1d7df269ee82cdfac98e59d95b53dAndreas Gampe echo " --instruction-set-features [string]" 6044d2ef33723c1d7df269ee82cdfac98e59d95b53dAndreas Gampe echo " Set instruction-set-features for compilation." 605fadfee95bca395989b63f9befcb5ed8ef8528859Alex Light echo " --pic-image Use an image compiled with position independent code for the" 606fadfee95bca395989b63f9befcb5ed8ef8528859Alex Light echo " boot class path." 607dcdc85bbd569f0ee66c331b4219c19304a616214Jeff Hao echo " --multi-image Use a set of images compiled with dex2oat multi-image for" 608dcdc85bbd569f0ee66c331b4219c19304a616214Jeff Hao echo " the boot class path." 609fadfee95bca395989b63f9befcb5ed8ef8528859Alex Light echo " --pic-test Compile the test code position independent." 61091de25fd88ed755be5d72db80c93da364d97e16fAlex Light echo " --quiet Don't print anything except failure messages" 61191de25fd88ed755be5d72db80c93da364d97e16fAlex Light ) 1>&2 # Direct to stderr so usage is not printed if --quiet is set. 6125d1ac920fdaef5d4ec8f66bb734488cd9660b024jeffhao exit 1 6135d1ac920fdaef5d4ec8f66bb734488cd9660b024jeffhaofi 6145d1ac920fdaef5d4ec8f66bb734488cd9660b024jeffhao 6155d1ac920fdaef5d4ec8f66bb734488cd9660b024jeffhaocd "$test_dir" 6165d1ac920fdaef5d4ec8f66bb734488cd9660b024jeffhaotest_dir=`pwd` 6175d1ac920fdaef5d4ec8f66bb734488cd9660b024jeffhao 6185d1ac920fdaef5d4ec8f66bb734488cd9660b024jeffhaotd_info="${test_dir}/${info}" 6195d1ac920fdaef5d4ec8f66bb734488cd9660b024jeffhaotd_expected="${test_dir}/${expected}" 6205d1ac920fdaef5d4ec8f66bb734488cd9660b024jeffhao 62122469aa00c883dad72f0da1f6925093e4776cf8fBrian Carlstromif [ ! -r $td_info ]; then 62291de25fd88ed755be5d72db80c93da364d97e16fAlex Light err_echo "${test_dir}: missing file $td_info" 62322469aa00c883dad72f0da1f6925093e4776cf8fBrian Carlstrom exit 1 62422469aa00c883dad72f0da1f6925093e4776cf8fBrian Carlstromfi 62522469aa00c883dad72f0da1f6925093e4776cf8fBrian Carlstrom 62622469aa00c883dad72f0da1f6925093e4776cf8fBrian Carlstromif [ ! -r $td_expected ]; then 62791de25fd88ed755be5d72db80c93da364d97e16fAlex Light err_echo "${test_dir}: missing file $td_expected" 6285d1ac920fdaef5d4ec8f66bb734488cd9660b024jeffhao exit 1 6295d1ac920fdaef5d4ec8f66bb734488cd9660b024jeffhaofi 6305d1ac920fdaef5d4ec8f66bb734488cd9660b024jeffhao 6315d1ac920fdaef5d4ec8f66bb734488cd9660b024jeffhao# copy the test to a temp dir and run it 6325d1ac920fdaef5d4ec8f66bb734488cd9660b024jeffhao 633510c878c73d944e8306d346e978f880bf2d06fd9Elliott Hughesecho "${test_dir}: building..." 1>&2 6345d1ac920fdaef5d4ec8f66bb734488cd9660b024jeffhao 6355d1ac920fdaef5d4ec8f66bb734488cd9660b024jeffhaorm -rf "$tmp_dir" 6365d1ac920fdaef5d4ec8f66bb734488cd9660b024jeffhaocp -Rp "$test_dir" "$tmp_dir" 6375d1ac920fdaef5d4ec8f66bb734488cd9660b024jeffhaocd "$tmp_dir" 6385d1ac920fdaef5d4ec8f66bb734488cd9660b024jeffhao 6395d1ac920fdaef5d4ec8f66bb734488cd9660b024jeffhaoif [ '!' -r "$build" ]; then 6405d1ac920fdaef5d4ec8f66bb734488cd9660b024jeffhao cp "${progdir}/etc/default-build" build 641c66671076b12a0ee8b9d1ae782732cc91beacb73Zheng Xuelse 642c66671076b12a0ee8b9d1ae782732cc91beacb73Zheng Xu cp "${progdir}/etc/default-build" . 6435d1ac920fdaef5d4ec8f66bb734488cd9660b024jeffhaofi 6445d1ac920fdaef5d4ec8f66bb734488cd9660b024jeffhao 6455d1ac920fdaef5d4ec8f66bb734488cd9660b024jeffhaoif [ '!' -r "$run" ]; then 6465d1ac920fdaef5d4ec8f66bb734488cd9660b024jeffhao cp "${progdir}/etc/default-run" run 647c66671076b12a0ee8b9d1ae782732cc91beacb73Zheng Xuelse 648c66671076b12a0ee8b9d1ae782732cc91beacb73Zheng Xu cp "${progdir}/etc/default-run" . 6495d1ac920fdaef5d4ec8f66bb734488cd9660b024jeffhaofi 6505d1ac920fdaef5d4ec8f66bb734488cd9660b024jeffhao 6511c83cbc4a817acbd7f9abb5b29a2d418a958e6a1Andreas Gampeif [ '!' -r "$check_cmd" ]; then 6521c83cbc4a817acbd7f9abb5b29a2d418a958e6a1Andreas Gampe cp "${progdir}/etc/default-check" check 653c66671076b12a0ee8b9d1ae782732cc91beacb73Zheng Xuelse 654c66671076b12a0ee8b9d1ae782732cc91beacb73Zheng Xu cp "${progdir}/etc/default-check" . 6551c83cbc4a817acbd7f9abb5b29a2d418a958e6a1Andreas Gampefi 6561c83cbc4a817acbd7f9abb5b29a2d418a958e6a1Andreas Gampe 6575d1ac920fdaef5d4ec8f66bb734488cd9660b024jeffhaochmod 755 "$build" 6585d1ac920fdaef5d4ec8f66bb734488cd9660b024jeffhaochmod 755 "$run" 6591c83cbc4a817acbd7f9abb5b29a2d418a958e6a1Andreas Gampechmod 755 "$check_cmd" 6605d1ac920fdaef5d4ec8f66bb734488cd9660b024jeffhao 6618cbc8bc716d7a47019ad14403920c72547b2fb96Elliott Hughesexport TEST_NAME=`basename ${test_dir}` 6628cbc8bc716d7a47019ad14403920c72547b2fb96Elliott Hughes 6630d5a281c671444bfa75d63caf1427a8c0e6e1177Roland Levillain# arch_supports_read_barrier ARCH 6640d5a281c671444bfa75d63caf1427a8c0e6e1177Roland Levillain# ------------------------------- 6650d5a281c671444bfa75d63caf1427a8c0e6e1177Roland Levillain# Return whether the Optimizing compiler has read barrier support for ARCH. 6660d5a281c671444bfa75d63caf1427a8c0e6e1177Roland Levillainfunction arch_supports_read_barrier() { 66722ccc3a93d32fa6991535eaebb17daf5abaf4ebfRoland Levillain # Optimizing has read barrier support for ARM, ARM64, x86 and x86-64 at the 6680d5a281c671444bfa75d63caf1427a8c0e6e1177Roland Levillain # moment. 66922ccc3a93d32fa6991535eaebb17daf5abaf4ebfRoland Levillain [ "x$1" = xarm ] || [ "x$1" = xarm64 ] || [ "x$1" = xx86 ] || [ "x$1" = xx86_64 ] 6700d5a281c671444bfa75d63caf1427a8c0e6e1177Roland Levillain} 6710d5a281c671444bfa75d63caf1427a8c0e6e1177Roland Levillain 6724846d13744f07e82571d2882acc823d811ec942dDavid Brazdil# Tests named '<number>-checker-*' will also have their CFGs verified with 6734846d13744f07e82571d2882acc823d811ec942dDavid Brazdil# Checker when compiled with Optimizing on host. 6744846d13744f07e82571d2882acc823d811ec942dDavid Brazdilif [[ "$TEST_NAME" =~ ^[0-9]+-checker- ]]; then 675f02c3cf66c2c24533f6da43970e7b766b2ca9938David Brazdil if [ "$runtime" = "art" -a "$image_suffix" = "-optimizing" -a "$USE_JACK" = "true" ]; then 6760d5a281c671444bfa75d63caf1427a8c0e6e1177Roland Levillain # Optimizing has read barrier support for certain architectures 6770d5a281c671444bfa75d63caf1427a8c0e6e1177Roland Levillain # only. On other architectures, compiling is disabled when read 6780d5a281c671444bfa75d63caf1427a8c0e6e1177Roland Levillain # barriers are enabled, meaning that we do not produce a CFG file 6790d5a281c671444bfa75d63caf1427a8c0e6e1177Roland Levillain # as a side-effect of compilation, thus the Checker assertions 6800d5a281c671444bfa75d63caf1427a8c0e6e1177Roland Levillain # cannot be checked. Disable Checker for those cases. 6810d5a281c671444bfa75d63caf1427a8c0e6e1177Roland Levillain # 6820d5a281c671444bfa75d63caf1427a8c0e6e1177Roland Levillain # TODO: Enable Checker when read barrier support is added to more 6830d5a281c671444bfa75d63caf1427a8c0e6e1177Roland Levillain # architectures (b/12687968). 6840d5a281c671444bfa75d63caf1427a8c0e6e1177Roland Levillain if [ "x$ART_USE_READ_BARRIER" = xtrue ] \ 6850d5a281c671444bfa75d63caf1427a8c0e6e1177Roland Levillain && (([ "x$host_mode" = "xyes" ] \ 6860d5a281c671444bfa75d63caf1427a8c0e6e1177Roland Levillain && ! arch_supports_read_barrier "$host_arch_name") \ 6870d5a281c671444bfa75d63caf1427a8c0e6e1177Roland Levillain || ([ "x$target_mode" = "xyes" ] \ 6880d5a281c671444bfa75d63caf1427a8c0e6e1177Roland Levillain && ! arch_supports_read_barrier "$target_arch_name")); then 6890d5a281c671444bfa75d63caf1427a8c0e6e1177Roland Levillain run_checker="no" 69080fb394091879a4d278b86f2c83d50a4addf411aDavid Brazdil # In no-prebuild mode, the compiler is only invoked if both dex2oat and 69180fb394091879a4d278b86f2c83d50a4addf411aDavid Brazdil # patchoat are available. Disable Checker otherwise (b/22552692). 6920d5a281c671444bfa75d63caf1427a8c0e6e1177Roland Levillain elif [ "$prebuild_mode" = "yes" ] \ 6930d5a281c671444bfa75d63caf1427a8c0e6e1177Roland Levillain || [ "$have_patchoat" = "yes" -a "$have_dex2oat" = "yes" ]; then 69480fb394091879a4d278b86f2c83d50a4addf411aDavid Brazdil run_checker="yes" 6955cc343d7239f9b1faf3ddf592cd5172a1371d276David Brazdil 6965e2c8d323fbab4db8a71041ff94b6baf3953bca9Alexandre Rames if [ "$target_mode" = "no" ]; then 6975e2c8d323fbab4db8a71041ff94b6baf3953bca9Alexandre Rames cfg_output_dir="$tmp_dir" 6985cc343d7239f9b1faf3ddf592cd5172a1371d276David Brazdil checker_args="--arch=${host_arch_name^^}" 6995e2c8d323fbab4db8a71041ff94b6baf3953bca9Alexandre Rames else 7005e2c8d323fbab4db8a71041ff94b6baf3953bca9Alexandre Rames cfg_output_dir="$DEX_LOCATION" 7015cc343d7239f9b1faf3ddf592cd5172a1371d276David Brazdil checker_args="--arch=${target_arch_name^^}" 7025cc343d7239f9b1faf3ddf592cd5172a1371d276David Brazdil fi 7035cc343d7239f9b1faf3ddf592cd5172a1371d276David Brazdil 7045cc343d7239f9b1faf3ddf592cd5172a1371d276David Brazdil if [ "$debuggable" = "yes" ]; then 7055cc343d7239f9b1faf3ddf592cd5172a1371d276David Brazdil checker_args="$checker_args --debuggable" 7065e2c8d323fbab4db8a71041ff94b6baf3953bca9Alexandre Rames fi 7075cc343d7239f9b1faf3ddf592cd5172a1371d276David Brazdil 7085e2c8d323fbab4db8a71041ff94b6baf3953bca9Alexandre Rames run_args="${run_args} -Xcompiler-option --dump-cfg=$cfg_output_dir/$cfg_output \ 70980fb394091879a4d278b86f2c83d50a4addf411aDavid Brazdil -Xcompiler-option -j1" 71080fb394091879a4d278b86f2c83d50a4addf411aDavid Brazdil fi 7114846d13744f07e82571d2882acc823d811ec942dDavid Brazdil fi 7124846d13744f07e82571d2882acc823d811ec942dDavid Brazdilfi 7134846d13744f07e82571d2882acc823d811ec942dDavid Brazdil 714031768a340634e2dbdec1aebb2bb3fe509b2f1f6Mathieu Chartierif [ "$runtime" != "jvm" ]; then 715031768a340634e2dbdec1aebb2bb3fe509b2f1f6Mathieu Chartier run_args="${run_args} --testlib ${testlib}" 716031768a340634e2dbdec1aebb2bb3fe509b2f1f6Mathieu Chartierfi 717031768a340634e2dbdec1aebb2bb3fe509b2f1f6Mathieu Chartier 718997f0f9e69ce7aee73cebd64be8dc40af9164257Ian Rogers# To cause tests to fail fast, limit the file sizes created by dx, dex2oat and ART output to 2MB. 71919ac0276208f0afef6ba8a4ab34b74a59b8d11d7Sebastien Hertzbuild_file_size_limit=2048 72019ac0276208f0afef6ba8a4ab34b74a59b8d11d7Sebastien Hertzrun_file_size_limit=2048 7214694e82d0062fa6fabb18f3ada5c4e32499f7078Alex Light 7224694e82d0062fa6fabb18f3ada5c4e32499f7078Alex Light# Add tests requiring a higher ulimit to this list. Ulimits might need to be raised to deal with 7234694e82d0062fa6fabb18f3ada5c4e32499f7078Alex Light# large amounts of expected output or large generated files. 7244694e82d0062fa6fabb18f3ada5c4e32499f7078Alex Lightif echo "$test_dir" | grep -Eq "(083|089|961|964|971)" > /dev/null; then 72519ac0276208f0afef6ba8a4ab34b74a59b8d11d7Sebastien Hertz build_file_size_limit=5120 72619ac0276208f0afef6ba8a4ab34b74a59b8d11d7Sebastien Hertz run_file_size_limit=5120 727997f0f9e69ce7aee73cebd64be8dc40af9164257Ian Rogersfi 7285e2c8d323fbab4db8a71041ff94b6baf3953bca9Alexandre Ramesif [ "$run_checker" = "yes" -a "$target_mode" = "yes" ]; then 7295e2c8d323fbab4db8a71041ff94b6baf3953bca9Alexandre Rames # We will need to `adb pull` the .cfg output from the target onto the host to 7305e2c8d323fbab4db8a71041ff94b6baf3953bca9Alexandre Rames # run checker on it. This file can be big. 73122ccc3a93d32fa6991535eaebb17daf5abaf4ebfRoland Levillain build_file_size_limit=24576 73222ccc3a93d32fa6991535eaebb17daf5abaf4ebfRoland Levillain run_file_size_limit=24576 7335e2c8d323fbab4db8a71041ff94b6baf3953bca9Alexandre Ramesfi 73419ac0276208f0afef6ba8a4ab34b74a59b8d11d7Sebastien Hertzif [ ${USE_JACK} = "false" ]; then 73519ac0276208f0afef6ba8a4ab34b74a59b8d11d7Sebastien Hertz # Set ulimit if we build with dx only, Jack can generate big temp files. 73619ac0276208f0afef6ba8a4ab34b74a59b8d11d7Sebastien Hertz if ! ulimit -S "$build_file_size_limit"; then 73791de25fd88ed755be5d72db80c93da364d97e16fAlex Light err_echo "ulimit file size setting failed" 73819ac0276208f0afef6ba8a4ab34b74a59b8d11d7Sebastien Hertz fi 739997f0f9e69ce7aee73cebd64be8dc40af9164257Ian Rogersfi 740997f0f9e69ce7aee73cebd64be8dc40af9164257Ian Rogers 7415d1ac920fdaef5d4ec8f66bb734488cd9660b024jeffhaogood="no" 7421ed097d4bc3fad0bf0d27172213ce1928b1f054eNicolas Geoffraygood_build="yes" 7431ed097d4bc3fad0bf0d27172213ce1928b1f054eNicolas Geoffraygood_run="yes" 7445d1ac920fdaef5d4ec8f66bb734488cd9660b024jeffhaoif [ "$dev_mode" = "yes" ]; then 7454846d13744f07e82571d2882acc823d811ec942dDavid Brazdil "./${build}" $build_args 2>&1 7467ab3a2a963669ae94e2d0cd5d9f9dda2f4c85835Elliott Hughes build_exit="$?" 7477ab3a2a963669ae94e2d0cd5d9f9dda2f4c85835Elliott Hughes echo "build exit status: $build_exit" 1>&2 7487ab3a2a963669ae94e2d0cd5d9f9dda2f4c85835Elliott Hughes if [ "$build_exit" = '0' ]; then 74919ac0276208f0afef6ba8a4ab34b74a59b8d11d7Sebastien Hertz if ! ulimit -S "$run_file_size_limit"; then 75091de25fd88ed755be5d72db80c93da364d97e16fAlex Light err_echo "ulimit file size setting failed" 75119ac0276208f0afef6ba8a4ab34b74a59b8d11d7Sebastien Hertz fi 7522bfc67361026722e2f83abf06bd3fb364161a2edElliott Hughes echo "${test_dir}: running..." 1>&2 7532bfc67361026722e2f83abf06bd3fb364161a2edElliott Hughes "./${run}" $run_args "$@" 2>&1 754dc959ea822b100740424fc2eee4037512bde82c2Brian Carlstrom run_exit="$?" 7553cf4877c66f84a7ba524732e66adcfa5296e07c1Calin Juravle 756700c8d31733534a3d978b75a03f6f7e177dc7e81Brian Carlstrom if [ "$run_exit" = "0" ]; then 7573cf4877c66f84a7ba524732e66adcfa5296e07c1Calin Juravle if [ "$run_checker" = "yes" ]; then 7585e2c8d323fbab4db8a71041ff94b6baf3953bca9Alexandre Rames if [ "$target_mode" = "yes" ]; then 7595e2c8d323fbab4db8a71041ff94b6baf3953bca9Alexandre Rames adb pull $cfg_output_dir/$cfg_output &> /dev/null 7605e2c8d323fbab4db8a71041ff94b6baf3953bca9Alexandre Rames fi 7615cc343d7239f9b1faf3ddf592cd5172a1371d276David Brazdil "$checker" $checker_args "$cfg_output" "$tmp_dir" 2>&1 7623cf4877c66f84a7ba524732e66adcfa5296e07c1Calin Juravle checker_exit="$?" 7633cf4877c66f84a7ba524732e66adcfa5296e07c1Calin Juravle if [ "$checker_exit" = "0" ]; then 7643cf4877c66f84a7ba524732e66adcfa5296e07c1Calin Juravle good="yes" 7653cf4877c66f84a7ba524732e66adcfa5296e07c1Calin Juravle fi 76691de25fd88ed755be5d72db80c93da364d97e16fAlex Light err_echo "checker exit status: $checker_exit" 7673cf4877c66f84a7ba524732e66adcfa5296e07c1Calin Juravle else 7683cf4877c66f84a7ba524732e66adcfa5296e07c1Calin Juravle good="yes" 7693cf4877c66f84a7ba524732e66adcfa5296e07c1Calin Juravle fi 770700c8d31733534a3d978b75a03f6f7e177dc7e81Brian Carlstrom fi 7713cf4877c66f84a7ba524732e66adcfa5296e07c1Calin Juravle echo "run exit status: $run_exit" 1>&2 7727ab3a2a963669ae94e2d0cd5d9f9dda2f4c85835Elliott Hughes fi 7735d1ac920fdaef5d4ec8f66bb734488cd9660b024jeffhaoelif [ "$update_mode" = "yes" ]; then 7744846d13744f07e82571d2882acc823d811ec942dDavid Brazdil "./${build}" $build_args >"$build_output" 2>&1 7755d1ac920fdaef5d4ec8f66bb734488cd9660b024jeffhao build_exit="$?" 7765d1ac920fdaef5d4ec8f66bb734488cd9660b024jeffhao if [ "$build_exit" = '0' ]; then 77719ac0276208f0afef6ba8a4ab34b74a59b8d11d7Sebastien Hertz if ! ulimit -S "$run_file_size_limit"; then 77891de25fd88ed755be5d72db80c93da364d97e16fAlex Light err_echo "ulimit file size setting failed" 77919ac0276208f0afef6ba8a4ab34b74a59b8d11d7Sebastien Hertz fi 7802bfc67361026722e2f83abf06bd3fb364161a2edElliott Hughes echo "${test_dir}: running..." 1>&2 7815d1ac920fdaef5d4ec8f66bb734488cd9660b024jeffhao "./${run}" $run_args "$@" >"$output" 2>&1 7824846d13744f07e82571d2882acc823d811ec942dDavid Brazdil if [ "$run_checker" = "yes" ]; then 7835e2c8d323fbab4db8a71041ff94b6baf3953bca9Alexandre Rames if [ "$target_mode" = "yes" ]; then 7845e2c8d323fbab4db8a71041ff94b6baf3953bca9Alexandre Rames adb pull $cfg_output_dir/$cfg_output &> /dev/null 7855e2c8d323fbab4db8a71041ff94b6baf3953bca9Alexandre Rames fi 7865cc343d7239f9b1faf3ddf592cd5172a1371d276David Brazdil "$checker" -q $checker_args "$cfg_output" "$tmp_dir" >> "$output" 2>&1 7874846d13744f07e82571d2882acc823d811ec942dDavid Brazdil fi 7885d1ac920fdaef5d4ec8f66bb734488cd9660b024jeffhao sed -e 's/[[:cntrl:]]$//g' < "$output" >"${td_expected}" 7895d1ac920fdaef5d4ec8f66bb734488cd9660b024jeffhao good="yes" 7905d1ac920fdaef5d4ec8f66bb734488cd9660b024jeffhao else 79191de25fd88ed755be5d72db80c93da364d97e16fAlex Light cat "$build_output" 1>&${real_stderr} 1>&2 79291de25fd88ed755be5d72db80c93da364d97e16fAlex Light err_echo "build exit status: $build_exit" 7935d1ac920fdaef5d4ec8f66bb734488cd9660b024jeffhao fi 794011fade82899fe3607789ca061e3a6c7fa4c71f4Tsu Chiang Chuangelif [ "$build_only" = "yes" ]; then 795011fade82899fe3607789ca061e3a6c7fa4c71f4Tsu Chiang Chuang good="yes" 7964846d13744f07e82571d2882acc823d811ec942dDavid Brazdil "./${build}" $build_args >"$build_output" 2>&1 797011fade82899fe3607789ca061e3a6c7fa4c71f4Tsu Chiang Chuang build_exit="$?" 798011fade82899fe3607789ca061e3a6c7fa4c71f4Tsu Chiang Chuang if [ "$build_exit" '!=' '0' ]; then 799011fade82899fe3607789ca061e3a6c7fa4c71f4Tsu Chiang Chuang cp "$build_output" "$output" 800011fade82899fe3607789ca061e3a6c7fa4c71f4Tsu Chiang Chuang echo "build exit status: $build_exit" >>"$output" 801011fade82899fe3607789ca061e3a6c7fa4c71f4Tsu Chiang Chuang diff --strip-trailing-cr -q "$expected" "$output" >/dev/null 802011fade82899fe3607789ca061e3a6c7fa4c71f4Tsu Chiang Chuang if [ "$?" '!=' "0" ]; then 803011fade82899fe3607789ca061e3a6c7fa4c71f4Tsu Chiang Chuang good="no" 80491de25fd88ed755be5d72db80c93da364d97e16fAlex Light err_echo "BUILD FAILED For ${TEST_NAME}" 805011fade82899fe3607789ca061e3a6c7fa4c71f4Tsu Chiang Chuang fi 806011fade82899fe3607789ca061e3a6c7fa4c71f4Tsu Chiang Chuang fi 807379e2f5996b38d9f67b9c334c232cb315a5390adTsu Chiang Chuang # Clean up extraneous files that are not used by tests. 8080160d991571fedc4c1c252a8865c59a7c8cd4973Tsu Chiang Chuang find $tmp_dir -mindepth 1 ! -regex ".*/\(.*jar\|$output\|$expected\)" | xargs rm -rf 809011fade82899fe3607789ca061e3a6c7fa4c71f4Tsu Chiang Chuang exit 0 8105d1ac920fdaef5d4ec8f66bb734488cd9660b024jeffhaoelse 8114846d13744f07e82571d2882acc823d811ec942dDavid Brazdil "./${build}" $build_args >"$build_output" 2>&1 8125d1ac920fdaef5d4ec8f66bb734488cd9660b024jeffhao build_exit="$?" 8135d1ac920fdaef5d4ec8f66bb734488cd9660b024jeffhao if [ "$build_exit" = '0' ]; then 81419ac0276208f0afef6ba8a4ab34b74a59b8d11d7Sebastien Hertz if ! ulimit -S "$run_file_size_limit"; then 81591de25fd88ed755be5d72db80c93da364d97e16fAlex Light err_echo "ulimit file size setting failed" 81619ac0276208f0afef6ba8a4ab34b74a59b8d11d7Sebastien Hertz fi 8172bfc67361026722e2f83abf06bd3fb364161a2edElliott Hughes echo "${test_dir}: running..." 1>&2 8185d1ac920fdaef5d4ec8f66bb734488cd9660b024jeffhao "./${run}" $run_args "$@" >"$output" 2>&1 8191ed097d4bc3fad0bf0d27172213ce1928b1f054eNicolas Geoffray run_exit="$?" 8201ed097d4bc3fad0bf0d27172213ce1928b1f054eNicolas Geoffray if [ "$run_exit" != "0" ]; then 82191de25fd88ed755be5d72db80c93da364d97e16fAlex Light err_echo "run exit status: $run_exit" 8221ed097d4bc3fad0bf0d27172213ce1928b1f054eNicolas Geoffray good_run="no" 8234846d13744f07e82571d2882acc823d811ec942dDavid Brazdil elif [ "$run_checker" = "yes" ]; then 8245e2c8d323fbab4db8a71041ff94b6baf3953bca9Alexandre Rames if [ "$target_mode" = "yes" ]; then 8255e2c8d323fbab4db8a71041ff94b6baf3953bca9Alexandre Rames adb pull $cfg_output_dir/$cfg_output &> /dev/null 8265e2c8d323fbab4db8a71041ff94b6baf3953bca9Alexandre Rames fi 8275cc343d7239f9b1faf3ddf592cd5172a1371d276David Brazdil "$checker" -q $checker_args "$cfg_output" "$tmp_dir" >> "$output" 2>&1 8284846d13744f07e82571d2882acc823d811ec942dDavid Brazdil checker_exit="$?" 8294846d13744f07e82571d2882acc823d811ec942dDavid Brazdil if [ "$checker_exit" != "0" ]; then 83091de25fd88ed755be5d72db80c93da364d97e16fAlex Light err_echo "checker exit status: $checker_exit" 8314846d13744f07e82571d2882acc823d811ec942dDavid Brazdil good_run="no" 8324846d13744f07e82571d2882acc823d811ec942dDavid Brazdil else 8334846d13744f07e82571d2882acc823d811ec942dDavid Brazdil good_run="yes" 8344846d13744f07e82571d2882acc823d811ec942dDavid Brazdil fi 8351ed097d4bc3fad0bf0d27172213ce1928b1f054eNicolas Geoffray else 8361ed097d4bc3fad0bf0d27172213ce1928b1f054eNicolas Geoffray good_run="yes" 8371ed097d4bc3fad0bf0d27172213ce1928b1f054eNicolas Geoffray fi 8385d1ac920fdaef5d4ec8f66bb734488cd9660b024jeffhao else 8391ed097d4bc3fad0bf0d27172213ce1928b1f054eNicolas Geoffray good_build="no" 8405d1ac920fdaef5d4ec8f66bb734488cd9660b024jeffhao cp "$build_output" "$output" 841f6930a83c925507a63d0b2c86429a4d93fa83a72Andreas Gampe echo "Failed to build in tmpdir=${tmp_dir} from oldwd=${oldwd} and cwd=`pwd`" >> "$output" 842f6930a83c925507a63d0b2c86429a4d93fa83a72Andreas Gampe echo "Non-canonical tmpdir was ${noncanonical_tmp_dir}" >> "$output" 843d9ad27db226f1ed3604a99cc33bf6ab84b5dfcfaIan Rogers echo "Args: ${args}" >> "$output" 844f6930a83c925507a63d0b2c86429a4d93fa83a72Andreas Gampe echo "build exit status: $build_exit" >> "$output" 8455c1149048868f14188a4ff2907fab578c7e012b1Andreas Gampe max_name_length=$(getconf NAME_MAX ${tmp_dir}) 8465c1149048868f14188a4ff2907fab578c7e012b1Andreas Gampe echo "Max filename (NAME_MAX): ${max_name_length}" >> "$output" 8475c1149048868f14188a4ff2907fab578c7e012b1Andreas Gampe max_path_length=$(getconf PATH_MAX ${tmp_dir}) 848602fbcd1ce68a72098eb45ae462b6cc84f218763Andreas Gampe echo "Max pathlength (PATH_MAX): ${max_path_length}" >> "$output" 8495d1ac920fdaef5d4ec8f66bb734488cd9660b024jeffhao fi 8501c83cbc4a817acbd7f9abb5b29a2d418a958e6a1Andreas Gampe ./$check_cmd "$expected" "$output" 8515d1ac920fdaef5d4ec8f66bb734488cd9660b024jeffhao if [ "$?" = "0" ]; then 8521ed097d4bc3fad0bf0d27172213ce1928b1f054eNicolas Geoffray if [ "$good_build" = "no" -o "$good_run" = "yes" ]; then 8531ed097d4bc3fad0bf0d27172213ce1928b1f054eNicolas Geoffray # output == expected 8541ed097d4bc3fad0bf0d27172213ce1928b1f054eNicolas Geoffray good="yes" 8551ed097d4bc3fad0bf0d27172213ce1928b1f054eNicolas Geoffray echo "${test_dir}: succeeded!" 1>&2 8561ed097d4bc3fad0bf0d27172213ce1928b1f054eNicolas Geoffray fi 8575d1ac920fdaef5d4ec8f66bb734488cd9660b024jeffhao fi 8585d1ac920fdaef5d4ec8f66bb734488cd9660b024jeffhaofi 8595d1ac920fdaef5d4ec8f66bb734488cd9660b024jeffhao 8605d1ac920fdaef5d4ec8f66bb734488cd9660b024jeffhao( 861bfac14acef0c2327ef8c28f146dd17d009aa8669Alex Light if [ "$good" != "yes" -a "$update_mode" != "yes" ]; then 8625d1ac920fdaef5d4ec8f66bb734488cd9660b024jeffhao echo "${test_dir}: FAILED!" 8635d1ac920fdaef5d4ec8f66bb734488cd9660b024jeffhao echo ' ' 8645d1ac920fdaef5d4ec8f66bb734488cd9660b024jeffhao echo '#################### info' 8655d1ac920fdaef5d4ec8f66bb734488cd9660b024jeffhao cat "${td_info}" | sed 's/^/# /g' 8665d1ac920fdaef5d4ec8f66bb734488cd9660b024jeffhao echo '#################### diffs' 867d630fd68491a0a59831d9822e9f5ecef250a7af5Hiroshi Yamauchi diff --strip-trailing-cr -u "$expected" "$output" | tail -n 3000 8685d1ac920fdaef5d4ec8f66bb734488cd9660b024jeffhao echo '####################' 8691d4184d65dc199a5ba720245632493b7520d9edfHiroshi Yamauchi if [ "$strace" = "yes" ]; then 8701d4184d65dc199a5ba720245632493b7520d9edfHiroshi Yamauchi echo '#################### strace output' 871d630fd68491a0a59831d9822e9f5ecef250a7af5Hiroshi Yamauchi tail -n 3000 "$tmp_dir/$strace_output" 8721d4184d65dc199a5ba720245632493b7520d9edfHiroshi Yamauchi echo '####################' 8731d4184d65dc199a5ba720245632493b7520d9edfHiroshi Yamauchi fi 8745d1ac920fdaef5d4ec8f66bb734488cd9660b024jeffhao echo ' ' 8755d1ac920fdaef5d4ec8f66bb734488cd9660b024jeffhao fi 876bfac14acef0c2327ef8c28f146dd17d009aa8669Alex Light 87791de25fd88ed755be5d72db80c93da364d97e16fAlex Light) 2>&${real_stderr} 1>&2 878bfac14acef0c2327ef8c28f146dd17d009aa8669Alex Light 879bfac14acef0c2327ef8c28f146dd17d009aa8669Alex Light# Clean up test files. 88005f30e1e4b62bec72d3d3f90f5e87210cc5067c8Igor Murashkinif [ "$always_clean" = "yes" -o "$good" = "yes" ] && [ "$never_clean" = "no" ]; then 881bfac14acef0c2327ef8c28f146dd17d009aa8669Alex Light cd "$oldwd" 882bfac14acef0c2327ef8c28f146dd17d009aa8669Alex Light rm -rf "$tmp_dir" 883bfac14acef0c2327ef8c28f146dd17d009aa8669Alex Light if [ "$target_mode" = "yes" -a "$build_exit" = "0" ]; then 884bfac14acef0c2327ef8c28f146dd17d009aa8669Alex Light adb shell rm -rf $DEX_LOCATION 885bfac14acef0c2327ef8c28f146dd17d009aa8669Alex Light fi 886bfac14acef0c2327ef8c28f146dd17d009aa8669Alex Light if [ "$good" = "yes" ]; then 887bfac14acef0c2327ef8c28f146dd17d009aa8669Alex Light exit 0 888bfac14acef0c2327ef8c28f146dd17d009aa8669Alex Light fi 889bfac14acef0c2327ef8c28f146dd17d009aa8669Alex Lightfi 890bfac14acef0c2327ef8c28f146dd17d009aa8669Alex Light 891bfac14acef0c2327ef8c28f146dd17d009aa8669Alex Light 892bfac14acef0c2327ef8c28f146dd17d009aa8669Alex Light( 893bfac14acef0c2327ef8c28f146dd17d009aa8669Alex Light if [ "$always_clean" = "yes" ]; then 894bfac14acef0c2327ef8c28f146dd17d009aa8669Alex Light echo "${TEST_NAME} files deleted from host " 895bfac14acef0c2327ef8c28f146dd17d009aa8669Alex Light if [ "$target_mode" == "yes" ]; then 896bfac14acef0c2327ef8c28f146dd17d009aa8669Alex Light echo "and from target" 897bfac14acef0c2327ef8c28f146dd17d009aa8669Alex Light fi 898bfac14acef0c2327ef8c28f146dd17d009aa8669Alex Light else 899bfac14acef0c2327ef8c28f146dd17d009aa8669Alex Light echo "${TEST_NAME} files left in ${tmp_dir} on host" 900bfac14acef0c2327ef8c28f146dd17d009aa8669Alex Light if [ "$target_mode" == "yes" ]; then 901bfac14acef0c2327ef8c28f146dd17d009aa8669Alex Light echo "and in ${DEX_LOCATION} on target" 902bfac14acef0c2327ef8c28f146dd17d009aa8669Alex Light fi 903105215d007639a6fc35b1ef9705ac138f51f35b2Brian Carlstrom fi 904105215d007639a6fc35b1ef9705ac138f51f35b2Brian Carlstrom 90591de25fd88ed755be5d72db80c93da364d97e16fAlex Light) 2>&${real_stderr} 1>&2 9065d1ac920fdaef5d4ec8f66bb734488cd9660b024jeffhao 9075d1ac920fdaef5d4ec8f66bb734488cd9660b024jeffhaoexit 1 908