Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Write a python script to generate type assertions for Servo_* functions #13598

Closed
Manishearth opened this issue Oct 5, 2016 · 5 comments
Closed

Comments

@Manishearth
Copy link
Member

@Manishearth Manishearth commented Oct 5, 2016

This is the first step towards fixing #12992

https://github.com/emilio/servo/blob/c7e1a575a5225ccfb00a38fb50e052d986c0a78d/components/style/gecko_bindings/bindings.rs#L802 contains a bunch of Servo_* function declarations. These functions are defined in ports/geckolib/glue.rs.

We need a way of testing that the functions have the same signatures. This can be done by writing code that will not compile if they don't.

The main step here will be to write a python script in gecko_bindings that reads bindings.rs (assume it is in the same directory), and writes a type_assertions.rs file in the same directory. This file just contains code like the following:

fn assert_types() {
    [Servo_Foo, bindings::Servo_Foo];
    [Servo_Bar, bindings::Servo_Bar];
}

for each function in bindings.rs with a Servo_* signature. Be sure to include the generated file in your pull request.

This file can be include!()ed into a test in tests/unit/stylo, where all of the imports have been set up correctly. (This part isn't part of this bug, but feel free to work on it and ask me questions if you have any).

I'll hook it up to the main bindgen script later.

@highfive
Copy link

@highfive highfive commented Oct 5, 2016

Please make a comment here if you intend to work on this issue. Thank you!

@highfive
Copy link

@highfive highfive commented Oct 5, 2016

@Rafagd
Copy link
Contributor

@Rafagd Rafagd commented Oct 5, 2016

Is this what you want? #13603

@wafflespeanut
Copy link
Member

@wafflespeanut wafflespeanut commented Oct 5, 2016

In the future, please claim the relevant issue before working on it, so that we can reduce duplicate efforts.

@Rafagd
Copy link
Contributor

@Rafagd Rafagd commented Oct 5, 2016

I'll do it.

bors-servo added a commit that referenced this issue Oct 6, 2016
Script-generated tests for Servo_* gecko bindings

All changes done in #13603, but this time I understand why I should have created a branch instead of doing everything on master.
---
<!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `__` with appropriate data: -->
- [x] `./mach build -d` does not report any errors
- [x] `./mach test-tidy` does not report any errors
- [x] These changes fix #13598 (github issue number if applicable).

<!-- Either: -->
- [ ] There are tests for these changes OR
- [x] These changes do not require tests because `they are tests`.

<!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. -->

<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/13617)
<!-- Reviewable:end -->
bors-servo added a commit that referenced this issue Oct 7, 2016
Script-generated tests for Servo_* gecko bindings

All changes done in #13603, but this time I understand why I should have created a branch instead of doing everything on master.
---
<!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `__` with appropriate data: -->
- [x] `./mach build -d` does not report any errors
- [x] `./mach test-tidy` does not report any errors
- [x] These changes fix #13598 (github issue number if applicable).

<!-- Either: -->
- [ ] There are tests for these changes OR
- [x] These changes do not require tests because `they are tests`.

<!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. -->

<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/13617)
<!-- Reviewable:end -->
bors-servo added a commit that referenced this issue Oct 7, 2016
Script-generated tests for Servo_* gecko bindings

All changes done in #13603, but this time I understand why I should have created a branch instead of doing everything on master.
---
<!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `__` with appropriate data: -->
- [x] `./mach build -d` does not report any errors
- [x] `./mach test-tidy` does not report any errors
- [x] These changes fix #13598 (github issue number if applicable).

<!-- Either: -->
- [ ] There are tests for these changes OR
- [x] These changes do not require tests because `they are tests`.

<!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. -->

<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/13617)
<!-- Reviewable:end -->
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
4 participants
You can’t perform that action at this time.