实现自动选择线程和fps并等待30分钟生成截图导出日志的bat脚本

@REM ========================================================================================================
@REM 
@REM    configuration settings
@REM 
@REM ========================================================================================================
@echo off 

@REM Allow 按钮的坐标
SET CORD_ALLOW=1171 760

@REM 1080list 选项的坐标
SET CORD_1080LIST=1597 282
SET CORD_720LIST=1597 472

@REM ok 的坐标
SET CORD_OK=1300 900

@REM 上划一格
SET CORD_SWIP_UP=979 698 979 548

@REM 等待时长, 30分钟,单位:毫秒
SET /A PROC_DURATION=5000

@REM 返回按钮坐标
SET CORD_BACK=80 150

@REM 设备上保存测试结果的目录
SET DEV_DIR_RESULT=/sdcard/av1-battery-test

@REM PC 上保存测试结果的目录
SET HOST_DIR_RESULT=e:\qa\AV1-test2

@REM 结果文件名
@REM SET RESULT_1080_60_2T=google-1080-60fps-2t
@REM SET RESULT_1080_60_3T=google-1080-60fps-3t
@REM SET RESULT_1080_60_4T=google-1080-60fps-4t



@REM ========================================================================================================
@REM 
@REM    test cases
@REM 
@REM ========================================================================================================
@echo off 
@REM Call为调用的作用,可以选择想要测试的testcase,暂时不需要测试的可以屏蔽
CALL :BatteryTestFunc 1080 2 60
call :BatteryTestFunc 1080 3 60
call :BatteryTestFunc 1080 4 60

CALL :BatteryTestFunc 1080 2 30
call :BatteryTestFunc 1080 3 30
call :BatteryTestFunc 1080 4 30

call :BatteryTestFunc 720 2 60
call :BatteryTestFunc 720 3 60
call :BatteryTestFunc 720 4 60

call :BatteryTestFunc 720 2 30
call :BatteryTestFunc 720 3 30
call :BatteryTestFunc 720 4 30



::========================================================================================================
::-- Battery Test Function 
::  %1: media resolution. 720 or 1080
::  %2: thread number. 2, 3, 4
::  %3: fps, 30 or 60
::========================================================================================================
 :BatteryTestFunc
@echo off 

echo %1, %2, %3
@REM 如果%1所代表的的media resolution 为空,则报错invalid arguments并退出
if "%1"=="" (
    echo "invalid arguments"
    EXIT /B -1
)

@REM SETLOCAL 
    SET /A PAR_RESOLUTION=%~1
    SET /A PAR_THREAD=%2
    SET /A PAR_FPS=%3
    SET PAR_RESFILE=google-%PAR_RESOLUTION%-%PAR_FPS%fps-%PAR_THREAD%t
    @REM SET PAR_RESFILE=%4
@REM ENDLOCAL

echo =====================================================================
echo Resolution : %PAR_RESOLUTION%
echo Thread     : %PAR_THREAD%
echo FPS        : %PAR_FPS%
echo Result File: %PAR_RESFILE%
echo =====================================================================

:: resolution selection
SET RESOLUTION_SELECTION=0
if "%PAR_RESOLUTION%"=="1080" (
    SET RESOLUTION_SELECTION=%CORD_1080LIST%
) else if "%PAR_RESOLUTION%"=="720" (
    SET RESOLUTION_SELECTION=%CORD_720LIST%
) else (
    echo "Invalid resolution"
    EXIT /B -1
)
echo RESOLUTION_SELECTION: %RESOLUTION_SELECTION%

:: thread selection
if "%PAR_THREAD%"=="2" (
    SET THREAD_SELECTION=0
) else if "%PAR_THREAD%"=="3" (
    SET THREAD_SELECTION=1
) else if "%PAR_THREAD%"=="4" (
    SET THREAD_SELECTION=2
) 
echo THREAD_SELECTION: %THREAD_SELECTION%

adb shell am start "com.cidana.testdav1d.google/com.cidana.testmediacodec.FileListActivity"

@REM :: Allow button
adb shell input tap %CORD_ALLOW%

@REM :: 1080list
adb shell input tap %RESOLUTION_SELECTION%

@REM 3-threads
@REM adb shell input swipe %CORD_SWIP_UP%
@REM Kenny: 此处可以优化,使用循环来处理
@REM if %THREAD_SELECTION% EQU 1 (
@REM   adb shell input swipe %CORD_SWIP_UP%
@REM ) else if %THREAD_SELECTION% EQU 2 (
@REM   adb shell input swipe %CORD_SWIP_UP%
@REM    adb shell input swipe %CORD_SWIP_UP%
@REM )
FOR /l %%i in (%THREAD_SELECTION%,-1,1) DO adb shell input swipe %CORD_SWIP_UP%


@REM OK
adb shell input tap %CORD_OK%

@REM 60fps
if %PAR_FPS% EQU 60 (
    adb shell input swipe %CORD_SWIP_UP%
)

@REM 清掉之前的数据
adb shell dumpsys batterystats --reset

@REM 开始测试
adb shell input tap %CORD_OK%

@REM 等待时间,单位为毫秒
@REM echo wscript.sleep %PROC_DURATION%>%tmp%\delay.vbs&&%tmp%\delay.vbs&&del /q %tmp%\delay.vbs
TIMEOUT /t 5

@REM 停止操作,为返回键
adb shell input tap %CORD_BACK%

@REM 截图到手机中
adb shell mkdir -p %DEV_DIR_RESULT%
adb shell screencap -p %DEV_DIR_RESULT%/%PAR_RESFILE%.png
adb pull %DEV_DIR_RESULT%/%PAR_RESFILE%.png %HOST_DIR_RESULT%
adb shell rm %DEV_DIR_RESULT%/%PAR_RESFILE%.png

@REM 导出系统 log 
@REM adb shell dumpsys batterystats 'com.cidana.testdav1d.cidana' | more > e:\qa\AV1-test2\cidana-1080-60fps-2t.txt
adb shell dumpsys batterystats > %HOST_DIR_RESULT%\%PAR_RESFILE%.txt

@REM 杀掉进程
@REM adb shell pm clear com.cidana.testdav1d.cidana

@REM 退出进程但不清除缓存
adb shell am force-stop com.cidana.testdav1d.cidana

GOTO:EOF
@REM EXIT /B 0

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值