mirror of
https://github.com/openharmony/third_party_musl2.git
synced 2026-07-01 10:25:07 -04:00
Update scripts and README_toRunStart.md
Signed-off-by: maweiye <maweiye@huawei.com>
This commit is contained in:
@@ -257,3 +257,8 @@ copy("musl_copy_inc_root") {
|
||||
outputs = [ "${target_out_dir}/${musl_inc_out_dir}/{{source_file_part}}" ]
|
||||
deps = [ ":create_porting_src" ]
|
||||
}
|
||||
|
||||
group("libctest") {
|
||||
testonly = true
|
||||
deps = [ "libc-test:musl_libc_test" ]
|
||||
}
|
||||
|
||||
@@ -0,0 +1,55 @@
|
||||
## libc-test脚本使用说明
|
||||
|
||||
### 一、生成用例
|
||||
|
||||
编译命令,单独编译出libc-test测试用例
|
||||
|
||||
```shell
|
||||
./build.sh --product-name Hi3516DV300 --build-target third_party/musl:libctest
|
||||
```
|
||||
|
||||
文件生成的目录位于 `out/hi3516dv300/tests/unittest/libc-test`
|
||||
|
||||
注:
|
||||
|
||||
旧版ohos中,文件生成的目录位于 `out/ohos-arm-release/tests/unittest/libc-test`,请根据实际修改脚本中相关路径!!
|
||||
|
||||
请务必根据实际修改脚本中相关路径!
|
||||
|
||||
### 二、执行用例
|
||||
|
||||
1. 将HDC(Windows版)工具加入到windows环境变量,并将工具改名为hdc.exe。连接上开发板,保证HDC工具可以连接。
|
||||
|
||||
2. 进入musl/scripts,并根据实际环境,修改runtest.bat中测试用例生成目录完整路径(必要)
|
||||
|
||||
```bat
|
||||
@REM 本地OpenHarmony源码目录,请根据实际环境修改!!
|
||||
set LOCAL=\\wsl$\ubuntu-20.04\home\OHOS\
|
||||
@REM 本地编译out目录
|
||||
set OUTDIR=out\hi3516dv300
|
||||
```
|
||||
|
||||
3. 将bat脚本复制到windows环境下使用!!windows端双击运行runtest.bat,执行完毕会将结果REPORT返回到当前bat所在目录。
|
||||
|
||||
此bat将从WSL映射目录传输文件到单板目录下,由于WSL无法直接访问windows端口,所以在WSL中直接使用可能无法传输用例。
|
||||
|
||||
5. 若要单独执行测试用例,需要先将common目录下的`runtest`与用例传输到单板,再通过命令执行,结果将打印出来
|
||||
|
||||
```shell
|
||||
./runtest -w '' {filename}
|
||||
```
|
||||
|
||||
|
||||
|
||||
### 三、增加用例
|
||||
|
||||
若要在functional、math、regression或增加用例,需要在相应目录的test_src_{dir}.gni中添加文件名。
|
||||
|
||||
例如:
|
||||
|
||||
1、需要在functional目录中新增一个用例:由`new_test.c`生成可执行文件`new_test`
|
||||
|
||||
2、首先把c文件放入functional目录中,打开`test_src_functional.gni`,在`functional_list`中最后一行增加`"new_test",`
|
||||
|
||||
3、执行步骤一(生成用例)中的编译命令,即可生成对应可执行文件。
|
||||
|
||||
-12
@@ -1,12 +0,0 @@
|
||||
{
|
||||
"subsystem": "musl",
|
||||
"parts": {
|
||||
"libc-test": {
|
||||
"module_list":[
|
||||
],
|
||||
"test_list": [
|
||||
"//third_party/musl/libc-test:musl_libc_test"
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
+28
-16
@@ -1,17 +1,29 @@
|
||||
cd /data/tests/libc-test/src
|
||||
rm REPORT
|
||||
touch REPORT
|
||||
for filelist in $(ls)
|
||||
do
|
||||
cd /data/tests/libc-test/src/$filelist
|
||||
for file in $(ls)
|
||||
do
|
||||
if [ "$file" = "runtest" ] || [ "$file" = "libdlopen_dso.so" ] || [ "$file" = "libtls_get_new-dtv_dso.so" ] || [ "$file" = "src" ]; then
|
||||
continue
|
||||
else
|
||||
/data/tests/libc-test/src/common/runtest -w '' $file >>../REPORT
|
||||
echo $filelist/$file
|
||||
fi
|
||||
done
|
||||
cd ..
|
||||
|
||||
cd /data/tests/libc-test
|
||||
rm src/REPORT
|
||||
touch src/REPORT
|
||||
|
||||
for filelist in src/*
|
||||
do
|
||||
if [ -d $filelist ]; then
|
||||
for file in `ls $filelist`
|
||||
do
|
||||
if [ "$file" = "runtest" ] \
|
||||
|| [ "$file" = "libdlopen_dso.so" ] \
|
||||
|| [ "$file" = "libtls_init_dso.so" ] \
|
||||
|| [ "$file" = "libtls_align_dso.so" ] \
|
||||
|| [ "$file" = "libtls_get_new-dtv_dso.so" ]
|
||||
then
|
||||
continue
|
||||
else
|
||||
if [ "$file" = "tls_get_new-dtv" ];then
|
||||
cd src/regression
|
||||
/data/tests/libc-test/src/common/runtest -w '' $file >> /data/tests/libc-test/src/REPORT
|
||||
cd /data/tests/libc-test
|
||||
else
|
||||
src/common/runtest -w '' $filelist/$file >> src/REPORT
|
||||
fi
|
||||
fi
|
||||
done
|
||||
fi
|
||||
done
|
||||
|
||||
@@ -1,17 +1,23 @@
|
||||
@echo off
|
||||
|
||||
@REM 开始时间
|
||||
set /a startS=%time:~6,2%
|
||||
set /a startM=%time:~3,2%
|
||||
@REM 本地OpenHarmony源码目录,请根据实际环境修改!!
|
||||
set LOCAL=\\wsl$\ubuntu-20.04\home\OHOS\
|
||||
@REM 本地编译out目录
|
||||
set OUTDIR=out\hi3516dv300
|
||||
|
||||
@REM 本地文件所在目录
|
||||
set LOCAL=\\wsl$\ubuntu-20.04\home\OHOS\out\ohos-arm-release\tests\unittest\libc-test\src
|
||||
@REM 本地用例生成目录
|
||||
set TESTDIR=%LOCAL%\%OUTDIR%\tests\unittest\libc-test\src
|
||||
@REM 动态链接库生成目录
|
||||
set DYNLIB=%LOCAL%\%OUTDIR%\musl\libc-test\lib
|
||||
@REM 远程传输目标目录
|
||||
set REMOTE=/data/tests/libc-test/src
|
||||
@REM runtest脚本所在目录
|
||||
set SHDIR=\\wsl$\Ubuntu-20.04\home\OHOS\third_party\musl\scripts
|
||||
@REM 动态链接库所在目录
|
||||
set DYNLIB=\\wsl$\Ubuntu-18.04\root\openhramony2\out\ohos-arm-release\musl\libc-test\lib
|
||||
set SHDIR=%LOCAL%\third_party\musl\scripts
|
||||
|
||||
@REM Do not modify the following code unless necessary
|
||||
@REM 开始时间
|
||||
set /a startS=%time:~6,2%
|
||||
set /a startM=%time:~3,2%
|
||||
|
||||
@REM 检查设备是否连接
|
||||
echo HDC device checking...
|
||||
@@ -34,71 +40,72 @@ hdc shell mkdir %REMOTE%/math
|
||||
hdc shell mkdir %REMOTE%/musl
|
||||
hdc shell mkdir %REMOTE%/regression
|
||||
|
||||
@REM 创建临时文件夹
|
||||
@REM 创建临时文件夹,用于存放用例生成的临时文件
|
||||
hdc shell mkdir /tmp
|
||||
hdc shell mkdir /dev/shm
|
||||
|
||||
@REM 创建存放动态库文件夹
|
||||
hdc shell mkdir %REMOTE%/functional/src
|
||||
hdc shell mkdir %REMOTE%/functional/src/functional
|
||||
echo Done.
|
||||
echo Mkdir done.
|
||||
goto hdcSend
|
||||
|
||||
@REM 传输文件,单板上执行runtest.sh,将结果REPORT返回到.bat所在目录
|
||||
:hdcSend
|
||||
for /F %%i in ('dir %LOCAL% /S /B') do (
|
||||
for /F %%i in ('dir %TESTDIR% /S /B') do (
|
||||
for %%b in ("%%i\..") do (
|
||||
echo Sending %%~nb/%%~nxi
|
||||
hdc file send -sync %%i %REMOTE%/%%~nb/%%~nxi
|
||||
hdc shell chmod a+x %REMOTE%/%%~nb/%%~nxi
|
||||
)
|
||||
)
|
||||
|
||||
@REM 动态库传输
|
||||
hdc file send %DYNLIB%\libdlopen_dso.so %REMOTE%/functional
|
||||
hdc file send %DYNLIB%\libtls_get_new-dtv_dso.so %REMOTE%/regression
|
||||
hdc file send %DYNLIB%\libtls_align_dso.so %REMOTE%/functional/src/functional
|
||||
hdc file send %DYNLIB%\libtls_init_dso.so %REMOTE%/functional/src/functional
|
||||
hdc file send %DYNLIB%\libdlopen_dso.so %REMOTE%/functional/libdlopen_dso.so
|
||||
hdc file send %DYNLIB%\libtls_align_dso.so %REMOTE%/functional/libtls_align_dso.so
|
||||
hdc file send %DYNLIB%\libtls_init_dso.so %REMOTE%/functional/libtls_init_dso.so
|
||||
hdc file send %DYNLIB%\libtls_get_new-dtv_dso.so %REMOTE%/regression/libtls_get_new-dtv_dso.so
|
||||
|
||||
@REM 修改动态库权限
|
||||
hdc shell chmod a+x %REMOTE%/functional/libdlopen_dso.so
|
||||
hdc shell chmod a+x %REMOTE%/functional/libtls_align_dso.so
|
||||
hdc shell chmod a+x %REMOTE%/functional/libtls_init_dso.so
|
||||
hdc shell chmod a+x %REMOTE%/regression/libtls_get_new-dtv_dso.so
|
||||
hdc shell chmod a+x %REMOTE%/functional/src/functional/libtls_align_dso.so
|
||||
hdc shell chmod a+x %REMOTE%/functional/src/functional/libtls_init_dso.so
|
||||
echo Done.
|
||||
echo Test cases sending finished.
|
||||
echo.
|
||||
echo Sending run.sh
|
||||
hdc file send %SHDIR%\run.sh %REMOTE%/runtest.sh
|
||||
goto sendSH
|
||||
|
||||
|
||||
@REM 发送脚本并执行用例
|
||||
:sendSH
|
||||
echo Sending runtest.sh
|
||||
hdc file send %SHDIR%\runtest.sh %REMOTE%/runtest.sh
|
||||
hdc shell chmod a+x %REMOTE%/runtest.sh
|
||||
echo.
|
||||
echo ============================
|
||||
echo ALL files send finished.
|
||||
echo runtest.sh has been transported.
|
||||
echo.
|
||||
echo hdc shell .%REMOTE%/runtest.sh
|
||||
hdc shell .%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
|
||||
goto end
|
||||
|
||||
@REM 若检查无设备连接,提示检查设备。
|
||||
@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%
|
||||
echo All Done. Time cost:%diffM_%m%diffS_%s
|
||||
|
||||
@REM 删除临时文件夹
|
||||
hdc shell rm /tmp -rf
|
||||
hdc shell rm /dev/shm -rf
|
||||
|
||||
@REM 完成所用时间
|
||||
echo All items finished.
|
||||
echo Time cost:%diffM_%m%diffS_%s .
|
||||
echo.
|
||||
pause
|
||||
exit
|
||||
Reference in New Issue
Block a user