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

passes: Add pass to run gccrs on the full rustc ui testsuite #7

Merged
merged 5 commits into from
Apr 21, 2022

Conversation

CohenArthur
Copy link
Member

@CohenArthur CohenArthur commented Apr 13, 2022

What we now need is a translator from rustc errors to gccrs errors, and a fallback invalid error message in case the error does not exist/cannot be represented by gccrs yet, causing the test to assurely fail.

This will also require you to update ftf to benefit from the new matching behavior on stdout/stderr instead of strict equality

@CohenArthur CohenArthur force-pushed the full-rustc-testsuite branch 3 times, most recently from fe2d4ee to 9891ebe Compare April 20, 2022 14:22
CohenArthur and others added 3 commits April 20, 2022 16:28
This pass is actually three new passes: A regular one, one with only the
files successfully compiling with `#![no_std]` and one with only the
files succesfully compiling with `#![no_core]`
Co-authored-by: flip1995 <philipp.krones@embecosm.com>

// We're only interested in successes
if test_content.contains("ERROR") {
return Ok(TestCase::default());
Copy link
Member

@flip1995 flip1995 Apr 20, 2022

Choose a reason for hiding this comment

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

IIUC you return an empty TestCase as a kind of an error state. Why not add another Error variant and return that?

Copy link
Member Author

Choose a reason for hiding this comment

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

The idea behind returning an "empty" test case and then checking for it afterwards (in your next comment) is that it is still valid - we simply want to skip this file and not generate a proper assertion for it. try_fold short circuits the execution on Err values, so we would end up not generating all the test cases we want. Unless I'm misunderstanding something about the way try_fold works, which is entirely possible :D

Copy link
Member Author

Choose a reason for hiding this comment

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

I agree that the naming and checking afterwards could be better. I'll work on something!

Copy link
Member

Choose a reason for hiding this comment

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

Hm..

Maybe turn the TestCase struct into an enum TestCase { Test{..}, Skip } and then return TestCase::Skip if you want to skip it.

src/main.rs Outdated
Comment on lines 78 to 79
if test_case.is_empty() {
Ok(acc)
Copy link
Member

Choose a reason for hiding this comment

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

When returning a proper error instead of a returning and implicit tristate type, this change is unnecessary.

src/passes/gccrs_rustc_successes.rs Show resolved Hide resolved
@CohenArthur
Copy link
Member Author

@flip1995 I turned TestCase into an enum with two variants, per your suggestion. I'm merging this for now but if you have suggestions on how to improve the API or the builder pattern I'm all ears

Copy link
Member

@flip1995 flip1995 left a comment

Choose a reason for hiding this comment

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

LGTM (you forgot to merge :))

@CohenArthur CohenArthur merged commit af0e594 into main Apr 21, 2022
@CohenArthur CohenArthur deleted the full-rustc-testsuite branch April 21, 2022 17:54
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.

None yet

2 participants