Skip to content

Commit 737d644

Browse files
committed
tests: Get rid of feature-specific tests.
The only difference in bindings is because the methods were inlined, so with llvm 3.9 we can skip those. Signed-off-by: Emilio Cobos Álvarez <[email protected]>
1 parent 54d87d3 commit 737d644

File tree

2 files changed

+11
-29
lines changed

2 files changed

+11
-29
lines changed

tests/headers/class_with_typedef.hpp

+4-6
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
// bindgen-features: llvm_stable
2-
31
typedef int AnotherInt;
42

53
class C {
@@ -12,10 +10,10 @@ class C {
1210
AnotherInt d;
1311
AnotherInt* other_ptr;
1412

15-
void method(MyInt c) {};
16-
void methodRef(MyInt& c) {};
17-
void complexMethodRef(Lookup& c) {};
18-
void anotherMethod(AnotherInt c) {};
13+
void method(MyInt c);
14+
void methodRef(MyInt& c);
15+
void complexMethodRef(Lookup& c);
16+
void anotherMethod(AnotherInt c);
1917
};
2018

2119
class D: public C {

tests/tools/run-bindgen.py

+7-23
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010
import tempfile
1111

1212
BINDGEN_FLAGS_PREFIX = "// bindgen-flags: "
13-
BINDGEN_FEATURES_PREFIX = "// bindgen-features: "
1413

1514
COMMON_PRELUDE = """
1615
#![allow(non_snake_case)]
@@ -78,34 +77,22 @@ def make_bindgen_env():
7877

7978
return env
8079

81-
def get_bindgen_flags_and_features(header_path):
80+
def get_bindgen_flags(header_path):
8281
"""
83-
Return the bindgen flags and features required for this header as a tuple
84-
(flags, features).
82+
Return the bindgen flags required for this header
8583
"""
86-
found_flags = False
87-
found_features = False
88-
89-
features = []
9084
flags = ["--no-unstable-rust"]
9185
for line in COMMON_PRELUDE.split("\n"):
9286
flags.append("--raw-line")
9387
flags.append(line)
9488

9589
with open(header_path) as f:
9690
for line in f:
97-
if not found_flags and line.startswith(BINDGEN_FLAGS_PREFIX):
91+
if line.startswith(BINDGEN_FLAGS_PREFIX):
9892
flags.extend(line.strip().split(BINDGEN_FLAGS_PREFIX)[1].split(" "))
99-
found_flags = True
100-
101-
if not found_features and line.startswith(BINDGEN_FEATURES_PREFIX):
102-
features.extend(line.strip().split(BINDGEN_FEATURES_PREFIX)[1].split(" "))
103-
found_features = True
104-
105-
if found_flags and found_features:
10693
break
10794

108-
return (flags, features)
95+
return flags
10996

11097
def get_expected_bindings(rust_bindings_path):
11198
"""
@@ -163,7 +150,7 @@ def check_actual_vs_expected(expected_bindings, rust_bindings_path):
163150

164151
def to_diffable(s):
165152
return map(lambda l: l + "\n", s.split("\n"))
166-
153+
167154
diff = difflib.unified_diff(to_diffable(expected_bindings),
168155
to_diffable(actual_bindings),
169156
fromfile="expected_bindings.rs",
@@ -172,14 +159,11 @@ def to_diffable(s):
172159
sys.stderr.write("\n")
173160

174161
sys.exit(1)
175-
162+
176163
def main():
177164
args = parse_args()
178165

179-
(test_flags, test_features) = get_bindgen_flags_and_features(args.header)
180-
if not all(f in args.features for f in test_features):
181-
sys.exit(0)
182-
166+
test_flags = get_bindgen_flags(args.header)
183167
expected_bindings = get_expected_bindings(args.rust_bindings)
184168
generate_bindings(args.bindgen, test_flags, args.header, args.rust_bindings)
185169
test_generated_bindings(args.rust_bindings)

0 commit comments

Comments
 (0)