1@echo off 2 3@REM 本地OpenHarmony源码目录,需根据实际环境修改 4set LOCAL=\\wsl$\ubuntu-20.04\home\code\OHOS 5@REM 本地编译环境的out目录 6set OUTDIR=out\rk3568 7 8@REM 本地用例生成目录 9set TESTDIR=%LOCAL%\%OUTDIR%\musl\libc-test 10@REM 动态链接库生成目录 11set DYNLIB=%LOCAL%\%OUTDIR%\musl\libc-test-lib 12@REM 远程传输目标目录 13set REMOTE=/data/tests/libc-test 14set REMOTEFEXT=/data/tests/libc-test/src/functionalext 15set REMOTESYSTEM=/system/lib 16@REM runtest脚本所在目录 17set SHDIR=%LOCAL%\third_party\musl\scripts 18 19@REM 开始时间 20set /a startS=%time:~6,2% 21set /a startM=%time:~3,2% 22 23@REM 检查设备是否连接 24echo checking HDC device 25for /F "usebackq delims==" %%c in (`hdc list targets`) DO ( 26 echo Device list: 27 echo %%c | findstr "[Empty]" && goto noDevice || echo %%c && goto CheckDirectory 28) 29 30:CheckDirectory 31echo checking TESTDIR 32if exist %TESTDIR% ( 33 echo TESTDIR: %TESTDIR% 34) else ( 35 echo Error: path "%TESTDIR%" was not found. 36 goto end 37) 38 39 40@REM 在单板创建目录, 需要预先创建好才能传输到相应位置。 41:hdcStart 42echo. 43echo now mkdir... 44hdc shell mkdir /data/tests 45hdc shell mkdir %REMOTE% 46hdc shell mkdir %REMOTE%/src 47 48@REM 创建临时文件夹,用于存放用例生成的临时文件 49hdc shell mkdir /tmp 50hdc shell mkdir /dev/shm 51echo Mkdir done. 52goto hdcSend 53 54@REM 传输文件,单板上执行runtest.sh,将结果REPORT返回到.bat所在目录 55:hdcSend 56for %%i in (%TESTDIR%\*) do ( 57 echo %%i 58 hdc file send %%i %REMOTE%/src 59) 60for %%j in (%DYNLIB%\*) do ( 61 echo %%j 62 hdc file send %%j %REMOTE%/src 63) 64hdc shell chmod +x %REMOTE%/src/* 65 66hdc shell mount -o rw,remount / 67hdc shell chmod 777 /etc 68 69hdc file send %SHDIR%\runtest.sh %REMOTE%/runtest.sh 70hdc shell chmod +x %REMOTE%/runtest.sh 71hdc shell %REMOTE%/runtest.sh 72 73echo hdc file recv %REMOTE%/REPORT %~dp0REPORT 74hdc file recv %REMOTE%/REPORT %~dp0REPORT 75 76:end 77echo. 78set /a endS=%time:~6,2% 79set /a endM=%time:~3,2% 80set /a diffS_=%endS%-%startS% 81set /a diffM_=%endM%-%startM% 82 83pause 84exit