aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMaxin B. John <maxin.john@intel.com>2016-07-01 11:39:02 +0300
committerRichard Purdie <richard.purdie@linuxfoundation.org>2016-07-08 09:55:41 +0100
commit2767cbe014f84c9ad42ed8ef1eca7caa862e5196 (patch)
tree6198c3e2ffd4fda466c55cb2dc5322203ebac97e
parent615b784bd3d53a77b7e34e3879a72e7e51477db6 (diff)
downloadopenembedded-core-contrib-2767cbe014f84c9ad42ed8ef1eca7caa862e5196.tar.gz
rt-tests: move ptest to python3
convert python2 based ptest of rt-tests package to python3 Signed-off-by: Maxin B. John <maxin.john@intel.com> Signed-off-by: Ross Burton <ross.burton@intel.com>
-rwxr-xr-xmeta/recipes-rt/rt-tests/files/rt_bmark.py26
-rw-r--r--meta/recipes-rt/rt-tests/files/run-ptest2
-rw-r--r--meta/recipes-rt/rt-tests/rt-tests_2.0.bb2
3 files changed, 15 insertions, 15 deletions
diff --git a/meta/recipes-rt/rt-tests/files/rt_bmark.py b/meta/recipes-rt/rt-tests/files/rt_bmark.py
index 0e2b105e34..080a655893 100755
--- a/meta/recipes-rt/rt-tests/files/rt_bmark.py
+++ b/meta/recipes-rt/rt-tests/files/rt_bmark.py
@@ -1,4 +1,4 @@
-#!/usr/bin/python
+#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# SPDX-License-Identifier: BSD-3-Clause
@@ -106,8 +106,8 @@ def tc_name(sub_name):
def log(*msg):
tmp = "".join(map(str, msg)) # 'map(str, ...' allows numbers
- for line in tmp.split("\n"):
- print "#", line
+ for line in tmp.splitlines():
+ print("#", line)
#-------------------------------------------------------------------------------
# Like log(), but with a timestamp added
@@ -265,7 +265,7 @@ cmd = ("cyclictest",
"-d", str(interval_delta),
"-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():
res = subprocess.check_output(cmd)
@@ -283,7 +283,7 @@ def run_cyclictest_once():
avg_sum = 0
avg_cnt = 0
- for line in res.split("\n"):
+ for line in res.splitlines():
m = rex.search(line)
if m is not None:
minlist.append(int(m.group(2)))
@@ -376,11 +376,11 @@ class cyclictest_runner:
log()
log("PASS")
- print
- print tc_name(name), "[Min/us,Avg/us,Max/us]:",
- print "%d,%.1f,%d" % (bm_min,bm_avg, bm_max)
- print "PASS:", tc_name(name)
- print
+ print()
+ print(tc_name(name), "[Min/us,Avg/us,Max/us]:",)
+ print("%d,%.1f,%d" % (bm_min,bm_avg, bm_max))
+ print("PASS:", tc_name(name))
+ print()
except Exception:
log()
@@ -391,9 +391,9 @@ class cyclictest_runner:
log("WD: ", os.getcwd())
log()
log("FAIL")
- print
- print "FAIL:", tc_name(name)
- print
+ print()
+ print("FAIL:", tc_name(name))
+ print()
#-------------------------------------------------------------------------------
diff --git a/meta/recipes-rt/rt-tests/files/run-ptest b/meta/recipes-rt/rt-tests/files/run-ptest
index 8e6d3e3588..b7c5e29f2a 100644
--- a/meta/recipes-rt/rt-tests/files/run-ptest
+++ b/meta/recipes-rt/rt-tests/files/run-ptest
@@ -1,3 +1,3 @@
#!/bin/sh
-python ./rt_bmark.py
+python3 ./rt_bmark.py
diff --git a/meta/recipes-rt/rt-tests/rt-tests_2.0.bb b/meta/recipes-rt/rt-tests/rt-tests_2.0.bb
index 21780d19ed..83869b89b8 100644
--- a/meta/recipes-rt/rt-tests/rt-tests_2.0.bb
+++ b/meta/recipes-rt/rt-tests/rt-tests_2.0.bb
@@ -28,6 +28,6 @@ do_install_ptest() {
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"