1@echo off 2 3 4REM 本地路径和远程路径 5@REM 本地OpenHarmony源码目录,请根据实际环境修改!!,脚本参数获取 6set LOCAL=Z:\home\oumeng\third\third_party_musl\ndk-test\target 7@REM 远程传输目标目录 8set REMOTE=/data/ndk-test 9@REM runtest脚本所在目录 10set SHDIR=%LOCAL%\..\script 11 12@REM 非必要情况下不要修改以下代码 13@REM 开始时间 14set /a startS=%time:~6,2% 15set /a startM=%time:~3,2% 16 17@REM 检查设备是否连接 18echo HDC device checking... 19for /F "usebackq delims==" %%c in (`hdc list targets`) DO ( 20 echo Device list: 21 echo %%c | findstr "[Empty]" && goto noDevice || echo %%c && goto hdcStart 22) 23 24@REM 在单板创建目录,原先并不存在相应目录,也无法在传输时创建,因此需要预先创建好才能传输到相应位置。 25:hdcStart 26echo. 27echo now mkdir... 28hdc shell mkdir %REMOTE% 29 30@REM 修改文件夹权限 31@REM hdc shell mount -o rw,remount / 32 33@REM 创建临时文件夹,用于存放用例生成的临时文件 34hdc shell mkdir /tmp 35hdc shell mkdir /dev/shm 36echo Mkdir done. 37goto hdcSend 38 39@REM 传输文件,单板上执行runtest.sh,将结果REPORT返回到.bat所在目录 动态库传输 40:hdcSend 41for /d %%i in (%LOCAL%\*) do ( 42 @REM echo %%i 43 @REM echo %%~ni 44 hdc shell mkdir %REMOTE%/%%~ni 45 for /d %%s in (%%i\*) do ( 46 @REM echo %%~ns 47 hdc shell mkdir %REMOTE%/%%~ni/%%~ns 48 for %%f in (%%s\*) do ( 49 hdc file send %%f %REMOTE%/%%~ni/%%~ns 50 ) 51 hdc shell chmod +x %REMOTE%/%%~ni/%%~ns/* 52 ) 53) 54 55echo Test cases sending finished. 56echo. 57goto sendSH 58 59@REM 传输文件,单板上执行runtest.sh,将结果REPORT返回到.bat所在目录 动态库传输 60:hdcSend 61@REM 发送脚本并执行用例 62:sendSH 63echo Sending runtest.sh 64hdc file send %SHDIR%\runtest.sh %REMOTE%/runtest.sh 65@REM hdc file send %SHDIR%\runtest-sanitize.sh %REMOTE%/runtest-sanitize.sh 66hdc shell chmod u+x %REMOTE%/runtest.sh 67@REM hdc shell chmod u+x %REMOTE%/runtest-sanitize.sh 68echo runtest.sh has been transported. 69echo runtest-sanitize.sh has been transported. 70echo. 71echo hdc shell .%REMOTE%/runtest.sh 72hdc shell sh %REMOTE%/runtest.sh 73echo. 74echo ================================ 75echo The test cases have been executed. 76 77@REM 删除临时文件夹 78hdc shell rm /tmp -rf 79hdc shell rm /dev/shm -rf 80echo. 81echo hdc file recv %REMOTE%/REPORT %~dp0REPORT 82hdc file recv %REMOTE%/REPORT %~dp0REPORT 83@REM echo hdc file recv %REMOTE%/REPORT-SANITIZE %~dp0REPORT-SANITIZE 84@REM hdc file recv %REMOTE%/REPORT-SANITIZE %~dp0REPORT-SANITIZE 85goto end 86 87@REM 提示检查设备连接。 88:noDevice 89echo Device not found,please check your device. 90goto end 91 92@REM 完成所用时间 93:end 94echo. 95set /a endS=%time:~6,2% 96set /a endM=%time:~3,2% 97set /a diffS_=%endS%-%startS% 98set /a diffM_=%endM%-%startM% 99 100@REM REPORT文件比较 101@REM start python %LOCAL%\third_party\musl\scripts\compare.py 102@REM if exist "%LOCAL%\third_party\musl\scripts\\result.html" ( 103@REM echo Test failed,please checking result.html! 104@REM ) else ( 105@REM echo Test successful! 106@REM ) 107@REM echo file compareing finished 108 109@REM echo All items finished. 110@REM echo Time cost:%diffM_%m%diffS_%s . 111@REM echo. 112pause 113exit 114