1:: Copyright (C) 2017 The Android Open Source Project 2:: 3:: Licensed under the Apache License, Version 2.0 (the "License"); 4:: you may not use this file except in compliance with the License. 5:: You may obtain a copy of the License at 6:: 7:: http://www.apache.org/licenses/LICENSE-2.0 8:: 9:: Unless required by applicable law or agreed to in writing, software 10:: distributed under the License is distributed on an "AS IS" BASIS, 11:: WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12:: See the License for the specific language governing permissions and 13:: limitations under the License. 14 15:: Launcher script for vts-tradefed harness 16:: Can be used from an Android build environment, or a standalone VTS zip 17:: Caution: Although this script can be used to run VTS on Windows, 18:: Windows host is not yet officially supported. 19 20@echo off 21setlocal ENABLEDELAYEDEXPANSION 22 23set ADB=adb.exe 24set JAVA=java.exe 25where %ADB% || (echo Unable to find %ADB% && goto:eof) 26where %JAVA% || (echo Unable to find %JAVA% && goto:eof) 27 28:: check java version 29%JAVA% -version 2>&1 | findstr /R "version\ \"1*\.*[89].*\"$" || ( 30 echo Wrong java version. 1.8 or 9 is required. 31 goto:eof 32) 33 34:: check debug flag and set up remote debugging 35if not [%TF_DEBUG%] == [] ( 36 if [%TF_DEBUG_PORT%] == [] ( 37 set TF_DEBUG_PORT=10088 38 ) 39 set RDBG_FLAG=-agentlib:jdwp=transport=dt_socket,server=y,suspend=y,address=!TF_DEBUG_PORT! 40) 41 42:: assume built on Linux; running on Windows. 43:: find VTS_ROOT directory by location of this script 44echo %~dp0 | findstr /R \\out\\host\\windows-x86\\bin && ( 45 set VTS_ROOT=%~dp0\..\..\linux-x86\vts 46) 47 48if [%VTS_ROOT%] == [] ( 49 :: assume in an extracted VTS installation package 50 set VTS_ROOT=%~dp0\..\.. 51) 52echo VTS_ROOT=%VTS_ROOT% 53 54:: java classpath 55set JAR_DIR=%VTS_ROOT%\android-vts\tools 56 57:: tradefed.jar 58set TRADEFED_JAR=%JAR_DIR%\tradefed.jar 59if not exist "%TRADEFED_JAR%" ( 60 echo Unable to locate %TRADEFED_JAR%. Try prebuilt jar. 61 set TRADEFED_JAR=%JAR_DIR%\tradefed-prebuilt.jar 62) 63if not exist "%TRADEFED_JAR%" ( 64 echo Unable to locate %TRADEFED_JAR% 65 goto:eof 66) 67set JAR_PATH=%TRADEFED_JAR% 68 69:: other required jars 70set JARS=^ 71 loganalysis^ 72 hosttestlib^ 73 vts-tradefed^ 74 vts-tradefed-tests^ 75 compatibility-host-util 76for %%J in (%JARS%) do ( 77 set JAR=%JAR_DIR%\%%J.jar 78 if not exist "!JAR!" ( echo Unable to locate !JAR! && goto:eof ) 79 set JAR_PATH=!JAR_PATH!;!JAR! 80) 81 82:: to run in the lab. 83set OPTIONAL_JARS=^ 84 android-vts\tools\google-tradefed-vts-prebuilt^ 85 google-tradefed-prebuilt^ 86 google-tradefed-tests^ 87 google-tf-prod-tests 88 89for %%J in (%OPTIONAL_JARS%) do ( 90 set JAR=%VTS_ROOT%\%%J.jar 91 if exist "!JAR!" ( 92 echo Including optional JAR: !JAR! 93 set JAR_PATH=!JAR_PATH!;!JAR! 94 ) else ( 95 echo Optional JAR not found: !JAR! 96 ) 97) 98 99:: skip loading shared libraries for host-side executables 100 101:: include any host-side test jars 102set JAR_PATH=%JAR_PATH%;%VTS_ROOT%\android-vts\testcases\* 103echo JAR_PATH=%JAR_PATH% 104 105cd %VTS_ROOT%/android-vts/testcases 106%JAVA% %RDBG_FLAG% -cp "%JAR_PATH%" "-DVTS_ROOT=%VTS_ROOT%" com.android.compatibility.common.tradefed.command.CompatibilityConsole %* 107 108