diff options
| author | Maxin B. John <maxin.john@intel.com> | 2016-07-01 11:39:02 +0300 |
|---|---|---|
| committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2016-07-08 09:57:25 +0100 |
| commit | f8bdaf38783a37125388924eec7b5af6216ae880 (patch) | |
| tree | 5d54add14b06e8833d3e4397b776b2a252c5034b /meta/recipes-rt | |
| parent | 6074ed6cd46e5167903e835508d4d6062bf04501 (diff) | |
| download | poky-f8bdaf38783a37125388924eec7b5af6216ae880.tar.gz | |
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>
Diffstat (limited to 'meta/recipes-rt')
| -rwxr-xr-x | meta/recipes-rt/rt-tests/files/rt_bmark.py | 26 | ||||
| -rw-r--r-- | meta/recipes-rt/rt-tests/files/run-ptest | 2 | ||||
| -rw-r--r-- | meta/recipes-rt/rt-tests/rt-tests_2.0.bb | 2 |
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 @@ | |||
| 1 | #!/usr/bin/python | 1 | #!/usr/bin/env python3 |
| 2 | # -*- coding: utf-8 -*- | 2 | # -*- coding: utf-8 -*- |
| 3 | 3 | ||
| 4 | # SPDX-License-Identifier: BSD-3-Clause | 4 | # SPDX-License-Identifier: BSD-3-Clause |
| @@ -106,8 +106,8 @@ def tc_name(sub_name): | |||
| 106 | 106 | ||
| 107 | def log(*msg): | 107 | def log(*msg): |
| 108 | tmp = "".join(map(str, msg)) # 'map(str, ...' allows numbers | 108 | tmp = "".join(map(str, msg)) # 'map(str, ...' allows numbers |
| 109 | for line in tmp.split("\n"): | 109 | for line in tmp.splitlines(): |
| 110 | print "#", line | 110 | print("#", line) |
| 111 | 111 | ||
| 112 | #------------------------------------------------------------------------------- | 112 | #------------------------------------------------------------------------------- |
| 113 | # Like log(), but with a timestamp added | 113 | # Like log(), but with a timestamp added |
| @@ -265,7 +265,7 @@ cmd = ("cyclictest", | |||
| 265 | "-d", str(interval_delta), | 265 | "-d", str(interval_delta), |
| 266 | "-l", str(loop_count) | 266 | "-l", str(loop_count) |
| 267 | ) | 267 | ) |
| 268 | rex = re.compile("C:\s*(\d+).*Min:\s*(\d+).*Avg:\s*(\d+).*Max:\s*(\d+)") | 268 | rex = re.compile(b"C:\s*(\d+).*Min:\s*(\d+).*Avg:\s*(\d+).*Max:\s*(\d+)") |
| 269 | 269 | ||
| 270 | def run_cyclictest_once(): | 270 | def run_cyclictest_once(): |
| 271 | res = subprocess.check_output(cmd) | 271 | res = subprocess.check_output(cmd) |
| @@ -283,7 +283,7 @@ def run_cyclictest_once(): | |||
| 283 | avg_sum = 0 | 283 | avg_sum = 0 |
| 284 | avg_cnt = 0 | 284 | avg_cnt = 0 |
| 285 | 285 | ||
| 286 | for line in res.split("\n"): | 286 | for line in res.splitlines(): |
| 287 | m = rex.search(line) | 287 | m = rex.search(line) |
| 288 | if m is not None: | 288 | if m is not None: |
| 289 | minlist.append(int(m.group(2))) | 289 | minlist.append(int(m.group(2))) |
| @@ -376,11 +376,11 @@ class cyclictest_runner: | |||
| 376 | log() | 376 | log() |
| 377 | log("PASS") | 377 | log("PASS") |
| 378 | 378 | ||
| 379 | 379 | print() | |
| 380 | print tc_name(name), "[Min/us,Avg/us,Max/us]:", | 380 | print(tc_name(name), "[Min/us,Avg/us,Max/us]:",) |
| 381 | print "%d,%.1f,%d" % (bm_min,bm_avg, bm_max) | 381 | print("%d,%.1f,%d" % (bm_min,bm_avg, bm_max)) |
| 382 | print "PASS:", tc_name(name) | 382 | print("PASS:", tc_name(name)) |
| 383 | 383 | print() | |
| 384 | 384 | ||
| 385 | except Exception: | 385 | except Exception: |
| 386 | log() | 386 | log() |
| @@ -391,9 +391,9 @@ class cyclictest_runner: | |||
| 391 | log("WD: ", os.getcwd()) | 391 | log("WD: ", os.getcwd()) |
| 392 | log() | 392 | log() |
| 393 | log("FAIL") | 393 | log("FAIL") |
| 394 | 394 | print() | |
| 395 | print "FAIL:", tc_name(name) | 395 | print("FAIL:", tc_name(name)) |
| 396 | 396 | print() | |
| 397 | 397 | ||
| 398 | #------------------------------------------------------------------------------- | 398 | #------------------------------------------------------------------------------- |
| 399 | 399 | ||
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 @@ | |||
| 1 | #!/bin/sh | 1 | #!/bin/sh |
| 2 | 2 | ||
| 3 | python ./rt_bmark.py | 3 | 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() { | |||
| 28 | cp ${WORKDIR}/rt_bmark.py ${D}${PTEST_PATH} | 28 | cp ${WORKDIR}/rt_bmark.py ${D}${PTEST_PATH} |
| 29 | } | 29 | } |
| 30 | 30 | ||
| 31 | RDEPENDS_${PN}-ptest += " stress python python-subprocess python-multiprocessing python-datetime python-re python-lang" | 31 | RDEPENDS_${PN}-ptest += " stress python3 python3-subprocess python3-multiprocessing python3-datetime python3-re python3-lang python3-misc" |
| 32 | 32 | ||
| 33 | FILES_${PN} += "${prefix}/src/backfire" | 33 | FILES_${PN} += "${prefix}/src/backfire" |
