1@echo off
2@setlocal enabledelayedexpansion
3
4REM It is to be used with BYOB setup to run tests on cloud VMs.
5REM REM It will run ADB tests.
6REM It takes 1 command line argument.
7REM DIST_DIR => Absolute path for the distribution directory.
8
9REM It will return 0 if it is able to execute tests, otherwise
10REM it will return 1.
11
12REM Owner: akagrawal@google.com
13
14set DIST_DIR=%1
15
16echo "Checkout adt-infra repo"
17REM $ADT_INFRA has to be set on the build machine. It should have absolute path
18REM where adt-infra needs to be checked out.
19rmdir /s /q %ADT_INFRA%
20git clone https://android.googlesource.com/platform/external/adt-infra -b emu-master-dev %ADT_INFRA%
21
22set BUILD_DIR=C:\buildbot\prebuilt\%BUILD_NUMBER%
23
24setx ANDROID_HOME %SDK_PLAT_TOOLS% /M
25setx ANDROID_SDK_ROOT %SDK_PLAT_TOOLS% /M
26
27call refreshenv
28
29echo "Setup new ADB"
30rmdir /s /q %ANDROID_SDK_ROOT%\platform-tools
317z x -aoa %BUILD_DIR%\sdk_x86-sdk\sdk-repo* -o%ANDROID_SDK_ROOT%\
32
33echo "Extract tests from general-tests.zip"
347z l %BUILD_DIR%\test_suites_x86_64\general-tests.zip | findstr "adb_integration_test"
35if errorlevel 1 goto StartTest
36
37mkdir %DIST_DIR%\general-tests
387z x -aoa %BUILD_DIR%\test_suites_x86_64\general-tests.zip -o%DIST_DIR%\general-tests\ host\testcases\adb_integration_test_*
39
40:StartTest
41echo "Run ADB tests from $ADT_INFRA"
42set count=0
43start %ADT_INFRA%\emu_test\utils\run_test_android_bridge.cmd %DIST_DIR%
44
45:loop
46set /a count+=1
47sleep 60
48tasklist /v | find "run_test_android_bridge"
49if errorlevel 1 goto cmdDone
50
51if %count% equ 90 goto cmdKill
52goto loop
53
54:cmdKill
55echo "ADB test timed out"
56taskkill /fi "windowtitle eq run_test_android_bridge*"
57
58:cmdDone
59cmd.exe /c %ANDROID_HOME%\platform-tools\adb.exe kill-server
60
61exit 0
62