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

Screenshotter: Add --diff and --attempts options. #736

Merged
merged 1 commit into from Jul 6, 2017

Conversation

kohler
Copy link
Collaborator

@kohler kohler commented Jun 17, 2017

--diff produces a texcmp-like diff in test/screenshotter/diffs.

@kohler
Copy link
Collaborator Author

kohler commented Jun 27, 2017

@gagern ?

@gagern
Copy link
Collaborator

gagern commented Jun 27, 2017

Sorry, forgot to comment. I like the general idea.

I'm a bit confused by the fact that you are using a different convert invocation than texcmp. If your command is superior (looks like your green might be better to see), it would make sense to use that in both places for the sake of consistency.

As convert is invoked outside the docker, it might be worth indicating that ImageMagick has to be installed. Do we want to support gm convert from GraphicsMagick as an alternative? If so, how do we tell which one to use? Autodetect or let the user configure?

The line where you ignore errors from mkdir might be worth a comment. I assume that this is mainly in order to deal with EEXIST, relying on the fact that any other error creating the directory should lead to a write error later on. Correct?

I have a very slight dislike for the temporary file you write then delete. ImageMagick should be able to read that image from standard input. But adjusting the whole machinery so that it can feed input to the executed file makes things considerably more complicated and less generic, so I doubt that's actually worth changing.

@gagern
Copy link
Collaborator

gagern commented Jun 27, 2017

Oh, and we probably should make sure the directory for the diffs is included in .gitignore. Right now that contains the singular diff for use by texcmp, while you are using plural diffs here. I find the distinction between singular and plural rather confusing, so I'd say either re-use diff or pick something more descriptive. I'd prefer reusing.

@kohler
Copy link
Collaborator Author

kohler commented Jun 27, 2017

Sorry, forgot to comment. I like the general idea.

Good!

I'm a bit confused by the fact that you are using a different convert invocation than texcmp. If your command is superior (looks like your green might be better to see), it would make sense to use that in both places for the sake of consistency.

The texcmp invocation does not work for my imagemagick. (Version: ImageMagick 7.0.6-0 Q16 x86_64 2017-06-12 http://www.imagemagick.org)

As convert is invoked outside the docker, it might be worth indicating that ImageMagick has to be installed. Do we want to support gm convert from GraphicsMagick as an alternative? If so, how do we tell which one to use? Autodetect or let the user configure?

This is not a feature that's required to build or use katex so I do not want to do a ton of unnecessary hardening…

The line where you ignore errors from mkdir might be worth a comment. I assume that this is mainly in order to deal with EEXIST, relying on the fact that any other error creating the directory should lead to a write error later on. Correct?

Will comment.

I have a very slight dislike for the temporary file you write then delete. ImageMagick should be able to read that image from standard input. But adjusting the whole machinery so that it can feed input to the executed file makes things considerably more complicated and less generic, so I doubt that's actually worth changing.

Agree.

Oh, and we probably should make sure the directory for the diffs is included in .gitignore. Right now that contains the singular diff for use by texcmp, while you are using plural diffs here. I find the distinction between singular and plural rather confusing, so I'd say either re-use diff or pick something more descriptive. I'd prefer reusing.

Sorry, yes, diff is better.

@kohler
Copy link
Collaborator Author

kohler commented Jun 27, 2017

Changed to diff.

@kohler
Copy link
Collaborator Author

kohler commented Jun 30, 2017

@gagern any more comments? I have not changed texcmp imagemagick invocation but could do so later.

@edemaine
Copy link
Member

edemaine commented Jun 30, 2017

Is this supposed to eventually replaced texcmp? Is the idea that screenshotter.sh --diff is simpler and possibly faster than screenshotter.sh then texcmp.sh (especially with changing directories in between)? I also like not having to remember two different ways to specify a single example to run.

I see that texcmp wasn't mentioned in the documentation anywhere. Maybe we should add some documentation to CONTRIBUTING.md (around Screenshot tests) about how to use this and/or texcmp? This would be a(nother) good place to mention "...if you have ImageMagick installed" for screenshotter.sh --diff.

@kohler
Copy link
Collaborator Author

kohler commented Jun 30, 2017

texcmp and screenshotter.sh --diff have different purposes. Texcmp compares with tex output, screenshotter compares a new KaTeX-generated image with an older one.

@edemaine
Copy link
Member

Oh, I see! That makes sense. But I didn't guess from the initial description the option help string. Perhaps change "produce image diffs" with "produce image diffs against existing screenshots" or similar?

@kohler
Copy link
Collaborator Author

kohler commented Jun 30, 2017

????? was --verify reference in the previous help line not enough?

@edemaine
Copy link
Member

It's clear now.

@kevinbarabash
Copy link
Member

Hmm... not sure why travis didn't run tests on b3aa1b4.

@kevinbarabash
Copy link
Member

@kohler can you push a commit with a trivial change? Hopefully that'll be enough to make travis run the tests.

Copy link
Member

@kevinbarabash kevinbarabash left a comment

Choose a reason for hiding this comment

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

LGTM

--diff produces a texcmp-like diff in test/screenshotter/diff.
@kohler
Copy link
Collaborator Author

kohler commented Jul 6, 2017

There's something weird going on with Travis. I rebased; here's a direct link to the successful Travis build, though that's not appearing here.

My repo: https://travis-ci.org/kohler/KaTeX/builds/250744199

PR: https://travis-ci.org/Khan/KaTeX/builds/250744209

@kevinbarabash
Copy link
Member

Good enough for me.

@kevinbarabash kevinbarabash merged commit f43b00b into KaTeX:master Jul 6, 2017
@kevinbarabash
Copy link
Member

@kohler thanks for the PR. Hopefully this is a one off situation with travis.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants