Skip to content

Commit 2866ab5

Browse files
committed
Speed up integration tests (move building expectations)
Speed up running 'cargo test': -Before: 2'17s -After: 30s Update to use new path: Makefile, .travis.yml, CONTRIBUTING.md, tests/tests.rs Delete unused expectation that fail to compile: tests/expectations/moar_bitfields.rs tests/expectations/variadic_template_args.rs For every 'cargo test' run, the bindgen output where built. We already test that the bindgen output match expectations/*.rs, so there is no need to check it build unless the expectation is updated. Move tests/expectations/*.rs to tests/expectations/tests/*.rs and make tests/expectations a new dev-dependency package. This allow running: - cargo test -p tests_expectations In addition to the speed up, we also get a clean output for the build and test run. In particular, a number of warnings are generated that should probably be silenced, and eventually enforced modifying travis to build: - RUSTFLAGS='-D warnings' cargo test -p tests_expectations The benefit of having it as a new package is that it avoid polluting the 'cargo test' output that should focus on bindgen.
1 parent 9073a4f commit 2866ab5

File tree

118 files changed

+29
-87
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

118 files changed

+29
-87
lines changed

.travis.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ script:
3333
- git add -A
3434
- git diff @
3535
- git diff-index --quiet HEAD
36+
- cargo test -p tests_expectations
3637
- cargo build --features "$BINDGEN_FEATURES _docs"
3738

3839
notifications:

CONTRIBUTING.md

Lines changed: 8 additions & 2 deletions

Cargo.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,5 +54,8 @@ _docs = []
5454
name = "bindgen"
5555
path = "src/lib.rs"
5656

57+
[dev-dependencies.tests_expectations]
58+
path = "tests/expectations"
59+
5760
[[test]]
5861
name = "tests"

Makefile

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ TEST_HEADERS := $(wildcard tests/headers/*.h) $(wildcard tests/headers/*.hpp)
33

44
TEST_TARGETS := $(TEST_HEADERS:.h=.rs)
55
TEST_TARGETS := $(TEST_TARGETS:.hpp=.rs)
6-
TEST_TARGETS := $(patsubst tests/headers/%, tests/expectations/%, $(TEST_TARGETS))
6+
TEST_TARGETS := $(patsubst tests/headers/%, tests/expectations/tests/%, $(TEST_TARGETS))
77

88
BINDGEN := ./target/debug/bindgen
99

@@ -25,10 +25,10 @@ clean-tests:
2525
$(RM) $(TEST_TARGETS)
2626

2727
# TODO: Add options to add flags and whatnot
28-
tests/expectations/%.rs: tests/headers/%.h
28+
tests/expectations/tests/%.rs: tests/headers/%.h
2929
@mkdir -p $(dir $@)
3030
./tests/tools/run-bindgen.py $(BINDGEN) $< $@
3131

32-
tests/expectations/%.rs: tests/headers/%.hpp
32+
tests/expectations/tests/%.rs: tests/headers/%.hpp
3333
@mkdir -p $(dir $@)
3434
./tests/tools/run-bindgen.py $(BINDGEN) $< $@

tests/expectations/Cargo.toml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
[package]
2+
name = "tests_expectations"
3+
description = "bindgen results when ran on ../headers/*"
4+
version = "0.1.0"
5+
authors = [
6+
"Jyun-Yan You <[email protected]>",
7+
"Emilio Cobos Álvarez <[email protected]>",
8+
"The Servo project developers",
9+
]
10+
11+
[dependencies]

tests/expectations/moar_bitfields.rs

Lines changed: 0 additions & 48 deletions
This file was deleted.

tests/expectations/src/lib.rs

Whitespace-only changes.

0 commit comments

Comments
 (0)