Skip to content

Add support for parsing rust unit tests #7858

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
wants to merge 2 commits into from

Conversation

dcbaker
Copy link
Member

@dcbaker dcbaker commented Oct 16, 2020

this is a pretty basic first step for rust testing. What I'd like to follow up with is a rust module method that can be passed a rust build target, and create a new executable and test target with thaat information. But for now getting support for getting the test outputs and putting them in the junit xml that meson test generates seems like a good start.

for non tap tests we want to associate names with the tests, to that end
store them as a dict. For TAP tests, we'll store the "name" as an
integer string that coresponds to the order that the tests were run in.
@anholt
Copy link

anholt commented Oct 16, 2020

Shouldn't we also have a passing rust unit test, to make sure we're parsing its output successfully?

@anholt
Copy link

anholt commented Oct 16, 2020

I looked into the arguments of rust test binaries, and this does seem like the right way to be running and parsing them, at least for now (apparently there's json output for tests, but that's a nightly feature)

@dcbaker
Copy link
Member Author

dcbaker commented Oct 16, 2020

There's several features that are "nightly only" that would be really nice to have (there's one to tell you what linker rustc is going to invoke, which would make the other bug just go away :(

@dcbaker dcbaker force-pushed the submit/rust-test-support branch from 6038af6 to e60daf8 Compare October 16, 2020 20:35
@dcbaker
Copy link
Member Author

dcbaker commented Oct 16, 2020

I've added both a case of no failing, and of all skip. It seems that we don't have a way with our test.json to give expected test results yet. I'm not sure I want to go down that path right now though.

@anholt
Copy link

anholt commented Oct 16, 2020

rust test support lgtm, I'll leave the second commit to more of a meson insider.

@dcbaker
Copy link
Member Author

dcbaker commented Oct 16, 2020

Here's a draft MR for the helper I want to add: #7860

Rust has it's own built in unit test format, which is invoked by
compiling a rust executable with the `--test` flag to rustc. The tests
are then run by simply invoking that binary. They output a custom test
format, which this patch adds parsing support for. This means that we
can report each subtest in the junit we generate correctly, which should
be helpful for orchestration systems like gitlab and jenkins which can
parse junit XML.
@dcbaker dcbaker force-pushed the submit/rust-test-support branch from e60daf8 to 447f31f Compare October 16, 2020 23:27
@dcbaker
Copy link
Member Author

dcbaker commented Nov 20, 2020

#7860 contains this, with fixes. Closing in favor of that.

@dcbaker dcbaker closed this Nov 20, 2020
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.

2 participants