runtest_Windows.bat 3.2 KB
Newer Older
O
oumeng 已提交
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113
@echo off


REM 本地路径和远程路径
@REM 本地OpenHarmony源码目录,请根据实际环境修改!!,脚本参数获取
set LOCAL=Z:\home\oumeng\third\third_party_musl\ndk-test\target
@REM 远程传输目标目录
set REMOTE=/data/ndk-test
@REM runtest脚本所在目录
set SHDIR=%LOCAL%\..\script

@REM 非必要情况下不要修改以下代码
@REM 开始时间
set /a startS=%time:~6,2%
set /a startM=%time:~3,2%

@REM 检查设备是否连接
echo HDC device checking...
for /F "usebackq delims==" %%c in (`hdc list targets`) DO (
    echo Device list:
    echo %%c | findstr "[Empty]" && goto noDevice || echo %%c && goto hdcStart
)

@REM 在单板创建目录,原先并不存在相应目录,也无法在传输时创建,因此需要预先创建好才能传输到相应位置。
:hdcStart
echo.
echo now mkdir...
hdc shell mkdir %REMOTE%

@REM 修改文件夹权限
@REM hdc shell mount -o rw,remount /

@REM 创建临时文件夹,用于存放用例生成的临时文件
hdc shell mkdir /tmp
hdc shell mkdir /dev/shm
echo Mkdir done.
goto hdcSend

@REM 传输文件,单板上执行runtest.sh,将结果REPORT返回到.bat所在目录 动态库传输
:hdcSend
for /d %%i in (%LOCAL%\*) do (
    @REM echo %%i
    @REM echo %%~ni
    hdc shell mkdir %REMOTE%/%%~ni
    for /d %%s in (%%i\*) do (
        @REM echo %%~ns
        hdc shell mkdir %REMOTE%/%%~ni/%%~ns
        for %%f in (%%s\*) do (
            hdc file send %%f %REMOTE%/%%~ni/%%~ns
        )
        hdc shell chmod +x %REMOTE%/%%~ni/%%~ns/*
    )
)

echo Test cases sending finished.
echo.
goto sendSH

@REM 传输文件,单板上执行runtest.sh,将结果REPORT返回到.bat所在目录 动态库传输
:hdcSend
@REM 发送脚本并执行用例
:sendSH
echo Sending runtest.sh
hdc file send %SHDIR%\runtest.sh %REMOTE%/runtest.sh
@REM hdc file send %SHDIR%\runtest-sanitize.sh %REMOTE%/runtest-sanitize.sh
hdc shell chmod u+x %REMOTE%/runtest.sh
@REM hdc shell chmod u+x %REMOTE%/runtest-sanitize.sh
echo runtest.sh has been transported.
echo runtest-sanitize.sh has been transported.
echo.
echo hdc shell .%REMOTE%/runtest.sh
hdc shell sh %REMOTE%/runtest.sh
echo.
echo ================================
echo The test cases have been executed.

@REM 删除临时文件夹
hdc shell rm /tmp -rf
hdc shell rm /dev/shm -rf
echo.
echo hdc file recv %REMOTE%/REPORT %~dp0REPORT
hdc file recv %REMOTE%/REPORT %~dp0REPORT
@REM echo hdc file recv %REMOTE%/REPORT-SANITIZE %~dp0REPORT-SANITIZE
@REM hdc file recv %REMOTE%/REPORT-SANITIZE %~dp0REPORT-SANITIZE
goto end

@REM 提示检查设备连接。
:noDevice
echo Device not found,please check your device.
goto end

@REM 完成所用时间
:end
echo.
set /a endS=%time:~6,2%
set /a endM=%time:~3,2%
set /a diffS_=%endS%-%startS%
set /a diffM_=%endM%-%startM%

@REM REPORT文件比较 
@REM start python %LOCAL%\third_party\musl\scripts\compare.py
@REM if exist "%LOCAL%\third_party\musl\scripts\\result.html" (
@REM   echo Test failed,please checking result.html!
@REM ) else (
@REM   echo Test successful!
@REM )  
@REM echo file compareing finished

@REM echo All items finished.
@REM echo Time cost:%diffM_%m%diffS_%s .
@REM echo.
pause
exit