Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openeuler
oec-hardware
提交
0c3fe3cb
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,发现更多精彩内容 >>
提交
0c3fe3cb
编写于
6月 28, 2020
作者:
C
cuixucui
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Code specification rectification
上级
71eb5cb5
变更
12
隐藏空白更改
内联
并排
Showing
12 changed file
with
54 addition
and
54 deletion
+54
-54
hwcompatible/client.py
hwcompatible/client.py
+10
-11
hwcompatible/document.py
hwcompatible/document.py
+1
-1
hwcompatible/job.py
hwcompatible/job.py
+4
-4
hwcompatible/test.py
hwcompatible/test.py
+1
-1
tests/acpi/acpi.py
tests/acpi/acpi.py
+1
-1
tests/cdrom/cdrom.py
tests/cdrom/cdrom.py
+16
-13
tests/cpufreq/cal.py
tests/cpufreq/cal.py
+2
-1
tests/disk/disk.py
tests/disk/disk.py
+12
-13
tests/memory/memory.py
tests/memory/memory.py
+1
-2
tests/network/infiniband.py
tests/network/infiniband.py
+0
-5
tests/nvme/nvme.py
tests/nvme/nvme.py
+0
-2
tests/tape/tape.py
tests/tape/tape.py
+6
-0
未找到文件。
hwcompatible/client.py
浏览文件 @
0c3fe3cb
...
...
@@ -27,24 +27,24 @@ class Client(object):
"""
upload client
"""
def
__init__
(
self
,
host
,
id
):
def
__init__
(
self
,
host
,
oec_
id
):
self
.
host
=
host
self
.
id
=
id
self
.
id
=
oec_
id
self
.
form
=
{}
def
upload
(
self
,
file
,
server
=
'localhost'
):
def
upload
(
self
,
file
s
,
server
=
'localhost'
):
"""
upload client request
:param file:
:param file
s
:
:param server:
:return:
"""
filename
=
os
.
path
.
basename
(
file
)
filename
=
os
.
path
.
basename
(
file
s
)
try
:
job
=
filename
.
split
(
'.'
)[
0
]
with
open
(
file
,
'rb'
)
as
f
:
with
open
(
file
s
,
'rb'
)
as
f
:
filetext
=
base64
.
b64encode
(
f
.
read
())
except
Exception
as
e
:
except
IOError
as
e
:
print
(
e
)
return
False
...
...
@@ -70,7 +70,7 @@ class Client(object):
print
(
"Error: upload failed, %s"
%
res
.
msg
)
return
False
return
True
except
Exception
as
e
:
except
HTTPError
as
e
:
print
(
e
)
return
False
...
...
@@ -78,6 +78,5 @@ class Client(object):
if
__name__
==
'__main__'
:
c
=
Client
(
' Taishan 2280'
,
' Testid-123523'
)
import
sys
file
=
sys
.
argv
[
1
]
c
.
upload
(
file
)
file_name
=
sys
.
argv
[
1
]
c
.
upload
(
file_name
)
hwcompatible/document.py
浏览文件 @
0c3fe3cb
...
...
@@ -15,7 +15,7 @@
import
json
from
.commandUI
import
CommandUI
from
.command
import
Command
,
CertCommandError
from
.command
import
Command
from
.device
import
Device
from
.sysinfo
import
SysInfo
from
.env
import
CertEnv
...
...
hwcompatible/job.py
浏览文件 @
0c3fe3cb
...
...
@@ -56,7 +56,6 @@ class Job(object):
"""
discover test
:param testname:
:param device:
:param subtests_filter:
:return:
"""
...
...
@@ -84,7 +83,7 @@ class Job(object):
for
thing
in
dir
(
module
):
test_class
=
getattr
(
module
,
thing
)
try
:
from
types
import
ClassType
as
c
t
from
types
import
ClassType
as
c
lasstype
except
ImportError
:
ct
=
type
if
isinstance
(
test_class
,
ct
)
and
issubclass
(
test_class
,
Test
):
...
...
@@ -111,7 +110,7 @@ class Job(object):
self
.
test_suite
=
[]
for
test
in
self
.
test_factory
:
if
test
[
"run"
]:
testclass
=
self
.
discover
(
test
[
"name"
],
test
[
"device"
],
subtests_filter
)
testclass
=
self
.
discover
(
test
[
"name"
],
subtests_filter
)
if
testclass
:
testcase
=
dict
()
testcase
[
"test"
]
=
testclass
...
...
@@ -165,6 +164,8 @@ class Job(object):
name
=
testcase
[
"name"
]
+
"-"
+
testcase
[
"device"
].
get_name
()
logname
=
name
+
".log"
reboot
=
None
test
=
None
logger
=
None
try
:
test
=
testcase
[
"test"
]
logger
=
Logger
(
logname
,
self
.
job_id
,
sys
.
stdout
,
sys
.
stderr
)
...
...
@@ -253,4 +254,3 @@ class Job(object):
for
testcase
in
self
.
test_suite
:
if
test
[
"name"
]
==
testcase
[
"name"
]
and
test
[
"device"
].
path
==
testcase
[
"device"
].
path
:
test
[
"status"
]
=
testcase
[
"status"
]
hwcompatible/test.py
浏览文件 @
0c3fe3cb
...
...
@@ -17,7 +17,7 @@ class Test(object):
"""
Test set template
"""
def
__init__
(
self
,
name
=
None
):
def
__init__
(
self
):
self
.
pri
=
0
self
.
requirements
=
list
()
self
.
reboot
=
False
...
...
tests/acpi/acpi.py
浏览文件 @
0c3fe3cb
...
...
@@ -31,4 +31,4 @@ class AcpiTest(Test):
return
True
except
CertCommandError
as
e
:
print
(
e
)
return
False
\ No newline at end of file
return
False
tests/cdrom/cdrom.py
浏览文件 @
0c3fe3cb
...
...
@@ -144,11 +144,12 @@ class CDRomTest(Test):
else
:
print
(
"Blanking ..."
)
sys
.
stdout
.
flush
()
blankCommand
=
Command
(
"cdrecord -v dev=%s blank=fast"
%
devname
).
echo
()
# blankCommand = Command("cdrecord -v dev=%s blank=fast" % devname).echo()
Command
(
"cdrecord -v dev=%s blank=fast"
%
devname
).
echo
()
self
.
reload_disc
(
devname
)
sys
.
stdout
.
flush
()
return
self
.
write_test
()
except
CertCommandError
as
e
:
except
CertCommandError
:
return
False
def
write_test
(
self
):
...
...
@@ -165,15 +166,17 @@ class CDRomTest(Test):
sys
.
stdout
.
flush
()
return
True
else
:
write_opts
=
"-sao"
write_opts
=
"-sao"
try
:
command
=
Command
(
"cdrecord dev=%s -checkdrive"
%
devname
)
modes
=
command
.
get_str
(
regex
=
"^Supported modes[^:]*:(?P<modes>.*$)"
,
regex_group
=
"modes"
,
single_line
=
False
,
ignore_errors
=
True
)
modes
=
command
.
get_str
(
regex
=
"^Supported modes[^:]*:(?P<modes>.*$)"
,
regex_group
=
"modes"
,
single_line
=
False
,
ignore_errors
=
True
)
if
"TAO"
in
modes
:
write_opts
=
"-tao"
write_opts
=
"-tao"
if
"SAO"
in
modes
:
write_opts
=
"-sao"
flags
=
command
.
get_str
(
regex
=
"^Driver flags[^:]*:(?P<flags>.*$)"
,
regex_group
=
"flags"
,
single_line
=
False
,
ignore_errors
=
True
)
write_opts
=
"-sao"
flags
=
command
.
get_str
(
regex
=
"^Driver flags[^:]*:(?P<flags>.*$)"
,
regex_group
=
"flags"
,
single_line
=
False
,
ignore_errors
=
True
)
if
"BURNFREE"
in
flags
:
write_opts
+=
" driveropts=burnfree"
except
CertCommandError
as
e
:
...
...
@@ -182,11 +185,12 @@ class CDRomTest(Test):
size
=
Command
(
"mkisofs -quiet -R -print-size %s "
%
self
.
test_dir
).
get_str
()
blocks
=
int
(
size
)
Command
(
"mkisofs -quiet -R %s | cdrecord -v %s dev=%s fs=32M tsize=%ss -"
%
(
self
.
test_dir
,
write_opts
,
devname
,
blocks
)).
echo
()
Command
(
"mkisofs -quiet -R %s | cdrecord -v %s dev=%s fs=32M tsize=%ss -"
%
(
self
.
test_dir
,
write_opts
,
devname
,
blocks
)).
echo
()
self
.
reload_disc
(
devname
)
sys
.
stdout
.
flush
()
return
True
except
CertCommandError
as
e
:
except
CertCommandError
:
return
False
def
read_test
(
self
):
...
...
@@ -244,7 +248,7 @@ class CDRomTest(Test):
try
:
Command
(
"diff -r %s %s"
%
(
dir1
,
dir2
)).
run
()
return
True
except
CertCommandError
as
e
:
except
CertCommandError
:
print
(
"Error: file comparison failed."
)
return
False
...
...
@@ -263,17 +267,16 @@ class CDRomTest(Test):
Command
(
"eject %s"
%
device
).
run
()
print
(
"tray ejected."
)
sys
.
stdout
.
flush
()
except
CertCommandError
as
e
:
except
CertCommandError
:
pass
try
:
Command
(
"eject -t %s"
%
device
).
run
()
print
(
"tray auto-closed.
\n
"
)
sys
.
stdout
.
flush
()
except
CertCommandError
as
e
:
except
CertCommandError
:
print
(
"Could not auto-close the tray, please close the tray manually."
)
self
.
ui
.
prompt_confirm
(
"Done well?"
)
time
.
sleep
(
20
)
return
True
tests/cpufreq/cal.py
浏览文件 @
0c3fe3cb
...
...
@@ -20,7 +20,8 @@ def cal():
decimal
.
getcontext
().
prec
=
1000
one
=
decimal
.
Decimal
(
1
)
for
i
in
range
(
1000
):
j
=
(
i
*
one
).
sqrt
()
# j = (i * one).sqrt()
(
i
*
one
).
sqrt
()
if
__name__
==
'__main__'
:
...
...
tests/disk/disk.py
浏览文件 @
0c3fe3cb
...
...
@@ -14,14 +14,12 @@
import
os
import
sys
import
time
import
shutil
import
string
from
hwcompatible.test
import
Test
from
hwcompatible.command
import
Command
,
CertCommandError
from
hwcompatible.commandUI
import
CommandUI
from
hwcompatible.device
import
CertDevice
,
Device
from
hwcompatible.device
import
CertDevice
class
DiskTest
(
Test
):
...
...
@@ -32,7 +30,11 @@ class DiskTest(Test):
self
.
filesystems
=
[
"ext4"
]
self
.
ui
=
CommandUI
()
def
setup
(
self
):
def
setup
(
self
,
args
=
None
):
"""
The Setup before testing
:return:
"""
try
:
print
(
"Disk Info:"
)
Command
(
"fdisk -l"
).
echo
(
ignore_errors
=
True
)
...
...
@@ -63,7 +65,7 @@ class DiskTest(Test):
self
.
disks
.
append
(
"all"
)
disk
=
self
.
ui
.
prompt_edit
(
"Which disk would you like to test: "
,
self
.
disks
[
0
],
self
.
disks
)
return_code
=
True
if
disk
==
"all"
:
if
disk
==
"all"
:
for
disk
in
self
.
disks
[:
-
1
]:
if
not
self
.
raw_test
(
disk
):
return_code
=
False
...
...
@@ -126,9 +128,9 @@ class DiskTest(Test):
device
=
"/dev/"
+
disk
if
not
os
.
path
.
exists
(
device
):
print
(
"Error: device %s not exists."
%
device
)
proc_path
=
"/sys/block/"
+
disk
proc_path
=
"/sys/block/"
+
disk
if
not
os
.
path
.
exists
(
proc_path
):
proc_path
=
"/sys/block/*/"
+
disk
proc_path
=
"/sys/block/*/"
+
disk
size
=
Command
(
"cat %s/size"
%
proc_path
).
get_str
()
size
=
int
(
size
)
/
2
if
size
<=
0
:
...
...
@@ -160,9 +162,9 @@ class DiskTest(Test):
device
=
"/dev/"
+
disk
if
not
os
.
path
.
exists
(
device
):
print
(
"Error: device %s not exists."
%
device
)
proc_path
=
"/sys/block/"
+
disk
proc_path
=
"/sys/block/"
+
disk
if
not
os
.
path
.
exists
(
proc_path
):
proc_path
=
"/sys/block/*/"
+
disk
proc_path
=
"/sys/block/*/"
+
disk
size
=
Command
(
"cat %s/size"
%
proc_path
).
get_str
()
size
=
int
(
size
)
/
2
/
2
if
size
<=
0
:
...
...
@@ -219,8 +221,5 @@ class DiskTest(Test):
return
False
print
(
"
\n
"
)
sys
.
stdout
.
flush
()
bs
=
bs
*
2
bs
=
bs
*
2
return
True
tests/memory/memory.py
浏览文件 @
0c3fe3cb
...
...
@@ -36,10 +36,9 @@ class MemoryTest(Test):
self
.
retry_list
=
list
()
self
.
test_dir
=
os
.
path
.
dirname
(
os
.
path
.
realpath
(
__file__
))
def
setup
(
self
,
args
=
None
):
def
setup
(
self
):
"""
Initialization before test
:param args:
:return:
"""
self
.
get_memory
()
...
...
tests/network/infiniband.py
浏览文件 @
0c3fe3cb
...
...
@@ -12,11 +12,6 @@
# See the Mulan PSL v2 for more details.
# Create: 2020-04-01
import
os
import
argparse
from
hwcompatible.test
import
Test
from
hwcompatible.command
import
Command
from
rdma
import
RDMATest
...
...
tests/nvme/nvme.py
浏览文件 @
0c3fe3cb
...
...
@@ -17,7 +17,6 @@ import sys
import
argparse
from
hwcompatible.test
import
Test
from
hwcompatible.command
import
Command
,
CertCommandError
from
hwcompatible.device
import
CertDevice
,
Device
class
NvmeTest
(
Test
):
...
...
@@ -117,4 +116,3 @@ class NvmeTest(Test):
return
True
if
os
.
system
(
"pvs 2>/dev/null | grep -q '/dev/%s'"
%
disk
)
==
0
:
return
True
tests/tape/tape.py
浏览文件 @
0c3fe3cb
...
...
@@ -22,6 +22,12 @@ class TapeTest(Test):
"""
Tape test
"""
def
__init__
(
self
):
Test
.
__init__
(
self
)
self
.
args
=
None
self
.
device
=
None
self
.
tapeDevice
=
None
def
setup
(
self
,
args
=
None
):
"""
Initialization before test
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录