Skip to content

Extending cargo test with extra steps #3541

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

Closed
vorner opened this issue Jan 14, 2017 · 6 comments
Closed

Extending cargo test with extra steps #3541

vorner opened this issue Jan 14, 2017 · 6 comments

Comments

@vorner
Copy link

vorner commented Jan 14, 2017

It would be nice if I could specify additional commands/steps to run when running cargo test. The example would be to run cargo fmt -- --write-mode diff as a sub-test, or running the binary (not just its tests) with supplied parameters. Now, I have to type all these commands before committing my code, or wrap them in a makefile.

But, to be honest, I don't have a concrete idea how the configuration would look like while preserving some amount of platform-independence. I know I can create a fake integration test with no harness and do these steps from there, but that sounds a little overcomplicated.

@KalitaAlexey
Copy link
Contributor

KalitaAlexey commented Jan 15, 2017

@vorner,
If I get you right, you want executing some commands before running tests.
You should use either Makefile or cmd/sh script.
Cargo isn't designed as a replacement for them.

@vorner
Copy link
Author

vorner commented Jan 15, 2017

Either after or before, I don't really care about the order.

So, is the right way to use cargo to actually wrap it into something? From all the tutorials I got the impression it should be the user-facing tool, not a backend.

@KalitaAlexey
Copy link
Contributor

@vorner,
Yes, you should wrap it into something.
You can use build.rs to do something before, but it is antipattern.
Look at #545

@vorner
Copy link
Author

vorner commented Jan 18, 2017

So, if you explained this likely isn't going to happen and why, should I close the issue, or is the intention to leave it here just in case the idea gets revisited? Maybe I'm old-school, but I kind of expected a „WontFix“ resolution by now O:-)

@KalitaAlexey
Copy link
Contributor

@vorner,
Your issue is duplicate of #545.
This is why I suggested you to close your issue.

@vorner
Copy link
Author

vorner commented Jan 18, 2017

That one looks similar, but runs at different time, so I don't think it is a direct duplicate (that one talks about post-build, I talk about running during tests). And I didn't get the suggestion to close it myself O:-). OK.

@vorner vorner closed this as completed Jan 18, 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

No branches or pull requests

2 participants