Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Test Xdevice
提交
bb55bc86
T
Test Xdevice
项目概览
OpenHarmony
/
Test Xdevice
9 个月 前同步成功
通知
6
Star
23
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
T
Test Xdevice
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
提交
bb55bc86
编写于
9月 13, 2021
作者:
O
openharmony_ci
提交者:
Gitee
9月 13, 2021
浏览文件
操作
浏览文件
下载
差异文件
!30 解决linux镜像运行ssts用例问题
Merge pull request !30 from alex_hold/master
上级
5bb3e750
23c183df
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
44 addition
and
25 deletion
+44
-25
src/xdevice/_core/constants.py
src/xdevice/_core/constants.py
+7
-0
src/xdevice/_core/driver/drivers_lite.py
src/xdevice/_core/driver/drivers_lite.py
+14
-9
src/xdevice/_core/environment/dmlib_lite.py
src/xdevice/_core/environment/dmlib_lite.py
+11
-9
src/xdevice/_core/testkit/kit_lite.py
src/xdevice/_core/testkit/kit_lite.py
+12
-7
未找到文件。
src/xdevice/_core/constants.py
浏览文件 @
bb55bc86
...
...
@@ -283,3 +283,10 @@ class ConfigConst(object):
module_kits
=
"module_kits"
spt
=
"spt"
version
=
"version"
class
FilePermission
(
object
):
mode_777
=
0o777
mode_755
=
0o755
mode_644
=
0o644
\ No newline at end of file
src/xdevice/_core/driver/drivers_lite.py
浏览文件 @
bb55bc86
...
...
@@ -31,6 +31,7 @@ from _core.constants import ComType
from
_core.constants
import
ParserType
from
_core.constants
import
CKit
from
_core.constants
import
DeviceLiteKernel
from
_core.constants
import
FilePermission
from
_core.driver.parser_lite
import
ShellHandler
from
_core.environment.dmlib_lite
import
generate_report
from
_core.exception
import
ExecuteTerminate
...
...
@@ -178,7 +179,8 @@ class CppTestDriver(IDriver):
self
.
error_message
=
exception
finally
:
device_log_file_open
=
os
.
open
(
device_log_file
,
os
.
O_WRONLY
|
os
.
O_CREAT
|
os
.
O_APPEND
,
0o755
)
os
.
O_CREAT
|
os
.
O_APPEND
,
FilePermission
.
mode_755
)
with
os
.
fdopen
(
device_log_file_open
,
"a"
)
as
file_name
:
file_name
.
write
(
self
.
config
.
command_result
)
file_name
.
flush
()
...
...
@@ -195,6 +197,7 @@ class CppTestDriver(IDriver):
self
.
config
.
device
.
execute_command_with_timeout
(
command
=
"cd {}"
.
format
(
execute_dir
),
timeout
=
1
)
self
.
config
.
execute_bin_path
=
execute_dir
if
self
.
execute_bin
.
startswith
(
"/"
):
command
=
".%s"
%
self
.
execute_bin
...
...
@@ -274,7 +277,6 @@ class CppTestDriver(IDriver):
return
tests
tests
=
self
.
read_nfs_xml
(
request
,
self
.
config
.
device_xml_path
)
self
.
delete_device_xml
(
request
,
self
.
config
.
device_xml_path
)
time
.
sleep
(
1
)
return
tests
else
:
...
...
@@ -384,7 +386,7 @@ class CppTestDriver(IDriver):
if
self
.
config
.
xml_output
:
self
.
run
(
"{} --gtest_output=xml:{}"
.
format
(
command
,
self
.
config
.
device_report_path
))
time
.
sleep
(
20
)
time
.
sleep
(
5
)
test_rerun
=
True
if
self
.
check_xml_exist
(
self
.
execute_bin
+
".xml"
):
test_rerun
=
False
...
...
@@ -431,7 +433,7 @@ class CppTestDriver(IDriver):
listener_copy
,
timeout
=
15
)
if
len
(
test_tracker
.
get_current_run_results
()):
return
except
LiteDeviceError
:
except
LiteDeviceError
as
_
:
LOG
.
debug
(
"Exception: ShellCommandUnresponsiveException"
)
handler
.
parsers
[
0
].
mark_test_as_failed
(
test
)
...
...
@@ -495,6 +497,8 @@ class CppTestDriver(IDriver):
if
xml_file
in
result
:
return
True
time
.
sleep
(
5
)
if
(
self
.
execute_bin
+
"_1.xml"
)
in
result
:
return
False
return
False
def
read_nfs_xml
(
self
,
request
,
report_path
,
is_true
=
False
):
...
...
@@ -584,9 +588,9 @@ class CppTestDriver(IDriver):
try
:
sftp
.
remove
(
filepath
)
time
.
sleep
(
0.5
)
except
IOError
:
except
IOError
as
_
:
pass
except
FileNotFoundError
:
except
FileNotFoundError
as
_
:
pass
client
.
close
()
else
:
...
...
@@ -595,7 +599,8 @@ class CppTestDriver(IDriver):
os
.
remove
(
report_xml
)
except
Exception
as
exception
:
LOG
.
error
(
"remove {} Failed.{}"
.
format
(
report_xml
,
exception
))
"remove {} Failed:{}"
.
format
(
report_xml
,
exception
))
pass
def
__result__
(
self
):
return
self
.
result
if
os
.
path
.
exists
(
self
.
result
)
else
""
...
...
@@ -701,7 +706,7 @@ class CTestDriver(IDriver):
__get_serial__
())
device_log_file_open
=
\
os
.
open
(
device_log_file
,
os
.
O_WRONLY
|
os
.
O_CREAT
|
os
.
O_APPEND
,
0o
755
)
os
.
O_APPEND
,
FilePermission
.
mode_
755
)
with
os
.
fdopen
(
device_log_file_open
,
"a"
)
as
file_name
:
file_name
.
write
(
"{}{}"
.
format
(
"
\n
"
.
join
(
result
.
split
(
"
\n
"
)[
0
:
-
1
]),
"
\n
"
))
...
...
@@ -858,7 +863,7 @@ class OpenSourceTestDriver(IDriver):
request
.
config
.
device
.
__get_serial__
())
device_log_file_open
=
\
os
.
open
(
device_log_file
,
os
.
O_WRONLY
|
os
.
O_CREAT
|
os
.
O_APPEND
,
0o
755
)
os
.
O_APPEND
,
FilePermission
.
mode_
755
)
with
os
.
fdopen
(
device_log_file_open
,
"a"
)
as
file_name
:
for
test_bin
in
copy_list
:
if
not
test_bin
.
endswith
(
".run-test"
):
...
...
src/xdevice/_core/environment/dmlib_lite.py
浏览文件 @
bb55bc86
...
...
@@ -61,8 +61,8 @@ def check_open_source_test(result_output):
def
check_read_test_end
(
result
=
None
,
input_command
=
None
):
temp_result
=
result
.
replace
(
"
\n
"
,
""
)
if
input_command
not
in
temp_result
:
return
False
#
if input_command not in temp_result:
#
return False
index
=
result
.
find
(
input_command
)
+
len
(
input_command
)
result_output
=
result
[
index
:]
if
input_command
.
startswith
(
"./"
):
...
...
@@ -87,8 +87,10 @@ def check_read_test_end(result=None, input_command=None):
error_no
=
"00402"
)
raise
LiteDeviceExecuteCommandError
(
"execute file not exist"
,
error_no
=
"00402"
)
elif
input_command
.
startswith
(
"zcat"
):
return
False
else
:
if
"OHOS #"
in
result_output
or
"
Linux
"
in
result_output
:
if
"OHOS #"
in
result_output
or
"
#
"
in
result_output
:
if
input_command
==
"reboot"
or
input_command
==
"reset"
:
return
False
if
input_command
.
startswith
(
"mount"
):
...
...
@@ -187,12 +189,12 @@ class LiteHelper:
status
=
True
from
xdevice
import
Scheduler
while
time
.
time
()
-
start_time
<
timeout
:
data
=
com
.
readline
().
decode
(
'gbk'
,
errors
=
'ignore'
)
data
=
PATTERN
.
sub
(
''
,
data
).
replace
(
"
\r
"
,
""
)
result
=
"{}{}"
.
format
(
result
,
data
)
if
command
in
result
or
linux_end_command
in
result
:
break
#
while time.time() - start_time < timeout:
#
data = com.readline().decode('gbk', errors='ignore')
#
data = PATTERN.sub('', data).replace("\r", "")
#
result = "{}{}".format(result, data)
#
if command in result or linux_end_command in result:
#
break
while
time
.
time
()
-
start_time
<
timeout
:
if
not
Scheduler
.
is_execute
:
...
...
src/xdevice/_core/testkit/kit_lite.py
浏览文件 @
bb55bc86
...
...
@@ -44,6 +44,7 @@ from _core.utils import get_local_ip
from
_core.utils
import
get_test_component_version
from
_core.exception
import
LiteDeviceConnectError
from
_core.constants
import
DeviceLabelType
from
_core.constants
import
FilePermission
from
_core.environment.manager_env
import
DeviceAllocationState
...
...
@@ -194,9 +195,8 @@ class MountKit(ITestKit):
"mount nfs_ip:nfs_directory device"
"_directory nfs"
]
linux_commands
=
[
"cd /%s"
%
"storage"
,
"fuser -k /%s/%s"
%
(
"storage"
,
"device_directory"
),
"umount -f /%s/%s"
%
(
"storage"
,
"device_directory"
),
"
mount -t nfs -o nolock -o tc
p nfs_ip:nfs_directory "
"
toybox mount -t nfs -o nolock,addr=nfs_i
p nfs_ip:nfs_directory "
"/%s/%s"
%
(
"storage"
,
"device_directory"
),
"chmod 755 -R /%s/%s"
%
(
"storage"
,
"device_directory"
)]
...
...
@@ -244,8 +244,15 @@ class MountKit(ITestKit):
timeout
=
timeout
)
if
status
:
break
LOG
.
info
(
"mount failed,try "
if
"already mounted"
in
result
:
LOG
.
info
(
"{} is mounted"
.
format
(
target
))
break
LOG
.
info
(
"Mount failed,try "
"again {} time"
.
format
(
mount_time
))
if
mount_time
==
3
:
raise
LiteDeviceMountError
(
"Failed to mount the "
"device[00402]"
,
error_no
=
"00402"
)
else
:
result
,
status
,
_
=
device
.
execute_command_with_timeout
(
command
=
command
,
case_type
=
case_type
,
timeout
=
timeout
)
...
...
@@ -365,9 +372,6 @@ class MountKit(ITestKit):
device
.
execute_command_with_timeout
(
command
=
"cd /storage"
,
timeout
=
1
)
for
mounted_dir
in
self
.
mounted_dir
:
device
.
execute_command_with_timeout
(
command
=
"fuser -k {}"
.
format
(
mounted_dir
),
timeout
=
2
)
device
.
execute_command_with_timeout
(
command
=
"umount -f "
"/storage{}"
.
format
(
mounted_dir
),
...
...
@@ -514,7 +518,8 @@ class RootFsKit(ITestKit):
hash_file_path
=
os
.
path
.
join
(
report_path
,
hash_file_name
)
# write result to file
hash_file_path_open
=
os
.
open
(
hash_file_path
,
os
.
O_WRONLY
|
os
.
O_CREAT
|
os
.
O_APPEND
,
0o755
)
os
.
O_CREAT
|
os
.
O_APPEND
,
FilePermission
.
mode_755
)
with
os
.
fdopen
(
hash_file_path_open
,
mode
=
"w"
)
as
hash_file
:
hash_file
.
write
(
result
)
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录