summaryrefslogtreecommitdiffstats
path: root/meta/recipes-rt/rt-tests/files/rt_bmark.py
diff options
context:
space:
mode:
Diffstat (limited to 'meta/recipes-rt/rt-tests/files/rt_bmark.py')
-rwxr-xr-xmeta/recipes-rt/rt-tests/files/rt_bmark.py34
1 files changed, 17 insertions, 17 deletions
diff --git a/meta/recipes-rt/rt-tests/files/rt_bmark.py b/meta/recipes-rt/rt-tests/files/rt_bmark.py
index e2280e43e2..3b84447a0f 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
@@ -130,7 +130,7 @@ def log_test_header(seq_no, nr_of_tests, name):
#-------------------------------------------------------------------------------
def start_stress(*args):
- stress_cmd = [ "stress" ]
+ stress_cmd = [ "stress-ng" ]
added_stress_types = []
req_stress_types = set(args)
cpu_cnt = str(multiprocessing.cpu_count())
@@ -166,12 +166,12 @@ def start_stress(*args):
log(" Command: '", stress_cmd_str, "'")
log()
- # preexec_fn=os.setsid causes stress to be executed in a separate
+ # start_new_session causes stress to be executed in a separate
# session, => it gets a new process group (incl. children). It
# can then be terminated using os.killpg in end_stress without
# terminating this script.
- p = subprocess.Popen(stress_cmd, preexec_fn=os.setsid)
+ p = subprocess.Popen(stress_cmd, start_new_session=True)
return p
@@ -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)))
@@ -324,7 +324,7 @@ def run_cyclictest_suite():
t = time.time()
max_list = []
- for i in xrange(0, suite_size):
+ for i in range(0, suite_size):
tmp_min, tmp_avg, tmp_max = run_cyclictest_once()
msg = "%2d/%2d:" % (i+1, suite_size)
@@ -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()
#-------------------------------------------------------------------------------