Skip to content

Commit 79f17fa

Browse files
bonzinijpakkane
authored andcommitted
fix transient failure on rust/12 bindgen
The test has a custom .h target that has the same name as the input in the test's source directory. Sometimes a compiler could build a target that intends to use the file in the source tree, but finds an incomplete output of the custom_target, causing the test to fail. To fix this, move the generated headers in a subdirectory of the build tree. Signed-off-by: Paolo Bonzini <[email protected]>
1 parent 0528ef9 commit 79f17fa

File tree

4 files changed

+15
-15
lines changed

4 files changed

+15
-15
lines changed
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// SPDX-License-Identifier: Apache-2.0
22
// Copyright © 2022 Intel Corporation
33

4-
#include "gen.h"
4+
#include "gen/gen.h"
55

66
int64_t add64(const int64_t, const int64_t);
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
gen_h = custom_target(
2+
'gen.h',
3+
command : [find_program('gen_header.py'), '@INPUT@', '@OUTPUT@'],
4+
output : 'gen.h',
5+
input : meson.project_source_root() / 'src/header.h'
6+
)
7+
8+
gen2_h = custom_target(
9+
'other.h',
10+
command : [find_program('gen_header.py'), '@INPUT@', '@OUTPUT@'],
11+
output : 'other.h',
12+
input : meson.project_source_root() / 'include/other.h'
13+
)

test cases/rust/12 bindgen/meson.build

Lines changed: 1 addition & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -66,20 +66,7 @@ rust_bin = executable(
6666
test('main', rust_bin)
6767

6868
# Test a generated header
69-
gen_h = custom_target(
70-
'gen.h',
71-
command : [find_program('src/gen_header.py'), '@INPUT@', '@OUTPUT@'],
72-
output : 'gen.h',
73-
input : 'src/header.h'
74-
)
75-
76-
gen2_h = custom_target(
77-
'other.h',
78-
command : [find_program('src/gen_header.py'), '@INPUT@', '@OUTPUT@'],
79-
output : 'other.h',
80-
input : 'include/other.h'
81-
)
82-
69+
subdir('gen')
8370
gen_rs = rust.bindgen(
8471
input : [gen_h, gen2_h],
8572
output : 'gen.rs',

0 commit comments

Comments
 (0)