rt-tests: move ptest to python3
convert python2 based ptest of rt-tests package to python3 (From OE-Core rev: 2767cbe014f84c9ad42ed8ef1eca7caa862e5196) Signed-off-by: Maxin B. John <maxin.john@intel.com> Signed-off-by: Ross Burton <ross.burton@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
parent
6074ed6cd4
commit
f8bdaf3878
|
@ -1,4 +1,4 @@
|
||||||
#!/usr/bin/python
|
#!/usr/bin/env python3
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
# SPDX-License-Identifier: BSD-3-Clause
|
# SPDX-License-Identifier: BSD-3-Clause
|
||||||
|
@ -106,8 +106,8 @@ def tc_name(sub_name):
|
||||||
|
|
||||||
def log(*msg):
|
def log(*msg):
|
||||||
tmp = "".join(map(str, msg)) # 'map(str, ...' allows numbers
|
tmp = "".join(map(str, msg)) # 'map(str, ...' allows numbers
|
||||||
for line in tmp.split("\n"):
|
for line in tmp.splitlines():
|
||||||
print "#", line
|
print("#", line)
|
||||||
|
|
||||||
#-------------------------------------------------------------------------------
|
#-------------------------------------------------------------------------------
|
||||||
# Like log(), but with a timestamp added
|
# Like log(), but with a timestamp added
|
||||||
|
@ -265,7 +265,7 @@ cmd = ("cyclictest",
|
||||||
"-d", str(interval_delta),
|
"-d", str(interval_delta),
|
||||||
"-l", str(loop_count)
|
"-l", str(loop_count)
|
||||||
)
|
)
|
||||||
rex = re.compile("C:\s*(\d+).*Min:\s*(\d+).*Avg:\s*(\d+).*Max:\s*(\d+)")
|
rex = re.compile(b"C:\s*(\d+).*Min:\s*(\d+).*Avg:\s*(\d+).*Max:\s*(\d+)")
|
||||||
|
|
||||||
def run_cyclictest_once():
|
def run_cyclictest_once():
|
||||||
res = subprocess.check_output(cmd)
|
res = subprocess.check_output(cmd)
|
||||||
|
@ -283,7 +283,7 @@ def run_cyclictest_once():
|
||||||
avg_sum = 0
|
avg_sum = 0
|
||||||
avg_cnt = 0
|
avg_cnt = 0
|
||||||
|
|
||||||
for line in res.split("\n"):
|
for line in res.splitlines():
|
||||||
m = rex.search(line)
|
m = rex.search(line)
|
||||||
if m is not None:
|
if m is not None:
|
||||||
minlist.append(int(m.group(2)))
|
minlist.append(int(m.group(2)))
|
||||||
|
@ -376,11 +376,11 @@ class cyclictest_runner:
|
||||||
log()
|
log()
|
||||||
log("PASS")
|
log("PASS")
|
||||||
|
|
||||||
print
|
print()
|
||||||
print tc_name(name), "[Min/us,Avg/us,Max/us]:",
|
print(tc_name(name), "[Min/us,Avg/us,Max/us]:",)
|
||||||
print "%d,%.1f,%d" % (bm_min,bm_avg, bm_max)
|
print("%d,%.1f,%d" % (bm_min,bm_avg, bm_max))
|
||||||
print "PASS:", tc_name(name)
|
print("PASS:", tc_name(name))
|
||||||
print
|
print()
|
||||||
|
|
||||||
except Exception:
|
except Exception:
|
||||||
log()
|
log()
|
||||||
|
@ -391,9 +391,9 @@ class cyclictest_runner:
|
||||||
log("WD: ", os.getcwd())
|
log("WD: ", os.getcwd())
|
||||||
log()
|
log()
|
||||||
log("FAIL")
|
log("FAIL")
|
||||||
print
|
print()
|
||||||
print "FAIL:", tc_name(name)
|
print("FAIL:", tc_name(name))
|
||||||
print
|
print()
|
||||||
|
|
||||||
#-------------------------------------------------------------------------------
|
#-------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
|
|
@ -1,3 +1,3 @@
|
||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
|
|
||||||
python ./rt_bmark.py
|
python3 ./rt_bmark.py
|
||||||
|
|
|
@ -28,6 +28,6 @@ do_install_ptest() {
|
||||||
cp ${WORKDIR}/rt_bmark.py ${D}${PTEST_PATH}
|
cp ${WORKDIR}/rt_bmark.py ${D}${PTEST_PATH}
|
||||||
}
|
}
|
||||||
|
|
||||||
RDEPENDS_${PN}-ptest += " stress python python-subprocess python-multiprocessing python-datetime python-re python-lang"
|
RDEPENDS_${PN}-ptest += " stress python3 python3-subprocess python3-multiprocessing python3-datetime python3-re python3-lang python3-misc"
|
||||||
|
|
||||||
FILES_${PN} += "${prefix}/src/backfire"
|
FILES_${PN} += "${prefix}/src/backfire"
|
||||||
|
|
Loading…
Reference in New Issue