1
0
mirror of https://git.yoctoproject.org/poky synced 2026-05-08 17:19:20 +00:00

ptest-cargo.bbclass: fix condition to detect test executable

before that, a test executable at None was picked.
Moreover, use universal_newlines to subprocess call to avoid
being polluted by fancy carriage return characters.

(From OE-Core rev: 8dd52f19a919fb7be0ffb7d40782eafe183f8a09)

Signed-off-by: Frederic Martinsons <frederic.martinsons@gmail.com>
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
Frederic Martinsons
2023-07-06 11:16:16 +02:00
committed by Richard Purdie
parent a48de87ca7
commit f782c806a4
+3 -3
View File
@@ -23,13 +23,13 @@ python do_compile_ptest_cargo() {
bb.note(f"Building tests with cargo ({cmd})")
try:
proc = subprocess.Popen(cmd, shell=True, env=env, stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
proc = subprocess.Popen(cmd, shell=True, env=env, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, text=True)
except subprocess.CalledProcessError as e:
bb.fatal(f"Cannot build test with cargo: {e}")
lines = []
for line in proc.stdout:
data = line.decode('utf-8').strip('\n')
data = line.strip('\n')
lines.append(data)
bb.note(data)
proc.communicate()
@@ -50,7 +50,7 @@ python do_compile_ptest_cargo() {
current_manifest_path = os.path.normpath(data['manifest_path'])
project_manifest_path = os.path.normpath(manifest_path)
if current_manifest_path == project_manifest_path:
if data['target']['test'] or data['target']['doctest'] and data['executable']:
if (data['target']['test'] or data['target']['doctest']) and data['executable']:
test_bins.append(data['executable'])
except KeyError as e:
# skip lines that do not meet the requirements