1 Star 2 Fork 1

施涛/util

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
auto_runtime_core_ut.ps1 5.05 KB
一键复制 编辑 原始数据 按行查看 历史
施涛 提交于 2024-09-10 08:42 . init
# UT二维数组,添加格式如下:
# @(UT截图名,UT命令)
# UT截图名: 用于存储图片的名字,最好用用例含义的英文,方便知道图片的含义
# UT命令:UT的命令,当前位置为oh根目录
$ut_array_oh = @(
@("Check main sreen", "ls -l ~"),
@("Compile Target", "rm -rf out && ./build.sh --product-name rk3568 --build-target arkcompiler/runtime_core:ark_packages --build-target arkcompiler/runtime_core:ark_host_linux_tools_packages"),
@("Test262-1", "rm -rf out && ./build.sh --product-name rk3568 --build-target ark_js_host_linux_tools_packages --build-target ets_frontend_build"),
@("Test262-2", "cd arkcompiler/ets_frontend && python3 test262/run_test262.py --es2022 all --ark-frontend-binary=../../out/rk3568/clang_x64/arkcompiler/ets_frontend/es2abc --ark-frontend=es2panda --product-name=rk3568 --timeout=3000000"),
@("Runtime Core UT-Host", "rm -rf out && ./build.sh --product-name rk3568 --build-target runtime_core_host_unittest --gn-args is_debug=true"),
@("Runtime Core UT-Device", "rm -rf out && ./build.sh --product-name rk3568 --build-target runtime_core_unittest --gn-args is_debug=true"),
@("Fuzz", "rm -rf out && ./build.sh --product-name rk3568 --build-target arkcompiler/runtime_core/tests/fuzztest:fuzztest"),
@("loophole scan 1", "rm -rf out && ./build.sh --product-name rk3568 --build-target arkcompiler/runtime_core/libark_defect_scan_aux/tests/unittest:host_unittest"),
@("loophole scan 2", "cd out/rk3568/clang_x64/tests/unittest/arkcompiler/runtime_core && ./LibArkDefectScanAuxTest"),
@("Verifier UT", "rm -rf out && ./build.sh --product-name rk3568 --build-target arkcompiler/runtime_core:verifier_host_unittest"),
@("Verifier Script", "rm -rf out && ./build.sh --product-name rk3568 --build-target arkcompiler/runtime_core:ark_host_linux_tools_packages && export LD_LIBRARY_PATH=./out/rk3568/clang_x64/arkcompiler/ets_frontend:./out/rk3568/clang_x64/arkcompiler/ets_runtime:./out/rk3568/clang_x64/thirdparty/icu:./out/rk3568/clang_x64/thirdparty/zlib:./prebuilts/clang/ohos/linux-x86_64/llvm/lib && python3 arkcompiler/runtime_core/verifier/tests/verify_sys_hap_abc.py --hap-dir applications/standard/hap --verifier-dir out/rk3568/clang_x64/arkcompiler/runtime_core/"),
@("Disamble-UT", "rm -rf out && ./build.sh --product-name rk3568 --build-target arkcompiler/runtime_core:ark_host_linux_tools_packages"),
@("Ins Check", "rm -rf out && python3 arkcompiler/runtime_core/isa/check_version.py")
)
$ut_array_ark = @(
@("Compile", "rm -rf out && python ark.py x64.release"),
@("UT", "rm -rf out && python ark.py x64.release unittest"),
@("test262", "rm -rf out && python ark.py x64.release test262"),
@("workload", "rm -rf out && python ark.py x64.release workload"),
@("debug version", "rm -rf out && python ark.py x64.debug"),
@("release version", "rm -rf out && python ark.py arm64.release")
)
#==================================================================下面运行逻辑,勿动==========================================================================================
Add-Type -AssemblyName System.Drawing
Add-Type -AssemblyName System.Windows.Forms
#定义截图程序
function Take-Screenshot {
param(
[string]$outputPath
)
# 创建一个新的bitmap,与屏幕的大小相同
$bounds = [System.Windows.Forms.Screen]::PrimaryScreen.Bounds
$bitmap = New-Object System.Drawing.Bitmap $bounds.Width, $bounds.Height
# 创建一个graphics对象来处理bitmap
$graphics = [System.Drawing.Graphics]::FromImage($bitmap)
# 截取整个屏幕
$graphics.CopyFromScreen($bounds.Location, [System.Drawing.Point]::Empty, $bounds.Size)
# 保存图片
$bitmap.Save($outputPath, [System.Drawing.Imaging.ImageFormat]::Png)
# 释放资源
$graphics.Dispose()
$bitmap.Dispose()
}
# 定义序号,用于排序
$global:idx=1
$ssh_conn=$args[0].Trim()
#$ssh_conn="ssh -i ~/.ssh/ut_test "+$ssh_conn
$image_path=$args[1].Trim()
$oh_path=$args[2].Trim()
$ark_path=$args[3].Trim()
function Do-Screenshot {
param(
[string]$utName
)
$image_path=$image_path+"\"+$idx+"-"+$utName+".jpg"
# 等待界面数据稳定
[System.Threading.Thread]::Sleep(1000)
Take-Screenshot -outputPath $image_path
# 等待界面数据稳定
[System.Threading.Thread]::Sleep(1000)
echo $image_path
#clear
$global:idx=$global:idx+1
}
echo "start..."
echo ""
# 执行oh的UT
foreach ($subArray in $ut_array_oh) {
$image_name=$subArray[0]
$image_name="OH-"+$image_name
$cmd=$subArray[1]
$host.UI.RawUI.WindowTitle=""+$idx+" "+$image_name
# 输出信息
echo "start execute: $image_name, $cmd"
echo ""
# 调用远程
ssh -i ~/.ssh/ut_test $ssh_conn "cd "$oh_path" && "$cmd
Do-Screenshot -utName $image_name
}
# 执行ark的UT
foreach ($subArray in $ut_array_ark) {
$image_name=$subArray[0]
$image_name="ARK-"+$image_name
$cmd=$subArray[1]
$host.UI.RawUI.WindowTitle=""+$idx+" "+$image_name
# 输出信息
echo "start execute: $image_name, $cmd"
echo ""
# 调用远程
ssh -i ~/.ssh/ut_test $ssh_conn "cd "$ark_path" && "$cmd
Do-Screenshot -utName $image_name
}
echo ""
echo "end ..."
pause
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/shitao0122/util.git
git@gitee.com:shitao0122/util.git
shitao0122
util
util
master

搜索帮助

0d507c66 1850385 C8b1a773 1850385