diff options
author | Frederic Martinsons <frederic.martinsons@gmail.com> | 2023-07-06 11:16:16 +0200 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2023-07-14 17:31:06 +0100 |
commit | f782c806a41c3a1611a8ad8484f63030179c2410 (patch) | |
tree | 04c372f1c2c57f6897dca5f612161f592bfa3229 | |
parent | a48de87ca7b5aa9beea3ffd0ca17428c4d8358ab (diff) | |
download | poky-f782c806a41c3a1611a8ad8484f63030179c2410.tar.gz |
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>
-rw-r--r-- | meta/classes-recipe/ptest-cargo.bbclass | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/meta/classes-recipe/ptest-cargo.bbclass b/meta/classes-recipe/ptest-cargo.bbclass index 4ed528445a..5d53abe969 100644 --- a/meta/classes-recipe/ptest-cargo.bbclass +++ b/meta/classes-recipe/ptest-cargo.bbclass | |||
@@ -23,13 +23,13 @@ python do_compile_ptest_cargo() { | |||
23 | bb.note(f"Building tests with cargo ({cmd})") | 23 | bb.note(f"Building tests with cargo ({cmd})") |
24 | 24 | ||
25 | try: | 25 | try: |
26 | proc = subprocess.Popen(cmd, shell=True, env=env, stdout=subprocess.PIPE, stderr=subprocess.STDOUT) | 26 | proc = subprocess.Popen(cmd, shell=True, env=env, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, text=True) |
27 | except subprocess.CalledProcessError as e: | 27 | except subprocess.CalledProcessError as e: |
28 | bb.fatal(f"Cannot build test with cargo: {e}") | 28 | bb.fatal(f"Cannot build test with cargo: {e}") |
29 | 29 | ||
30 | lines = [] | 30 | lines = [] |
31 | for line in proc.stdout: | 31 | for line in proc.stdout: |
32 | data = line.decode('utf-8').strip('\n') | 32 | data = line.strip('\n') |
33 | lines.append(data) | 33 | lines.append(data) |
34 | bb.note(data) | 34 | bb.note(data) |
35 | proc.communicate() | 35 | proc.communicate() |
@@ -50,7 +50,7 @@ python do_compile_ptest_cargo() { | |||
50 | current_manifest_path = os.path.normpath(data['manifest_path']) | 50 | current_manifest_path = os.path.normpath(data['manifest_path']) |
51 | project_manifest_path = os.path.normpath(manifest_path) | 51 | project_manifest_path = os.path.normpath(manifest_path) |
52 | if current_manifest_path == project_manifest_path: | 52 | if current_manifest_path == project_manifest_path: |
53 | if data['target']['test'] or data['target']['doctest'] and data['executable']: | 53 | if (data['target']['test'] or data['target']['doctest']) and data['executable']: |
54 | test_bins.append(data['executable']) | 54 | test_bins.append(data['executable']) |
55 | except KeyError as e: | 55 | except KeyError as e: |
56 | # skip lines that do not meet the requirements | 56 | # skip lines that do not meet the requirements |