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

UI testing #21

Merged
merged 2 commits into from
Sep 19, 2020
Merged

UI testing #21

merged 2 commits into from
Sep 19, 2020

Conversation

oli-obk
Copy link
Collaborator

@oli-obk oli-obk commented Aug 20, 2020

fixes #20

I tried out compiletest-rs. Even though I set it up for clippy a few years back, I was unable to set it up here. I followed the instructions for finding dependencies, but nothing helped the ui tests to find the tracing_subscriber dependency. Additionally I got arbitrary rebuilds of all dependencies after tests ran and errored. This seemed very fragile and sub-optimal.

So, I wrote a quick script that makes cargo test check the .stderr files next to the examples on whether their output is the expected output. I can pull this into a separate crate if you prefer.

@davidbarsky
Copy link
Owner

I was unable to set it up here. I followed the instructions for finding dependencies, but nothing helped the ui tests to find the tracing_subscriber dependency.

D'oh, that's annoying. The script seems fine to me and I'm happy to merge as-is. Out of curiosity, do you have any opinions on https://github.com/dtolnay/trybuild? I gave it a spin a while back and I was pretty happy with it, but I'm not sure if it has any major deficiencies.

@oli-obk
Copy link
Collaborator Author

oli-obk commented Aug 22, 2020

It has no deficiencies, but I misjudged what the pass tests do. I thought they just were meant to compile successfully, but they are actually run. I'll check how to make it produce stderr dumps for the program being run.

@davidbarsky
Copy link
Owner

Oh, yeah! I just remembered that I opened this issue: dtolnay/trybuild#19.

We can do the workaround (dtolnay/trybuild#19 (comment)) that dtonlay suggested or we can stick with this PR as-is—your choice.

@oli-obk
Copy link
Collaborator Author

oli-obk commented Sep 19, 2020

That's actually fine, we want to execute the program and look at the output. I checked, and trybuild does just that. The problem is that trybuild only normalizes things like paths, but doesn't allow custom normalizations. If we want to test time output, we can't just turn it off on our side, so we need to normalize the output to get rid of actual timing numbers. I have implemented this here, and while we could add something to trybuild that seems like a major change that's not even sketched out and has a huge design space to explore.

@oli-obk
Copy link
Collaborator Author

oli-obk commented Sep 19, 2020

or we can stick with this PR as-is—your choice.

Yea let's do this for now and push generalizing this into the future.

Copy link
Owner

@davidbarsky davidbarsky left a comment

Choose a reason for hiding this comment

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

Looks good, thanks!

@davidbarsky davidbarsky merged commit 5977c7f into davidbarsky:main Sep 19, 2020
@oli-obk oli-obk deleted the fmt_rendering branch September 20, 2020 07:13
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.

"ui" testing
2 participants