Skip to content

Wrench Reftests #695

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

Merged
merged 2 commits into from
Jan 12, 2017
Merged

Wrench Reftests #695

merged 2 commits into from
Jan 12, 2017

Conversation

jrmuizel
Copy link
Collaborator

@jrmuizel jrmuizel commented Jan 10, 2017

This is my work-in-progress that adds reftesting functionality to wrench


This change is Reviewable

@glennw
Copy link
Member

glennw commented Jan 10, 2017

@jrmuizel Cool! Did you want this stuff reviewed / merged now, or wait until the [WIP] is removed?

@jrmuizel
Copy link
Collaborator Author

I'll put a reviewable version up tomorrow.

@kvark kvark self-requested a review January 10, 2017 02:47
@kvark
Copy link
Member

kvark commented Jan 10, 2017

Can we have the mask.yaml, mask.png, and the reftest list in different folder than src?

Copy link
Member

@kvark kvark left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I know this is incomplete, just giving an early feedback

}

pub fn parse_reftests<F>(filename: &str, mut runner: F) where F: FnMut(Reftest)
{
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

non-conventional formatting here (and in other function definitions)

let kind = match items.next() {
Some("==") => ReftestOp::Equal,
Some("!=") => ReftestOp::NotEqual,
_ => panic!()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: maybe just continue with a warning instead

wrench.render();
window.swap_buffers();
let size = window.get_inner_size();
gl::read_pixels(0, 0,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

uh oh, we need to hide it behind WR's device abstraction

gl::read_pixels(0, 0,
size.0 as gl::GLsizei,
size.1 as gl::GLsizei,
gl::RGB, gl::UNSIGNED_BYTE)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we use RGBA instead in order to avoid internal format conversion?

pub fn run_reftests(wrench: &mut Wrench, window: &mut WindowWrapper, filename: &str)
{
parse_reftests(filename, |t: Reftest|
{
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

formatting

@jrmuizel
Copy link
Collaborator Author

jrmuizel commented Jan 12, 2017

This should be ready for review now. Only the top commit is relevant. Some of the others were need so that continuous integration will work.

@jrmuizel jrmuizel changed the title [WIP] Reftests Wrench Reftests Jan 12, 2017
@kvark
Copy link
Member

kvark commented Jan 12, 2017

Thanks @jrmuizel !
It appears that we are already using gl::read_pixels in wrench, so a fix to both this and the older case could be a follow-up.
@glennw leaving for you to either review or merge with r=me

Copy link
Member

@kvark kvark left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One small fix is needed.

let file = BufReader::new(&f);
for line in file.lines() {
let l = line.unwrap();
if l.starts_with("#") {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not really needed here, the next continue would do

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

actually, the next continue is checking for l.len()==0 so it's different

@@ -54,6 +54,9 @@ use yaml_frame_reader::YamlFrameReader;

mod yaml_frame_writer;
mod json_frame_writer;
mod scene;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this looks like a leftover, and it fails to build

Copy link
Member

@kvark kvark left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Got a few more notes

// strip the comments
let s = &l[0..l.find("#").unwrap_or(l.len())];
let s = s.trim();
if l.len() == 0 {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

that is comparing l.len() and not s.len()? I misread it at first.

let file = BufReader::new(&f);
for line in file.lines() {
let l = line.unwrap();
if l.starts_with("#") {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

actually, the next continue is checking for l.len()==0 so it's different


// strip the comments
let s = &l[0..l.find("#").unwrap_or(l.len())];
let s = s.trim();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

a simpler way, possibly, is: let s = l.split('#').next().unwrap().trim()

@glennw
Copy link
Member

glennw commented Jan 12, 2017

@bors-servo r+

@bors-servo
Copy link
Contributor

📌 Commit bf3993b has been approved by glennw

@glennw
Copy link
Member

glennw commented Jan 12, 2017

This is awesome, thanks!

@bors-servo
Copy link
Contributor

⌛ Testing commit bf3993b with merge 0bbd08a...

bors-servo pushed a commit that referenced this pull request Jan 12, 2017
Wrench Reftests

This is my work-in-progress that adds reftesting functionality to wrench

<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/webrender/695)
<!-- Reviewable:end -->
@bors-servo
Copy link
Contributor

☀️ Test successful - status-travis

@bors-servo bors-servo merged commit bf3993b into servo:master Jan 12, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants