Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openeuler
oec-hardware
提交
b908d3bd
O
oec-hardware
项目概览
openeuler
/
oec-hardware
通知
4
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
O
oec-hardware
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
提交
b908d3bd
编写于
6月 22, 2020
作者:
C
cuixucui
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Rectification specification scanning
上级
9a4eb383
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
92 addition
and
18 deletion
+92
-18
hwcompatible/command.py
hwcompatible/command.py
+22
-2
hwcompatible/compatibility.py
hwcompatible/compatibility.py
+21
-16
server/server.py
server/server.py
+49
-0
未找到文件。
hwcompatible/command.py
浏览文件 @
b908d3bd
...
...
@@ -42,7 +42,7 @@ class Command:
stdin
=
subprocess
.
PIPE
,
stdout
=
subprocess
.
PIPE
,
stderr
=
subprocess
.
PIPE
,
encoding
=
'utf8'
)
encoding
=
'utf
-
8'
)
(
output
,
errors
)
=
self
.
pipe
.
communicate
()
if
output
:
#Strip new line character/s if any from the end of output string
...
...
@@ -64,7 +64,7 @@ class Command:
stdin
=
subprocess
.
PIPE
,
stdout
=
subprocess
.
PIPE
,
stderr
=
subprocess
.
PIPE
,
encoding
=
'utf8'
)
encoding
=
'utf
-
8'
)
def
run
(
self
,
ignore_errors
=
False
):
""" run the command
...
...
@@ -92,6 +92,10 @@ class Command:
return
def
print_output
(
self
):
'''
结果显示
:return:
'''
if
self
.
output
:
for
line
in
self
.
output
:
sys
.
stdout
.
write
(
line
)
...
...
@@ -99,6 +103,10 @@ class Command:
sys
.
stdout
.
flush
()
def
print_errors
(
self
):
'''
页面显示错误信息
:return:
'''
if
self
.
errors
:
for
line
in
self
.
errors
:
sys
.
stderr
.
write
(
line
)
...
...
@@ -106,14 +114,26 @@ class Command:
sys
.
stderr
.
flush
()
def
pid
(
self
):
'''
获取管道pid值
:return:
'''
if
self
.
pipe
:
return
self
.
pipe
.
pid
def
readline
(
self
):
'''
按行读取输出信息
:return
'''
if
self
.
pipe
:
return
self
.
pipe
.
stdout
.
readline
()
def
read
(
self
):
'''
执行命令,并读取结果
:return:
'''
self
.
pipe
=
subprocess
.
Popen
(
self
.
command
,
shell
=
True
,
stdout
=
subprocess
.
PIPE
,
stderr
=
subprocess
.
STDOUT
)
...
...
hwcompatible/compatibility.py
浏览文件 @
b908d3bd
...
...
@@ -127,7 +127,7 @@ class EulerCertification():
cwd
=
os
.
getcwd
()
os
.
chdir
(
os
.
path
.
dirname
(
doc_dir
))
dir_name
=
"oech-"
+
datetime
.
datetime
.
now
().
strftime
(
"%Y%m%d%H%M%S"
)
+
"-"
+
job
.
job_id
pack_name
=
dir_name
+
".tar"
pack_name
=
dir_name
+
".tar"
cmd
=
Command
(
"tar -cf %s %s"
%
(
pack_name
,
dir_name
))
try
:
os
.
rename
(
job
.
job_id
,
dir_name
)
...
...
@@ -175,6 +175,11 @@ class EulerCertification():
return
self
.
client
.
upload
(
path
,
server
)
def
get_tests
(
self
,
devices
):
'''
获取测试项
:param devices:
:return:
'''
nodevice
=
[
"cpufreq"
,
"memory"
,
"clock"
,
"profiler"
,
"system"
,
"stress"
,
"kdump"
,
"perf"
,
"acpi"
,
"watchdog"
]
ethernet
=
[
"ethernet"
]
infiniband
=
[
"infiniband"
]
...
...
@@ -215,9 +220,9 @@ class EulerCertification():
empty_device
=
Device
()
for
device
in
devices
:
if
device
.
get_property
(
"SUBSYSTEM"
)
==
"usb"
and
\
device
.
get_property
(
"ID_VENDOR_FROM_DATABASE"
)
==
"Linux Foundation"
and
\
(
"2."
in
device
.
get_property
(
"ID_MODEL_FROM_DATABASE"
)
or
\
"3."
in
device
.
get_property
(
"ID_MODEL_FROM_DATABASE"
)):
device
.
get_property
(
"ID_VENDOR_FROM_DATABASE"
)
==
"Linux Foundation"
and
\
(
"2."
in
device
.
get_property
(
"ID_MODEL_FROM_DATABASE"
)
or
\
"3."
in
device
.
get_property
(
"ID_MODEL_FROM_DATABASE"
)):
sort_devices
[
"usb"
]
=
[
empty_device
]
continue
if
device
.
get_property
(
"PCI_CLASS"
)
==
"30000"
or
device
.
get_property
(
"PCI_CLASS"
)
==
"38000"
:
...
...
@@ -230,7 +235,7 @@ class EulerCertification():
sort_devices
[
"tape"
]
=
[
device
]
continue
if
(
device
.
get_property
(
"DEVTYPE"
)
==
"disk"
and
not
device
.
get_property
(
"ID_TYPE"
))
or
\
device
.
get_property
(
"ID_TYPE"
)
==
"disk"
:
device
.
get_property
(
"ID_TYPE"
)
==
"disk"
:
if
"nvme"
in
device
.
get_property
(
"DEVPATH"
):
sort_devices
[
"disk"
]
=
[
empty_device
]
try
:
...
...
@@ -268,7 +273,7 @@ class EulerCertification():
continue
if
device
.
get_property
(
"ID_CDROM"
)
==
"1"
:
types
=
[
"DVD_RW"
,
"DVD_PLUS_RW"
,
"DVD_R"
,
"DVD_PLUS_R"
,
"DVD"
,
\
"BD_RE"
,
"BD_R"
,
"BD"
,
"CD_RW"
,
"CD_R"
,
"CD"
]
"BD_RE"
,
"BD_R"
,
"BD"
,
"CD_RW"
,
"CD_R"
,
"CD"
]
for
dev_type
in
types
:
if
device
.
get_property
(
"ID_CDROM_"
+
dev_type
)
==
"1"
:
try
:
...
...
@@ -318,11 +323,11 @@ class EulerCertification():
continue
if
num
>
0
and
num
<=
len
(
self
.
test_factory
):
self
.
test_factory
[
num
-
1
][
"run"
]
=
not
self
.
test_factory
[
num
-
1
][
"run"
]
self
.
test_factory
[
num
-
1
][
"run"
]
=
not
self
.
test_factory
[
num
-
1
][
"run"
]
continue
def
show_tests
(
self
):
print
(
"
\033
[1;35m"
+
"No."
.
ljust
(
4
)
+
"Run-Now?"
.
ljust
(
10
)
\
print
(
"
\033
[1;35m"
+
"No."
.
ljust
(
4
)
+
"Run-Now?"
.
ljust
(
10
)
\
+
"Status"
.
ljust
(
8
)
+
"Class"
.
ljust
(
14
)
+
"Device
\033
[0m"
)
num
=
0
for
test
in
self
.
test_factory
:
...
...
@@ -340,17 +345,17 @@ class EulerCertification():
num
=
num
+
1
if
status
==
"PASS"
:
print
(
"%-6d"
%
num
+
run
.
ljust
(
8
)
+
"
\033
[0;32mPASS
\033
[0m"
\
+
name
.
ljust
(
14
)
+
"%s"
%
device
)
print
(
"%-6d"
%
num
+
run
.
ljust
(
8
)
+
"
\033
[0;32mPASS
\033
[0m"
\
+
name
.
ljust
(
14
)
+
"%s"
%
device
)
elif
status
==
"FAIL"
:
print
(
"%-6d"
%
num
+
run
.
ljust
(
8
)
+
"
\033
[0;31mFAIL
\033
[0m"
\
+
name
.
ljust
(
14
)
+
"%s"
%
device
)
print
(
"%-6d"
%
num
+
run
.
ljust
(
8
)
+
"
\033
[0;31mFAIL
\033
[0m"
\
+
name
.
ljust
(
14
)
+
"%s"
%
device
)
elif
status
==
"Force"
:
print
(
"%-6d"
%
num
+
run
.
ljust
(
8
)
+
"
\033
[0;33mForce
\033
[0m"
\
+
name
.
ljust
(
14
)
+
"%s"
%
device
)
print
(
"%-6d"
%
num
+
run
.
ljust
(
8
)
+
"
\033
[0;33mForce
\033
[0m"
\
+
name
.
ljust
(
14
)
+
"%s"
%
device
)
else
:
print
(
"%-6d"
%
num
+
run
.
ljust
(
8
)
+
"
\033
[0;34mNotRun
\033
[0m"
\
+
name
.
ljust
(
14
)
+
"%s"
%
device
)
print
(
"%-6d"
%
num
+
run
.
ljust
(
8
)
+
"
\033
[0;34mNotRun
\033
[0m"
\
+
name
.
ljust
(
14
)
+
"%s"
%
device
)
def
choose_tests
(
self
):
for
test
in
self
.
test_factory
:
...
...
server/server.py
浏览文件 @
b908d3bd
...
...
@@ -73,6 +73,14 @@ def get_results():
@
app
.
route
(
'/results/<host>/<oec_id>/<job>'
)
def
get_job
(
host
,
oec_id
,
job
):
'''
获取job信息
:param host:
:param oec_id:
:param job:
:return:
'''
dir_job
=
os
.
path
.
join
(
dir_results
,
host
,
oec_id
,
job
)
json_info
=
os
.
path
.
join
(
dir_job
,
'compatibility.json'
)
json_results
=
os
.
path
.
join
(
dir_job
,
'factory.json'
)
...
...
@@ -88,6 +96,14 @@ def get_job(host, oec_id, job):
@
app
.
route
(
'/results/<host>/<oec_id>/<job>/devices/<interface>'
)
def
get_device
(
host
,
oec_id
,
job
,
interface
):
'''
获取硬件设备信息
:param host:
:param oec_id:
:param job:
:param interface:
:return:
'''
dir_job
=
os
.
path
.
join
(
dir_results
,
host
,
oec_id
,
job
)
json_results
=
os
.
path
.
join
(
dir_job
,
'factory.json'
)
try
:
...
...
@@ -105,6 +121,13 @@ def get_device(host, oec_id, job, interface):
@
app
.
route
(
'/results/<host>/<oec_id>/<job>/devices'
)
def
get_devices
(
host
,
oec_id
,
job
):
'''
获取设备信息
:param host:
:param oec_id:
:param job:
:return:
'''
dir_job
=
os
.
path
.
join
(
dir_results
,
host
,
oec_id
,
job
)
json_devices
=
os
.
path
.
join
(
dir_job
,
'device.json'
)
try
:
...
...
@@ -117,6 +140,13 @@ def get_devices(host, oec_id, job):
@
app
.
route
(
'/results/<host>/<oec_id>/<job>/attachment'
)
def
get_attachment
(
host
,
oec_id
,
job
):
'''
发送结果附件
:param host:
:param oec_id:
:param job:
:return:
'''
dir_job
=
os
.
path
.
join
(
dir_results
,
host
,
oec_id
,
job
)
attachment
=
dir_job
+
'.tar.gz'
filedir
=
os
.
path
.
dirname
(
attachment
)
...
...
@@ -126,6 +156,14 @@ def get_attachment(host, oec_id, job):
@
app
.
route
(
'/results/<host>/<oec_id>/<job>/logs/<name>'
)
def
get_log
(
host
,
oec_id
,
job
,
name
):
'''
获取日志
:param host:
:param oec_id:
:param job:
:param name:
:return:
'''
dir_job
=
os
.
path
.
join
(
dir_results
,
host
,
oec_id
,
job
)
logpath
=
os
.
path
.
join
(
dir_job
,
name
+
'.log'
)
if
not
os
.
path
.
exists
(
logpath
):
...
...
@@ -140,6 +178,13 @@ def get_log(host, oec_id, job, name):
@
app
.
route
(
'/results/<host>/<oec_id>/<job>/submit'
)
def
submit
(
host
,
oec_id
,
job
):
'''
提交测试结果
:param host:
:param oec_id:
:param job:
:return:
'''
dir_job
=
os
.
path
.
join
(
dir_results
,
host
,
oec_id
,
job
)
tar_job
=
dir_job
+
'.tar.gz'
json_cert
=
os
.
path
.
join
(
dir_job
,
'compatibility.json'
)
...
...
@@ -180,6 +225,10 @@ def submit(host, oec_id, job):
@
app
.
route
(
'/api/job/upload'
,
methods
=
[
'GET'
,
'POST'
])
def
upload_job
():
'''
上传job
:return:
'''
host
=
request
.
values
.
get
(
'host'
,
''
).
strip
().
replace
(
' '
,
'-'
)
oec_id
=
request
.
values
.
get
(
'id'
,
''
).
strip
().
replace
(
' '
,
'-'
)
job
=
request
.
values
.
get
(
'job'
,
''
).
strip
().
replace
(
' '
,
'-'
)
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录