summaryrefslogtreecommitdiff
path: root/tests
AgeCommit message (Collapse)Author
2016-10-29Run test in serial to not take all memoryJean-Philippe DUFRAIGNE
When running all the test in parallel, all the memory on my laptop is consumed by rustc processes, my machine become unusable and the tests do not make progress. It seems to make sense to have serial by default, as the number of process depends on the number of test files.
2016-10-25Add test for static constXidorn Quan
2016-10-24Remove the ignored and unused --no-type-renaming flag and optionNick Fitzgerald
2016-10-23Auto merge of #110 - heycam:stable-gen-names, r=emiliobors-servo
Give vtables and anonymous items more stable generated names (fixes #60) r? @emilio This works pretty well. There are two remaining things in stylo's structs files that have identifiers that look like they won't be that stable: the anonymous enum for the NODE_* flags at the top level, and the `typedef union { ... } nsStyleUnion`. There are various anonymous enums and other things at the top level in system headers that cause these identifiers to have generated IDs in them higher than 1 and 2. Probably for anonymous enums we could just avoid generating a rust enum altogether, since having the static consts should be sufficient. I tried to mess with the codegen to automatically treat `typedef union { ... } nsStyleUnion` like `union nsStyleUnion { ... }` but it seems the way clang exposes the typedef and union are as two adjacent cursors rather than a parent-child relationship, so it's not so easy.
2016-10-23Give vtables and anonymous items more stable generated names.Cameron McCormack
2016-10-21Auto merge of #73 - emilio:complex, r=noxbors-servo
Be able to represent Complex types with the correct layout. r? @nox
2016-10-21Auto merge of #66 - emilio:const-methods, r=noxbors-servo
Take pointer constness into account, to fix generation of const methods. We signal method constness in the `this` pointer creating a `const` pointer, but the `to_rust_ty` implementation never checked that.
2016-10-19Auto merge of #103 - emilio:const-enum-unnamed, r=fitzgenbors-servo
codegen: Generate constants names for unnamed enums in classes. Fixes #84. cc @upsuper, sorry for not doing it before, I totally forgot about it. r? @fitzgen or @nox
2016-10-19codegen: Generate constants names for unnamed enums in classes.Emilio Cobos Álvarez
2016-10-18Ensure that the bindgen executable is up-to-date when we run testsNick Fitzgerald
2016-10-18Allow test headers to supply required bindgen featuresNick Fitzgerald
This adds the ability for tests to supply required features, and if the bindgen we're testing was not built with those features, then the test will be skipped. The syntax used to require features is like this: // bindgen-features: llvm_stable some_experiment another
2016-10-18Rewrite tests/tools/run-bindgen.pyNick Fitzgerald
Changes include: * Using argparse for argument parsing. This will help when extending the script to skip tests that will only pass when --features llvm_stable is used to build bindgen. * Pulling out all the various steps of the script into helper functions that are easier to digest at a glance, and have docstrings describing their role in the script. * Printing diffs between expected and actual generated bindings rather than the full source text of each.
2016-10-18Use 4 space indentation in run-bindgen.pyNick Fitzgerald
Python style (PEP8) is 4 space indentation, and you'll be hard pressed to find anything else in the python community. We should match up with expectations, editor defaults, etc.
2016-10-18Call tests/tools/run-bindgen.py from `cargo test`Nick Fitzgerald
Fixes #51
2016-10-18Make tests/tools/run-bindgen.py check expectations if the rust path already ↵Nick Fitzgerald
exists
2016-10-18Remove old tests that no longer build and runNick Fitzgerald
2016-10-18ir: Test on typedefs also for template parameters that are transitively ↵Emilio Cobos Álvarez
applicable before discarding them.
2016-10-18TestsEmilio Cobos Álvarez
2016-10-13item: Consider replaced items hidden.Emilio Cobos Álvarez
2016-10-04Add test for 'int' in whitelist_vars and regen test expectationsRavi Shankar
2016-10-02Be able to represent Complex types with the correct layout.Emilio Cobos Álvarez
2016-10-02Stub Vector types with arrays.Emilio Cobos Álvarez
2016-09-27Take pointer constness into account, to fix generation of const methods.Emilio Cobos Álvarez
2016-09-25Handle re-declaration of a global variable. Fix #48Jean-Philippe DUFRAIGNE
2016-09-23Run tests on stable.Emilio Cobos Álvarez
2016-09-22Represent block pointers as *mut c_void instead.Emilio Cobos Álvarez
Signed-off-by: Emilio Cobos Álvarez <ecoal95@gmail.com>
2016-09-22Test weird edge cases with template params and stuff.Emilio Cobos Álvarez
2016-09-21Index unnamed types by canonical declaration.Emilio Cobos Álvarez
This fixes union_with_nesting.h
2016-09-21Add Int128 types.Emilio Cobos Álvarez
2016-09-21Some fixes for function pointers, typedefs, and OSX's stdlib.h.Emilio Cobos Álvarez
2016-09-16Back out docopt.Emilio Cobos Álvarez
2016-09-16Rewrite the core of the binding generator.Emilio Cobos Álvarez
TL;DR: The binding generator is a mess as of right now. At first it was funny (in a "this is challenging" sense) to improve on it, but this is not sustainable. The truth is that the current architecture of the binding generator is a huge pile of hacks, so these few days I've been working on rewriting it with a few goals. 1) Have the hacks as contained and identified as possible. They're sometimes needed because how clang exposes the AST, but ideally those hacks are well identified and don't interact randomly with each others. As an example, in the current bindgen when scanning the parameters of a function that references a struct clones all the struct information, then if the struct name changes (because we mangle it), everything breaks. 2) Support extending the bindgen output without having to deal with clang. The way I'm aiming to do this is separating completely the parsing stage from the code generation one, and providing a single id for each item the binding generator provides. 3) No more random mutation of the internal representation from anywhere. That means no more Rc<RefCell<T>>, no more random circular references, no more borrow_state... nothing. 4) No more deduplication of declarations before code generation. Current bindgen has a stage, called `tag_dup_decl`[1], that takes care of deduplicating declarations. That's completely buggy, and for C++ it's a complete mess, since we YOLO modify the world. I've managed to take rid of this using the clang canonical declaration, and the definition, to avoid scanning any type/item twice. 5) Code generation should not modify any internal data structure. It can lookup things, traverse whatever it needs, but not modifying randomly. 6) Each item should have a canonical name, and a single source of mangling logic, and that should be computed from the inmutable state, at code generation. I've put a few canonical_name stuff in the code generation phase, but it's still not complete, and should change if I implement namespaces. Improvements pending until this can land: 1) Add support for missing core stuff, mainly generating functions (note that we parse the signatures for types correctly though), bitfields, generating C++ methods. 2) Add support for the necessary features that were added to work around some C++ pitfalls, like opaque types, etc... 3) Add support for the sugar that Manish added recently. 4) Optionally (and I guess this can land without it, because basically nobody uses it since it's so buggy), bring back namespace support. These are not completely trivial, but I think I can do them quite easily with the current architecture. I'm putting the current state of affairs here as a request for comments... Any thoughts? Note that there are still a few smells I want to eventually re-redesign, like the ParseError::Recurse thing, but until that happens I'm way happier with this kind of architecture. I'm keeping the old `parser.rs` and `gen.rs` in tree just for reference while I code, but they will go away. [1]: https://github.com/Yamakaky/rust-bindgen/blob/master/src/gen.rs#L448
2016-09-01Deduplicate names of virtual overloaded methods. Fix #48Simon Sapin
2016-08-26Use docopt for argument parsingNick Fitzgerald
This commit switches bindgen over to using the docopt crate for argument parsing instead of manual argument parsing. This required two notable changes in the arguments and flags style: 1. All flags of the form `-foo` are now of the form `--foo`. 2. We can no longer pass unknown flags straight through to clang. Instead, the user appends `--` after the bindgen flags and input header, after which point any more flags and arguments get collected and passed to clang. This required changes to the test runner and the `// bindgen-flags` comments.
2016-08-16tests: Add test for a union with explicit destructor.Emilio Cobos Álvarez
2016-08-16Auto merge of #29 - emilio:template-unions, r=noxbors-servo
Add support for basic template unions. Fixes #28. r? @nox cc @bholley
2016-08-15parser: If we find no declarations, check for primitive type before going ↵Emilio Cobos Álvarez
down the hack version.
2016-08-15types: Implement PartialEq in the Type trait looking at the values pointed ↵Emilio Cobos Álvarez
by Rc<T>s
2016-08-14test: Add test for keywords from upstream.Emilio Cobos Álvarez
2016-08-13Add test for union templates without using template parameters.Emilio Cobos Álvarez
2016-07-26Add support for 'unsafe fields'Manish Goregaokar
2016-07-26Make it possible to run tests on El CapitanManish Goregaokar
2016-07-21Avoid recursing infinitely with CRTP while looking for a destructor.Emilio Cobos Álvarez
Fixes #22
2016-07-10Use aster and quasi to allow building with stable Rust.Emilio Cobos Álvarez
2016-07-05Add test for -no-namespaced-constantsEmilio Cobos Álvarez
2016-06-02gen: Generate bitfield getters for structsEmilio Cobos Álvarez
2016-06-01gen: Don't generate constants of templated structsEmilio Cobos Álvarez
They're tricky.
2016-05-24parser: Implement nocopy annotation.Emilio Cobos Álvarez
2016-05-18Support in-class constants in C++Emilio Cobos Álvarez
2016-05-17gen: Avoid to generate structs with empty template param namesEmilio Cobos Álvarez
We generate them incorrectly anyways, but this way at least we're allowed to compile it.