Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Test Xdevice
提交
0ff5b371
T
Test Xdevice
项目概览
OpenHarmony
/
Test Xdevice
大约 1 年 前同步成功
通知
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,发现更多精彩内容 >>
提交
0ff5b371
编写于
4月 07, 2021
作者:
O
openharmony_ci
提交者:
Gitee
4月 07, 2021
浏览文件
操作
浏览文件
下载
差异文件
!10 解决xts同子系统多用例概率并发失败问题
Merge pull request !10 from alex_hold/master
上级
1ec9693c
45ebd243
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
54 addition
and
20 deletion
+54
-20
src/xdevice/_core/driver/drivers_lite.py
src/xdevice/_core/driver/drivers_lite.py
+11
-3
src/xdevice/_core/environment/dmlib_lite.py
src/xdevice/_core/environment/dmlib_lite.py
+10
-7
src/xdevice/_core/testkit/kit_lite.py
src/xdevice/_core/testkit/kit_lite.py
+33
-10
未找到文件。
src/xdevice/_core/driver/drivers_lite.py
浏览文件 @
0ff5b371
...
@@ -266,7 +266,9 @@ class CppTestDriver(IDriver):
...
@@ -266,7 +266,9 @@ class CppTestDriver(IDriver):
command
=
collect_test_command
,
command
=
collect_test_command
,
case_type
=
DeviceTestType
.
cpp_test_lite
,
case_type
=
DeviceTestType
.
cpp_test_lite
,
timeout
=
15
,
receiver
=
None
)
timeout
=
15
,
receiver
=
None
)
if
"not mount properly, Test Stop"
in
result
:
tests
=
[]
return
tests
tests
=
self
.
read_nfs_xml
(
request
,
self
.
config
.
device_xml_path
)
tests
=
self
.
read_nfs_xml
(
request
,
self
.
config
.
device_xml_path
)
self
.
delete_device_xml
(
request
,
self
.
config
.
device_xml_path
)
self
.
delete_device_xml
(
request
,
self
.
config
.
device_xml_path
)
return
tests
return
tests
...
@@ -850,6 +852,7 @@ class BuildOnlyTestDriver(IDriver):
...
@@ -850,6 +852,7 @@ class BuildOnlyTestDriver(IDriver):
self
.
config
.
device
=
request
.
config
.
environment
.
devices
[
0
]
self
.
config
.
device
=
request
.
config
.
environment
.
devices
[
0
]
self
.
file_name
=
request
.
root
.
source
.
test_name
self
.
file_name
=
request
.
root
.
source
.
test_name
self
.
config_file
=
request
.
root
.
source
.
config_file
self
.
config_file
=
request
.
root
.
source
.
config_file
self
.
testcases_path
=
request
.
config
.
testcases_path
file_path
=
self
.
_get_log_file
()
file_path
=
self
.
_get_log_file
()
result_list
=
self
.
_get_result_list
(
file_path
)
result_list
=
self
.
_get_result_list
(
file_path
)
if
len
(
result_list
)
==
0
:
if
len
(
result_list
)
==
0
:
...
@@ -880,7 +883,7 @@ class BuildOnlyTestDriver(IDriver):
...
@@ -880,7 +883,7 @@ class BuildOnlyTestDriver(IDriver):
@
classmethod
@
classmethod
def
_get_result_list
(
cls
,
file_path
):
def
_get_result_list
(
cls
,
file_path
):
result_list
=
list
()
result_list
=
list
()
for
root_path
,
_
,
file_names
in
os
.
walk
(
file_path
):
for
root_path
,
dirs_path
,
file_names
in
os
.
walk
(
file_path
):
for
file_name
in
file_names
:
for
file_name
in
file_names
:
if
file_name
==
"logfile"
:
if
file_name
==
"logfile"
:
result_list
.
append
(
os
.
path
.
join
(
root_path
,
file_name
))
result_list
.
append
(
os
.
path
.
join
(
root_path
,
file_name
))
...
@@ -890,7 +893,12 @@ class BuildOnlyTestDriver(IDriver):
...
@@ -890,7 +893,12 @@ class BuildOnlyTestDriver(IDriver):
json_config
=
JsonParser
(
self
.
config_file
)
json_config
=
JsonParser
(
self
.
config_file
)
log_path
=
get_config_value
(
'log_path'
,
json_config
.
get_driver
(),
log_path
=
get_config_value
(
'log_path'
,
json_config
.
get_driver
(),
False
)
False
)
file_path
=
get_file_absolute_path
(
log_path
)
log_path
=
str
(
log_path
.
replace
(
"/"
,
""
,
1
))
if
log_path
.
startswith
(
"/"
)
else
str
(
log_path
)
LOG
.
debug
(
"The log path is:%s"
%
log_path
)
file_path
=
get_file_absolute_path
(
log_path
,
paths
=
[
self
.
testcases_path
])
LOG
.
debug
(
"The file path is:%s"
%
file_path
)
return
file_path
return
file_path
def
__result__
(
self
):
def
__result__
(
self
):
...
...
src/xdevice/_core/environment/dmlib_lite.py
浏览文件 @
0ff5b371
...
@@ -15,7 +15,6 @@
...
@@ -15,7 +15,6 @@
# See the License for the specific language governing permissions and
# See the License for the specific language governing permissions and
# limitations under the License.
# limitations under the License.
#
#
import
json
import
json
import
time
import
time
import
re
import
re
...
@@ -26,7 +25,6 @@ from _core.exception import LiteDeviceTimeout
...
@@ -26,7 +25,6 @@ from _core.exception import LiteDeviceTimeout
from
_core.exception
import
LiteDeviceConnectError
from
_core.exception
import
LiteDeviceConnectError
from
_core.exception
import
LiteDeviceExecuteCommandError
from
_core.exception
import
LiteDeviceExecuteCommandError
from
_core.logger
import
platform_logger
from
_core.logger
import
platform_logger
from
_core.utils
import
convert_port
__all__
=
[
"generate_report"
,
"LiteHelper"
]
__all__
=
[
"generate_report"
,
"LiteHelper"
]
...
@@ -37,6 +35,8 @@ CPP_ERR_MESSAGE = "[ERR]No such file or directory: "
...
@@ -37,6 +35,8 @@ CPP_ERR_MESSAGE = "[ERR]No such file or directory: "
CTEST_STANDARD_SIGN
=
"Start to run test suite"
CTEST_STANDARD_SIGN
=
"Start to run test suite"
AT_CMD_ENDS
=
"OK"
AT_CMD_ENDS
=
"OK"
CTEST_END_SIGN
=
"All the test suites finished"
CTEST_END_SIGN
=
"All the test suites finished"
CPP_TEST_STOP_SIGN
=
"Test Stop"
CPP_TEST_MOUNT_SIGN
=
"not mount properly"
_START_JSUNIT_RUN_MARKER
=
"[start] start run suites"
_START_JSUNIT_RUN_MARKER
=
"[start] start run suites"
_END_JSUNIT_RUN_MARKER
=
"[end] run suites end"
_END_JSUNIT_RUN_MARKER
=
"[end] run suites end"
...
@@ -76,7 +76,10 @@ def check_read_test_end(result=None, input_command=None):
...
@@ -76,7 +76,10 @@ def check_read_test_end(result=None, input_command=None):
if
result_output
.
find
(
INSTALL_END_MARKER
)
!=
-
1
:
if
result_output
.
find
(
INSTALL_END_MARKER
)
!=
-
1
:
return
True
return
True
if
(
result_output
.
find
(
CPP_TEST_MOUNT_SIGN
)
!=
-
1
and
result_output
.
find
(
CPP_TEST_STOP_SIGN
)
!=
-
1
):
LOG
.
info
(
"find test stop"
)
return
True
if
"%s%s"
%
(
CPP_ERR_MESSAGE
,
input_command
[
2
:])
in
result_output
:
if
"%s%s"
%
(
CPP_ERR_MESSAGE
,
input_command
[
2
:])
in
result_output
:
LOG
.
error
(
"execute file not exist, result is %s"
%
result_output
,
LOG
.
error
(
"execute file not exist, result is %s"
%
result_output
,
error_no
=
"00402"
)
error_no
=
"00402"
)
...
@@ -143,7 +146,8 @@ class LiteHelper:
...
@@ -143,7 +146,8 @@ class LiteHelper:
expect_result
=
[
bytes
(
CPP_TEST_STANDARD_SIGN
,
encoding
=
"utf8"
),
expect_result
=
[
bytes
(
CPP_TEST_STANDARD_SIGN
,
encoding
=
"utf8"
),
bytes
(
CPP_SYS_STANDARD_SIGN
,
encoding
=
"utf8"
),
bytes
(
CPP_SYS_STANDARD_SIGN
,
encoding
=
"utf8"
),
bytes
(
CPP_TEST_END_SIGN
,
encoding
=
"utf8"
)]
bytes
(
CPP_TEST_END_SIGN
,
encoding
=
"utf8"
),
bytes
(
CPP_TEST_STOP_SIGN
,
encoding
=
"utf8"
)]
while
time
.
time
()
-
start_time
<
timeout
:
while
time
.
time
()
-
start_time
<
timeout
:
if
not
Scheduler
.
is_execute
:
if
not
Scheduler
.
is_execute
:
raise
ExecuteTerminate
(
"Execute terminate"
,
error_no
=
"00300"
)
raise
ExecuteTerminate
(
"Execute terminate"
,
error_no
=
"00300"
)
...
@@ -274,7 +278,7 @@ class LiteHelper:
...
@@ -274,7 +278,7 @@ class LiteHelper:
error_no
=
"00402"
)
error_no
=
"00402"
)
LOG
.
info
(
"local_%s execute command shell %s with timeout %ss"
%
LOG
.
info
(
"local_%s execute command shell %s with timeout %ss"
%
(
co
nvert_port
(
com
.
port
)
,
command
,
str
(
timeout
)))
(
co
m
.
port
,
command
,
str
(
timeout
)))
if
isinstance
(
command
,
str
):
if
isinstance
(
command
,
str
):
command
=
command
.
encode
(
"utf-8"
)
command
=
command
.
encode
(
"utf-8"
)
...
@@ -297,8 +301,7 @@ class LiteHelper:
...
@@ -297,8 +301,7 @@ class LiteHelper:
error_no
=
"00402"
)
error_no
=
"00402"
)
LOG
.
info
(
LOG
.
info
(
"local_%s execute command shell %s"
%
(
convert_port
(
com
.
port
),
"local_%s execute command shell %s"
%
(
com
.
port
,
command
))
command
))
command
=
command
.
encode
(
"utf-8"
)
command
=
command
.
encode
(
"utf-8"
)
if
command
[
-
2
:]
!=
b
"
\r\n
"
:
if
command
[
-
2
:]
!=
b
"
\r\n
"
:
command
=
command
.
rstrip
()
+
b
'
\r\n
'
command
=
command
.
rstrip
()
+
b
'
\r\n
'
...
...
src/xdevice/_core/testkit/kit_lite.py
浏览文件 @
0ff5b371
...
@@ -24,6 +24,7 @@ import subprocess
...
@@ -24,6 +24,7 @@ import subprocess
import
shutil
import
shutil
import
platform
import
platform
import
glob
import
glob
import
time
from
_core.logger
import
platform_logger
from
_core.logger
import
platform_logger
from
_core.plugin
import
Plugin
from
_core.plugin
import
Plugin
...
@@ -234,10 +235,20 @@ class MountKit(ITestKit):
...
@@ -234,10 +235,20 @@ class MountKit(ITestKit):
replace
(
"nfs_directory"
,
linux_directory
).
replace
(
replace
(
"nfs_directory"
,
linux_directory
).
replace
(
"device_directory"
,
target
).
replace
(
"//"
,
"/"
)
"device_directory"
,
target
).
replace
(
"//"
,
"/"
)
timeout
=
15
if
command
.
startswith
(
"mount"
)
else
1
timeout
=
15
if
command
.
startswith
(
"mount"
)
else
1
result
,
status
,
_
=
device
.
execute_command_with_timeout
(
command
=
command
,
case_type
=
case_type
,
timeout
=
timeout
)
if
command
.
startswith
(
"mount"
):
if
command
.
startswith
(
"mount"
):
self
.
mounted_dir
.
add
(
target
)
self
.
mounted_dir
.
add
(
target
)
for
mount_time
in
range
(
1
,
4
):
result
,
status
,
_
=
device
.
\
execute_command_with_timeout
(
command
=
command
,
case_type
=
case_type
,
timeout
=
timeout
)
if
status
:
break
LOG
.
info
(
"mount failed,try "
"again {} time"
.
format
(
mount_time
))
else
:
result
,
status
,
_
=
device
.
execute_command_with_timeout
(
command
=
command
,
case_type
=
case_type
,
timeout
=
timeout
)
LOG
.
info
(
'prepare environment success'
)
LOG
.
info
(
'prepare environment success'
)
def
__setup__
(
self
,
device
,
**
kwargs
):
def
__setup__
(
self
,
device
,
**
kwargs
):
...
@@ -303,6 +314,12 @@ class MountKit(ITestKit):
...
@@ -303,6 +314,12 @@ class MountKit(ITestKit):
if
(
str
(
get_local_ip
())
==
linux_host
)
and
(
if
(
str
(
get_local_ip
())
==
linux_host
)
and
(
linux_directory
==
(
"/data%s"
%
testcases_dir
)):
linux_directory
==
(
"/data%s"
%
testcases_dir
)):
return
return
ip
=
remote_info
.
get
(
"ip"
,
""
)
port
=
remote_info
.
get
(
"port"
,
""
)
remote_dir
=
remote_info
.
get
(
"dir"
,
""
)
if
not
ip
or
not
port
or
not
remote_dir
:
LOG
.
warning
(
"nfs server's ip or port or dir is empty"
)
return
for
_file
in
file_local_paths
:
for
_file
in
file_local_paths
:
# remote copy
# remote copy
LOG
.
info
(
"Trying to copy the file from {} to nfs server"
.
LOG
.
info
(
"Trying to copy the file from {} to nfs server"
.
...
@@ -310,8 +327,7 @@ class MountKit(ITestKit):
...
@@ -310,8 +327,7 @@ class MountKit(ITestKit):
if
not
is_remote
.
lower
()
==
"false"
:
if
not
is_remote
.
lower
()
==
"false"
:
try
:
try
:
import
paramiko
import
paramiko
client
=
paramiko
.
Transport
((
remote_info
.
get
(
"ip"
),
client
=
paramiko
.
Transport
(
ip
,
int
(
port
))
int
(
remote_info
.
get
(
"port"
))))
client
.
connect
(
username
=
remote_info
.
get
(
"username"
),
client
.
connect
(
username
=
remote_info
.
get
(
"username"
),
password
=
remote_info
.
get
(
"password"
))
password
=
remote_info
.
get
(
"password"
))
sftp
=
paramiko
.
SFTPClient
.
from_transport
(
client
)
sftp
=
paramiko
.
SFTPClient
.
from_transport
(
client
)
...
@@ -362,12 +378,19 @@ class MountKit(ITestKit):
...
@@ -362,12 +378,19 @@ class MountKit(ITestKit):
else
:
else
:
device
.
execute_command_with_timeout
(
command
=
"cd /"
,
timeout
=
1
)
device
.
execute_command_with_timeout
(
command
=
"cd /"
,
timeout
=
1
)
for
mounted_dir
in
self
.
mounted_dir
:
for
mounted_dir
in
self
.
mounted_dir
:
device
.
execute_command_with_timeout
(
command
=
"umount {}"
.
for
mount_time
in
range
(
1
,
3
):
format
(
mounted_dir
),
result
,
status
,
_
=
device
.
execute_command_with_timeout
(
timeout
=
2
)
command
=
"umount {}"
.
format
(
mounted_dir
),
device
.
execute_command_with_timeout
(
command
=
"rm -r {}"
.
timeout
=
2
)
format
(
mounted_dir
),
if
status
:
timeout
=
1
)
break
LOG
.
info
(
"umount failed,try "
"again {} time"
.
format
(
mount_time
))
time
.
sleep
(
1
)
if
result
.
find
(
"Resource busy"
)
==
-
1
:
device
.
execute_command_with_timeout
(
command
=
"rm -r {}"
.
format
(
mounted_dir
)
,
timeout
=
1
)
def
copy_file_as_temp
(
original_file
,
str_length
):
def
copy_file_as_temp
(
original_file
,
str_length
):
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录