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

Converted Rust Test Case to DejaGnu #3071

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

MahadMuhammad
Copy link
Contributor

A very simple PR to Investigate test case from https://github.com/rust-lang/rust/tree/master/tests/ui/anon-params. To convert this into equivalent Rust source file with dejagnu directives instead of ERROR directives


gcc/testsuite/ChangeLog:

* rust/compile/anon-params-denied-2018.rs: New test.
* rust/compile/anon-params-deprecated.rs: New test.

Details

Thanks to this email thread: https://patchwork.ozlabs.org/project/gcc/patch/[email protected]/. I was able to understand the relative line number. Otherwise, it would be difficult to stop dejagnu from shouting

Investigate test case from  https://github.com/rust-lang/rust/tree/master/tests/ui/anon-params

gcc/testsuite/ChangeLog:

	* rust/compile/anon-params-denied-2018.rs: New test.
	* rust/compile/anon-params-deprecated.rs: New test.

Signed-off-by: Muhammad Mahad <[email protected]>
@MahadMuhammad
Copy link
Contributor Author

Additionally, there are some mismatches between rustc error output and gccrs error outputs. I also need to look into that.

Copy link
Member

@CohenArthur CohenArthur left a comment

Choose a reason for hiding this comment

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

I notice that you've adapted the error messages to be the ones output by gccrs. I think our strategy for now should be the following:

  1. If there is an error code, then take it and copy it for the dg-error message
  2. otherwise, just add an empty dg-error

we don't want the error messages to match exactly, but we do want the error codes to match exactly. in the future, we can think about doing something like a map from Rust error messages to gccrs error messages, but that should come later :)

@MahadMuhammad MahadMuhammad marked this pull request as draft June 28, 2024 18:33
Comment on lines +17 to +20
// { TODO "expecting .:. but .,. found" "" { target *-*-* } .-1 }
// { TODO "expecting .\\). but .,. found" "" { target *-*-* } .-2 }
//~^ ERROR expected one of `:`
//~| ERROR expected one of `:`
Copy link
Member

Choose a reason for hiding this comment

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

are those TODO because gccrs doesn't output an error here?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, gccrs doesn't omits output here (see line 16 here: https://godbolt.org/z/MGdE35PPT) maybe due to excess errors. However, it emits output for fn definition, see here: https://godbolt.org/z/WEr89c5xq.

@tschwinge
Copy link
Member

I suggest we eventually put these "external" test cases into a separate directory, which then also contains some README file describing where they're coming from, and which exact upstream revision they're based on.

You may extend the glob in gcc/testsuite/rust/compile/compile.exp to look into that new directory, too, or have a separate *.exp file in the new directory, if that's maybe useful for other reasons (like, to specify default compilation flags to dg-runtest). See, for example, gcc/testsuite/gcc.dg/gomp/gomp.exp search two directories by default, and specify -fopenmp by default.

@CohenArthur
Copy link
Member

yeah, I believe the best thing would be to go with a separate .exp file because we might eventually want to tweak it as you said Thomas. so I would just copy the compile.exp file so that it works for that new directory

@MahadMuhammad
Copy link
Contributor Author

Sure. I'll work on that. Also, the test cases in this PR have very different output on rustc (see this: https://godbolt.org/z/MGdE35PPT). So, should I update this PR with only with the error codes of rustc?

MahadMuhammad added a commit to MahadMuhammad/gccrs that referenced this pull request Jul 8, 2024
ported from <https://github.com/rust-lang/rust/blob/master/tests/ui/associated-types/issue-22037.rs>
Manually converted testcase to dejagnu format according
to Rust-GCC#3071 (review)

gcc/testsuite/ChangeLog:

	* rust/external/associated-type.rs: New test.

Signed-off-by: Muhammad Mahad <[email protected]>
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.

3 participants