summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEmilio Cobos Álvarez <ecoal95@gmail.com>2016-11-01 15:20:22 +0100
committerEmilio Cobos Álvarez <ecoal95@gmail.com>2016-11-01 15:21:44 +0100
commit737d6449eb1b476af10e6a98058ed79b5421215f (patch)
treebc9a07860c3226a7ea82fd491d7d32177f7e249e
parent54d87d37f3eb2f1a19fc53b8c92558417a27d47e (diff)
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 <ecoal95@gmail.com>
-rw-r--r--tests/headers/class_with_typedef.hpp10
-rwxr-xr-xtests/tools/run-bindgen.py30
2 files changed, 11 insertions, 29 deletions
diff --git a/tests/headers/class_with_typedef.hpp b/tests/headers/class_with_typedef.hpp
index 8e09e8db..8707cffe 100644
--- a/tests/headers/class_with_typedef.hpp
+++ b/tests/headers/class_with_typedef.hpp
@@ -1,5 +1,3 @@
-// bindgen-features: llvm_stable
-
typedef int AnotherInt;
class C {
@@ -12,10 +10,10 @@ public:
AnotherInt d;
AnotherInt* other_ptr;
- void method(MyInt c) {};
- void methodRef(MyInt& c) {};
- void complexMethodRef(Lookup& c) {};
- void anotherMethod(AnotherInt c) {};
+ void method(MyInt c);
+ void methodRef(MyInt& c);
+ void complexMethodRef(Lookup& c);
+ void anotherMethod(AnotherInt c);
};
class D: public C {
diff --git a/tests/tools/run-bindgen.py b/tests/tools/run-bindgen.py
index ddd5d11b..258a60e5 100755
--- a/tests/tools/run-bindgen.py
+++ b/tests/tools/run-bindgen.py
@@ -10,7 +10,6 @@ import subprocess
import tempfile
BINDGEN_FLAGS_PREFIX = "// bindgen-flags: "
-BINDGEN_FEATURES_PREFIX = "// bindgen-features: "
COMMON_PRELUDE = """
#![allow(non_snake_case)]
@@ -78,15 +77,10 @@ def make_bindgen_env():
return env
-def get_bindgen_flags_and_features(header_path):
+def get_bindgen_flags(header_path):
"""
- Return the bindgen flags and features required for this header as a tuple
- (flags, features).
+ Return the bindgen flags required for this header
"""
- found_flags = False
- found_features = False
-
- features = []
flags = ["--no-unstable-rust"]
for line in COMMON_PRELUDE.split("\n"):
flags.append("--raw-line")
@@ -94,18 +88,11 @@ def get_bindgen_flags_and_features(header_path):
with open(header_path) as f:
for line in f:
- if not found_flags and line.startswith(BINDGEN_FLAGS_PREFIX):
+ if line.startswith(BINDGEN_FLAGS_PREFIX):
flags.extend(line.strip().split(BINDGEN_FLAGS_PREFIX)[1].split(" "))
- found_flags = True
-
- if not found_features and line.startswith(BINDGEN_FEATURES_PREFIX):
- features.extend(line.strip().split(BINDGEN_FEATURES_PREFIX)[1].split(" "))
- found_features = True
-
- if found_flags and found_features:
break
- return (flags, features)
+ return flags
def get_expected_bindings(rust_bindings_path):
"""
@@ -163,7 +150,7 @@ def check_actual_vs_expected(expected_bindings, rust_bindings_path):
def to_diffable(s):
return map(lambda l: l + "\n", s.split("\n"))
-
+
diff = difflib.unified_diff(to_diffable(expected_bindings),
to_diffable(actual_bindings),
fromfile="expected_bindings.rs",
@@ -172,14 +159,11 @@ def check_actual_vs_expected(expected_bindings, rust_bindings_path):
sys.stderr.write("\n")
sys.exit(1)
-
+
def main():
args = parse_args()
- (test_flags, test_features) = get_bindgen_flags_and_features(args.header)
- if not all(f in args.features for f in test_features):
- sys.exit(0)
-
+ test_flags = get_bindgen_flags(args.header)
expected_bindings = get_expected_bindings(args.rust_bindings)
generate_bindings(args.bindgen, test_flags, args.header, args.rust_bindings)
test_generated_bindings(args.rust_bindings)