Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openeuler
oec-hardware
提交
050833aa
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 搜索 >>
提交
050833aa
编写于
7月 01, 2020
作者:
C
cuixucui
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Modify exception capture method
上级
e5fb0586
变更
19
隐藏空白更改
内联
并排
Showing
19 changed file
with
72 addition
and
72 deletion
+72
-72
hwcompatible/client.py
hwcompatible/client.py
+2
-2
hwcompatible/compatibility.py
hwcompatible/compatibility.py
+4
-4
hwcompatible/device.py
hwcompatible/device.py
+1
-1
hwcompatible/document.py
hwcompatible/document.py
+3
-3
hwcompatible/job.py
hwcompatible/job.py
+2
-2
hwcompatible/reboot.py
hwcompatible/reboot.py
+2
-2
hwcompatible/sysinfo.py
hwcompatible/sysinfo.py
+1
-1
server/server.py
server/server.py
+8
-8
tests/acpi/acpi.py
tests/acpi/acpi.py
+2
-2
tests/cdrom/cdrom.py
tests/cdrom/cdrom.py
+5
-5
tests/cpufreq/cpufreq.py
tests/cpufreq/cpufreq.py
+9
-9
tests/disk/disk.py
tests/disk/disk.py
+2
-2
tests/ipmi/ipmi.py
tests/ipmi/ipmi.py
+3
-3
tests/kdump/kdump.py
tests/kdump/kdump.py
+2
-2
tests/memory/memory.py
tests/memory/memory.py
+3
-3
tests/network/network.py
tests/network/network.py
+11
-11
tests/network/rdma.py
tests/network/rdma.py
+5
-5
tests/nvme/nvme.py
tests/nvme/nvme.py
+2
-2
tests/system/system.py
tests/system/system.py
+5
-5
未找到文件。
hwcompatible/client.py
浏览文件 @
050833aa
...
...
@@ -44,7 +44,7 @@ class Client(object):
job
=
filename
.
split
(
'.'
)[
0
]
with
open
(
files
,
'rb'
)
as
f
:
filetext
=
base64
.
b64encode
(
f
.
read
())
except
IOError
as
e
:
except
Exception
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
HTTPError
as
e
:
except
Exception
as
e
:
print
(
e
)
return
False
...
...
hwcompatible/compatibility.py
浏览文件 @
050833aa
...
...
@@ -86,7 +86,7 @@ class EulerCertification(object):
reboot
.
clean
()
self
.
save
(
job
)
return
True
except
(
IOError
,
OSError
,
TypeError
)
as
e
:
except
Exception
as
e
:
print
(
e
)
return
False
...
...
@@ -100,7 +100,7 @@ class EulerCertification(object):
Command
(
"rm -rf %s"
%
CertEnv
.
certificationfile
).
run
()
Command
(
"rm -rf %s"
%
CertEnv
.
factoryfile
).
run
()
Command
(
"rm -rf %s"
%
CertEnv
.
devicefile
).
run
()
except
CertCommandError
as
e
:
except
Exception
as
e
:
print
(
e
)
return
False
return
True
...
...
@@ -324,7 +324,7 @@ class EulerCertification(object):
try
:
Command
(
"dmidecode"
).
get_str
(
"IPMI Device Information"
,
single_line
=
False
)
sort_devices
[
"ipmi"
]
=
[
empty_device
]
except
OSError
as
e
:
except
:
pass
return
sort_devices
...
...
@@ -361,7 +361,7 @@ class EulerCertification(object):
try
:
num
=
int
(
reply
)
except
ValueError
:
except
:
continue
if
num
>
0
and
num
<=
len
(
self
.
test_factory
):
...
...
hwcompatible/device.py
浏览文件 @
050833aa
...
...
@@ -73,7 +73,7 @@ class CertDevice(object):
properties
[
"INFO"
]
=
attribute
else
:
break
except
CertCommandError
as
e
:
except
Exception
as
e
:
print
(
"Warning: get devices fail"
)
print
(
e
)
self
.
devices
.
sort
(
key
=
lambda
k
:
k
.
path
)
...
...
hwcompatible/document.py
浏览文件 @
050833aa
...
...
@@ -37,7 +37,7 @@ class Document(object):
with
open
(
self
.
filename
,
"w+"
)
as
save_f
:
json
.
dump
(
self
.
document
,
save_f
,
indent
=
4
)
save_f
.
close
()
except
(
IOError
,
ValueError
)
as
e
:
except
Exception
as
e
:
print
(
"Error: doc save fail."
)
print
(
e
)
return
False
...
...
@@ -49,7 +49,7 @@ class Document(object):
self
.
document
=
json
.
load
(
load_f
)
load_f
.
close
()
return
True
except
(
IOError
,
ValueError
)
:
except
:
return
False
...
...
@@ -86,7 +86,7 @@ class CertDocument(Document):
self
.
document
[
key
]
=
value
else
:
break
except
OSError
as
e
:
except
Exception
as
e
:
print
(
"Error: get hardware info fail."
)
print
(
e
)
...
...
hwcompatible/job.py
浏览文件 @
050833aa
...
...
@@ -75,7 +75,7 @@ class Job(object):
sys
.
path
.
insert
(
0
,
dirpath
)
try
:
module
=
__import__
(
testname
,
globals
(),
locals
())
except
ImportError
as
e
:
except
Exception
as
e
:
print
(
"Error: module import failed for %s"
%
testname
)
print
(
e
)
return
None
...
...
@@ -183,7 +183,7 @@ class Job(object):
return_code
=
test
.
test
()
else
:
return_code
=
test
.
test
()
except
(
IOError
,
KeyError
,
AttributeError
)
as
e
:
except
Exception
as
e
:
print
(
e
)
return_code
=
False
...
...
hwcompatible/reboot.py
浏览文件 @
050833aa
...
...
@@ -73,7 +73,7 @@ class Reboot(object):
try
:
Command
(
"systemctl daemon-reload"
).
run_quiet
()
Command
(
"systemctl enable oech"
).
run_quiet
()
except
OSError
as
e
:
except
:
print
(
"Error: enable oech.service fail."
)
return
False
...
...
@@ -95,7 +95,7 @@ class Reboot(object):
self
.
job
.
job_id
=
self
.
reboot
[
"job_id"
]
self
.
job
.
subtests_filter
=
self
.
reboot
[
"rebootup"
]
time_reboot
=
datetime
.
datetime
.
strptime
(
self
.
reboot
[
"time"
],
"%Y%m%d%H%M%S"
)
except
KeyError
:
except
:
print
(
"Error: reboot file format not as expect."
)
return
False
...
...
hwcompatible/sysinfo.py
浏览文件 @
050833aa
...
...
@@ -43,7 +43,7 @@ class SysInfo(object):
f
=
open
(
filename
)
text
=
f
.
read
()
f
.
close
()
except
IOError
:
except
:
print
(
"Release file not found."
)
return
...
...
server/server.py
浏览文件 @
050833aa
...
...
@@ -89,7 +89,7 @@ def get_job(host, oec_id, job):
info
=
json
.
load
(
f
)
with
open
(
json_results
,
'r'
)
as
f
:
results
=
json
.
load
(
f
)
except
(
IOError
,
ValueError
)
:
except
Exception
as
e
:
abort
(
404
)
return
render_template
(
'job.html'
,
host
=
host
,
id
=
oec_id
,
job
=
job
,
info
=
info
,
results
=
results
)
...
...
@@ -109,7 +109,7 @@ def get_device(host, oec_id, job, interface):
try
:
with
open
(
json_results
,
'r'
)
as
f
:
results
=
json
.
load
(
f
)
except
(
IOError
,
ValueError
)
:
except
Exception
as
e
:
abort
(
404
)
for
testcase
in
results
:
device
=
testcase
.
get
(
'device'
)
...
...
@@ -133,7 +133,7 @@ def get_devices(host, oec_id, job):
try
:
with
open
(
json_devices
,
'r'
)
as
f
:
devices
=
json
.
load
(
f
)
except
(
IOError
,
ValueError
)
:
except
Exception
as
e
:
abort
(
404
)
return
render_template
(
'devices.html'
,
devices
=
devices
)
...
...
@@ -171,7 +171,7 @@ def get_log(host, oec_id, job, name):
try
:
with
open
(
logpath
,
'r'
)
as
f
:
log
=
f
.
read
().
split
(
'
\n
'
)
except
IOError
as
e
:
except
Exception
as
e
:
abort
(
404
)
return
render_template
(
'log.html'
,
name
=
name
,
log
=
log
)
...
...
@@ -193,7 +193,7 @@ def submit(host, oec_id, job):
cert
=
json
.
load
(
f
)
with
open
(
tar_job
,
'rb'
)
as
f
:
attachment
=
base64
.
b64encode
(
f
.
read
())
except
(
IOError
,
ValueError
)
as
e
:
except
Exception
as
e
:
print
(
e
)
abort
(
500
)
...
...
@@ -245,7 +245,7 @@ def upload_job():
with
open
(
tar_job
,
'wb'
)
as
f
:
f
.
write
(
base64
.
b64decode
(
filetext
))
os
.
system
(
"tar xf '%s' -C '%s'"
%
(
tar_job
,
os
.
path
.
dirname
(
dir_job
)))
except
(
IOError
,
OSError
)
as
e
:
except
Exception
as
e
:
print
(
e
)
abort
(
400
)
return
render_template
(
'upload.html'
,
host
=
host
,
id
=
oec_id
,
job
=
job
,
...
...
@@ -277,7 +277,7 @@ def upload_file():
try
:
with
open
(
filepath
,
'wb'
)
as
f
:
f
.
write
(
base64
.
b64decode
(
filetext
))
except
IOError
as
e
:
except
Exception
as
e
:
print
(
e
)
abort
(
400
)
return
render_template
(
'upload.html'
,
filename
=
filename
,
filetext
=
filetext
,
...
...
@@ -351,7 +351,7 @@ def __get_ib_dev_port(ib_server_ip):
ibport
=
str
(
ibport
)
return
ibdev
,
ibport
except
(
OSError
,
IndexError
,
ValueError
)
as
e
:
except
Exception
as
e
:
print
(
e
)
return
None
,
None
...
...
tests/acpi/acpi.py
浏览文件 @
050833aa
...
...
@@ -13,7 +13,7 @@
# Create: 2020-04-01
from
hwcompatible.test
import
Test
from
hwcompatible.command
import
Command
,
CertCommandError
from
hwcompatible.command
import
Command
class
AcpiTest
(
Test
):
...
...
@@ -29,6 +29,6 @@ class AcpiTest(Test):
try
:
Command
(
"acpidump"
).
echo
()
return
True
except
CertCommandError
as
e
:
except
Exception
as
e
:
print
(
e
)
return
False
tests/cdrom/cdrom.py
浏览文件 @
050833aa
...
...
@@ -149,7 +149,7 @@ class CDRomTest(Test):
self
.
reload_disc
(
devname
)
sys
.
stdout
.
flush
()
return
self
.
write_test
()
except
CertCommandError
:
except
CertCommandError
as
e
:
return
False
def
write_test
(
self
):
...
...
@@ -190,7 +190,7 @@ class CDRomTest(Test):
self
.
reload_disc
(
devname
)
sys
.
stdout
.
flush
()
return
True
except
CertCommandError
:
except
CertCommandError
as
e
:
return
False
def
read_test
(
self
):
...
...
@@ -248,7 +248,7 @@ class CDRomTest(Test):
try
:
Command
(
"diff -r %s %s"
%
(
dir1
,
dir2
)).
run
()
return
True
except
CertCommandError
:
except
CertCommandError
as
e
:
print
(
"Error: file comparison failed."
)
return
False
...
...
@@ -267,14 +267,14 @@ class CDRomTest(Test):
Command
(
"eject %s"
%
device
).
run
()
print
(
"tray ejected."
)
sys
.
stdout
.
flush
()
except
CertCommandError
:
except
:
pass
try
:
Command
(
"eject -t %s"
%
device
).
run
()
print
(
"tray auto-closed.
\n
"
)
sys
.
stdout
.
flush
()
except
CertCommandError
:
except
:
print
(
"Could not auto-close the tray, please close the tray manually."
)
self
.
ui
.
prompt_confirm
(
"Done well?"
)
...
...
tests/cpufreq/cpufreq.py
浏览文件 @
050833aa
...
...
@@ -17,7 +17,7 @@ from time import sleep
from
hwcompatible.env
import
CertEnv
from
hwcompatible.test
import
Test
from
hwcompatible.command
import
Command
,
CertCommandError
from
hwcompatible.command
import
Command
class
CPU
(
object
):
...
...
@@ -39,7 +39,7 @@ class CPU(object):
cmd
=
Command
(
"lscpu"
)
try
:
nums
=
cmd
.
get_str
(
r
'^CPU\S*:\s+(?P<cpus>\d+)$'
,
'cpus'
,
False
)
except
CertCommandError
as
e
:
except
Exception
as
e
:
print
(
e
)
return
False
self
.
nums
=
int
(
nums
)
...
...
@@ -48,7 +48,7 @@ class CPU(object):
cmd
=
Command
(
"cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq"
)
try
:
max_freq
=
cmd
.
get_str
()
except
CertCommandError
as
e
:
except
Exception
as
e
:
print
(
e
)
return
False
self
.
max_freq
=
int
(
max_freq
)
...
...
@@ -56,7 +56,7 @@ class CPU(object):
cmd
=
Command
(
"cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_min_freq"
)
try
:
min_freq
=
cmd
.
get_str
()
except
CertCommandError
as
e
:
except
Exception
as
e
:
print
(
e
)
return
False
self
.
min_freq
=
int
(
min_freq
)
...
...
@@ -75,7 +75,7 @@ class CPU(object):
try
:
cmd
.
run
()
return
cmd
.
returncode
except
CertCommandError
as
e
:
except
Exception
as
e
:
print
(
e
)
return
False
...
...
@@ -89,7 +89,7 @@ class CPU(object):
cmd
=
Command
(
"cpupower -c %s frequency-info -w"
%
cpu
)
try
:
return
int
(
cmd
.
get_str
(
r
'.* frequency: (?P<freq>\d+) .*'
,
'freq'
,
False
))
except
CertCommandError
as
e
:
except
Exception
as
e
:
print
(
e
)
return
False
...
...
@@ -105,7 +105,7 @@ class CPU(object):
try
:
cmd
.
run
()
return
cmd
.
returncode
except
CertCommandError
as
e
:
except
Exception
as
e
:
print
(
e
)
return
False
...
...
@@ -119,7 +119,7 @@ class CPU(object):
cmd
=
Command
(
"cpupower -c %s frequency-info -p"
%
cpu
)
try
:
return
cmd
.
get_str
(
r
'.* governor "(?P<governor>\w+)".*'
,
'governor'
,
False
)
except
CertCommandError
as
e
:
except
Exception
as
e
:
print
(
e
)
return
False
...
...
@@ -135,7 +135,7 @@ class CPU(object):
try
:
cmd
.
run
()
return
cmd
.
returncode
except
CertCommandError
as
e
:
except
Exception
as
e
:
print
(
e
)
return
False
...
...
tests/disk/disk.py
浏览文件 @
050833aa
...
...
@@ -52,7 +52,7 @@ class DiskTest(Test):
Command
(
"cat /proc/mdstat"
).
echo
(
ignore_errors
=
True
)
sys
.
stdout
.
flush
()
print
(
"
\n
"
)
except
CertCommandError
as
e
:
except
Exception
as
e
:
print
(
"Warning: could not get disk info"
)
print
(
e
)
...
...
@@ -197,7 +197,7 @@ class DiskTest(Test):
if
not
self
.
do_fio
(
path
,
size
,
opts
):
return_code
=
False
break
except
CertCommandError
as
e
:
except
Exception
as
e
:
print
(
e
)
return_code
=
False
break
...
...
tests/ipmi/ipmi.py
浏览文件 @
050833aa
...
...
@@ -13,7 +13,7 @@
# Create: 2020-04-01
from
hwcompatible.test
import
Test
from
hwcompatible.command
import
Command
,
CertCommandError
from
hwcompatible.command
import
Command
class
IpmiTest
(
Test
):
...
...
@@ -33,7 +33,7 @@ class IpmiTest(Test):
try
:
Command
(
"systemctl start ipmi"
).
run
()
Command
(
"systemctl status ipmi.service"
).
get_str
(
regex
=
"Active: active"
,
single_line
=
False
)
except
CertCommandError
:
except
:
print
(
"ipmi service cant't be started"
)
return
False
return
True
...
...
@@ -48,7 +48,7 @@ class IpmiTest(Test):
for
cmd
in
cmd_list
:
try
:
Command
(
cmd
).
echo
()
except
CertCommandError
:
except
:
print
(
"%s return error."
%
cmd
)
return
False
return
True
...
...
tests/kdump/kdump.py
浏览文件 @
050833aa
...
...
@@ -42,7 +42,7 @@ class KdumpTest(Test):
"""
try
:
Command
(
"cat /proc/cmdline"
).
get_str
(
r
"crashkernel=[^\ ]*"
)
except
(
OSError
,
ValueError
)
:
except
:
print
(
"Error: no crashkernel found."
)
return
False
...
...
@@ -59,7 +59,7 @@ class KdumpTest(Test):
try
:
Command
(
"systemctl restart kdump"
).
run
()
Command
(
"systemctl status kdump"
).
get_str
(
regex
=
"Active: active"
,
single_line
=
False
)
except
(
OSError
,
ValueError
)
:
except
:
print
(
"Error: kdump service not working."
)
return
False
...
...
tests/memory/memory.py
浏览文件 @
050833aa
...
...
@@ -243,7 +243,7 @@ class MemoryTest(Test):
Command
(
"echo 1 > %s/online"
%
memory_path
).
run
()
Command
(
"cat %s/state"
%
memory_path
).
get_str
(
"online"
)
return
True
except
CertCommandError
:
except
:
print
(
"Error: fail to online %s."
%
memory_path
)
return
False
...
...
@@ -258,7 +258,7 @@ class MemoryTest(Test):
Command
(
"echo 0 > %s/online"
%
memory_path
).
run
()
Command
(
"cat %s/state"
%
memory_path
).
get_str
(
"offline"
)
return
True
except
CertCommandError
:
except
:
print
(
"Error: fail to online %s."
%
memory_path
)
return
False
...
...
@@ -294,7 +294,7 @@ class MemoryTest(Test):
Command
(
"cat %s/removable"
%
memory_path
).
get_str
(
"1"
)
print
(
"%s is removable, start testing..."
%
os
.
path
.
basename
(
memory_path
))
test_flag
=
1
except
CertCommandError
:
except
:
continue
if
not
self
.
hotplug_memory_test
(
memory_path
):
print
(
"%s hotplug test fail."
%
os
.
path
.
basename
(
memory_path
))
...
...
tests/network/network.py
浏览文件 @
050833aa
...
...
@@ -25,7 +25,7 @@ except ImportError:
from
urllib2
import
urlopen
,
Request
,
HTTPError
from
hwcompatible.test
import
Test
from
hwcompatible.command
import
Command
,
CertCommandError
from
hwcompatible.command
import
Command
from
hwcompatible.document
import
CertDocument
from
hwcompatible.env
import
CertEnv
...
...
@@ -101,7 +101,7 @@ class NetworkTest(Test):
try
:
c
.
run
()
return
c
.
output
except
CertCommandError
as
e
:
except
Exception
as
e
:
print
(
e
)
return
[]
...
...
@@ -136,7 +136,7 @@ class NetworkTest(Test):
try
:
speed
=
c
.
get_str
(
pattern
,
'speed'
,
False
)
return
int
(
speed
)
except
CertCommandError
:
except
Exception
as
e
:
print
(
"[X] No speed found on the interface."
)
return
None
...
...
@@ -150,7 +150,7 @@ class NetworkTest(Test):
try
:
ip
=
c
.
get_str
(
pattern
,
'ip'
,
False
)
return
ip
except
CertCommandError
:
except
Exception
as
e
:
print
(
"[X] No available ip on the interface."
)
return
None
...
...
@@ -170,7 +170,7 @@ class NetworkTest(Test):
c
.
print_output
()
if
float
(
loss
)
==
0
:
return
True
except
CertCommandError
as
e
:
except
Exception
as
e
:
print
(
e
)
return
False
...
...
@@ -194,7 +194,7 @@ class NetworkTest(Test):
try
:
request
=
Request
(
url
,
data
=
data
,
headers
=
headers
)
response
=
urlopen
(
request
)
except
HTTPError
as
e
:
except
Exception
as
e
:
print
(
e
)
return
False
print
(
"Status: %u %s"
%
(
response
.
code
,
response
.
msg
))
...
...
@@ -243,7 +243,7 @@ class NetworkTest(Test):
(
bandwidth
,
target_bandwidth
))
if
bandwidth
>
target_bandwidth
:
return
True
except
CertCommandError
as
e
:
except
Exception
as
e
:
print
(
e
)
return
False
...
...
@@ -269,7 +269,7 @@ class NetworkTest(Test):
try
:
with
open
(
self
.
testfile
,
'rb'
)
as
f
:
filetext
=
base64
.
b64encode
(
f
.
read
())
except
IOError
as
e
:
except
Exception
as
e
:
print
(
e
)
return
False
...
...
@@ -286,7 +286,7 @@ class NetworkTest(Test):
try
:
request
=
Request
(
url
,
data
=
data
,
headers
=
headers
)
response
=
urlopen
(
request
)
except
HTTPError
as
e
:
except
Exception
as
e
:
print
(
e
)
return
False
time_stop
=
time
.
time
()
...
...
@@ -309,7 +309,7 @@ class NetworkTest(Test):
time_start
=
time
.
time
()
try
:
response
=
urlopen
(
url
)
except
HTTPError
as
e
:
except
Exception
as
e
:
print
(
e
)
return
False
time_stop
=
time
.
time
()
...
...
@@ -321,7 +321,7 @@ class NetworkTest(Test):
try
:
with
open
(
self
.
testfile
,
'wb'
)
as
f
:
f
.
write
(
filetext
)
except
IOError
as
e
:
except
Exception
as
e
:
print
(
e
)
return
False
...
...
tests/network/rdma.py
浏览文件 @
050833aa
...
...
@@ -16,7 +16,7 @@ import os
import
re
import
argparse
from
hwcompatible.command
import
Command
,
CertCommandError
from
hwcompatible.command
import
Command
from
hwcompatible.document
import
CertDocument
from
hwcompatible.env
import
CertEnv
from
network
import
NetworkTest
...
...
@@ -61,7 +61,7 @@ class RDMATest(NetworkTest):
c
=
Command
(
cmd
)
try
:
self
.
ib_device
=
c
.
read
()
except
CertCommandError
as
e
:
except
Exception
as
e
:
print
(
e
)
return
False
...
...
@@ -70,7 +70,7 @@ class RDMATest(NetworkTest):
c
=
Command
(
cmd
)
try
:
self
.
ib_port
=
int
(
c
.
read
(),
16
)
+
1
except
CertCommandError
as
e
:
except
Exception
as
e
:
print
(
e
)
return
False
...
...
@@ -93,7 +93,7 @@ class RDMATest(NetworkTest):
self
.
phys_state
=
re
.
search
(
r
"phys state:\s+(.*)"
,
info
).
group
(
1
)
self
.
link_layer
=
re
.
search
(
r
"link_layer:\s+(.*)"
,
info
).
group
(
1
)
self
.
speed
=
int
(
re
.
search
(
r
"rate:\s+(\d*)"
,
info
).
group
(
1
))
*
1024
except
CertCommandError
as
e
:
except
Exception
as
e
:
print
(
e
)
return
False
...
...
@@ -156,7 +156,7 @@ class RDMATest(NetworkTest):
print
(
"Current bandwidth is %.2fMb/s, target is %.2fMb/s"
%
(
avg_bw
,
tgt_bw
))
return
avg_bw
>
tgt_bw
except
CertCommandError
as
e
:
except
Exception
as
e
:
print
(
e
)
self
.
call_remote_server
(
cmd
,
'stop'
)
return
False
...
...
tests/nvme/nvme.py
浏览文件 @
050833aa
...
...
@@ -16,7 +16,7 @@ import os
import
sys
import
argparse
from
hwcompatible.test
import
Test
from
hwcompatible.command
import
Command
,
CertCommandError
from
hwcompatible.command
import
Command
class
NvmeTest
(
Test
):
...
...
@@ -81,7 +81,7 @@ class NvmeTest(Test):
Command
(
"nvme list"
).
echo
(
ignore_errors
=
True
)
return
True
except
CertCommandError
as
e
:
except
Exception
as
e
:
print
(
"Error: nvme cmd fail."
)
print
(
e
)
return
False
...
...
tests/system/system.py
浏览文件 @
050833aa
...
...
@@ -83,7 +83,7 @@ class SystemTest(Test):
sys
.
stdout
.
flush
()
if
rpm_verify
.
output
and
len
(
rpm_verify
.
output
)
>
0
:
return_code
=
False
except
OSError
:
except
:
print
(
"Error: files in %s have been tampered."
%
cert_package
)
return_code
=
False
return
return_code
...
...
@@ -113,7 +113,7 @@ class SystemTest(Test):
if
kernel_dict
.
document
[
os_version
]
!=
self
.
sysinfo
.
kernel_version
:
print
(
"Error: kernel %s check GA status fail."
%
self
.
sysinfo
.
kernel_version
)
return_code
=
False
except
KeyError
:
except
:
print
(
"Error: %s is not supported."
%
os_version
)
return_code
=
False
...
...
@@ -148,7 +148,7 @@ class SystemTest(Test):
print
(
""
)
tainted_file
.
close
()
except
(
IOError
,
ValueError
)
as
e
:
except
Exception
as
e
:
print
(
e
)
print
(
"Error: could not determine if kernel is tainted."
)
return_code
=
False
...
...
@@ -161,7 +161,7 @@ class SystemTest(Test):
try
:
params
=
Command
(
"cat /proc/cmdline"
).
get_str
()
print
(
"Boot Parameters: %s"
%
params
)
except
OSError
as
e
:
except
Exception
as
e
:
print
(
e
)
print
(
"Error: could not determine boot parameters."
)
return_code
=
False
...
...
@@ -308,7 +308,7 @@ class SystemTest(Test):
if
os
.
path
.
islink
(
modulefile
):
modulefile
=
os
.
readlink
(
modulefile
)
return
modulefile
except
OSError
:
except
:
print
(
"Error: could no find module file for %s:"
%
module
)
return
None
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录