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

make run-pass tests with empty main just compile-pass tests #54680

Merged
merged 2 commits into from
Oct 3, 2018

Conversation

RalfJung
Copy link
Member

Many run-pass tests have an empty main, so there is not actually any point in running them. This makes them compile-pass tests instead, saving some time (generating the binary and then running it).

For now I did this only for run-pass/issues; if there is interest I can also do it for the other directories. I used ^\s*fn\s+main\(\s*\)\s*\{\s*\} as regexp to identify these files.

@rust-highfive
Copy link
Collaborator

r? @aturon

(rust_highfive has picked a reviewer for you, use r? to override)

@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Sep 29, 2018
@RalfJung
Copy link
Member Author

r? @pnkfelix

@rust-highfive rust-highfive assigned pnkfelix and unassigned aturon Sep 29, 2018
@pnkfelix
Copy link
Member

It seems like this PR is moving a number of the src/test/run-pass/ tests (back?) into the src/test/ui/ directory, which partially reintroduces the problem described at #54047

Long term I wouldn't care, because I am hoping to revise the directory structure to get rid of compile-fail/ and run-pass/, making them all ui tests (and using metadata in the files to let developers control which subset of the tests they wish to run).

Does it not work to tag these tests as // compile-pass while leaving them in src/test/run-pass for now?

@Mark-Simulacrum
Copy link
Member

I seem to recall this historically not being an automatable change because some of the tests are verifying link pass (possibly dynamic link pass?), and maybe llvm-pass, which I'm not sure is the case with compile-pass tests.

@RalfJung
Copy link
Member Author

Does it not work to tag these tests as // compile-pass while leaving them in src/test/run-pass for now?

I thought the directories were supposed to be sorted by the kind of their test.

I seem to recall this historically not being an automatable change because some of the tests are verifying link pass (possibly dynamic link pass?), and maybe llvm-pass,

Ah, dang. I can move everything pack that mentions "link" in any way and everything that has auxiliary files. Not sure if that'd be enough.

@RalfJung
Copy link
Member Author

It seems like this PR is moving a number of the src/test/run-pass/ tests (back?) into the src/test/ui/ directory, which partially reintroduces the problem described at #54047

Well, not entirely. compile-pass tests are faster than run-pass tests. And we already have tons of compile-pass tests in ui, how is that different from the ones being moved there? compile-pass just wasn't a think when they got added.

@pnkfelix
Copy link
Member

pnkfelix commented Oct 1, 2018

I thought the directories were supposed to be sorted by the kind of their test.

We are trying to work our way towards a world where the tests are sorted by language feature (and maybe by compiler module). Eventually, the compile-fail and run-pass distinctions are, I think, going to be solely encoded in per-test metadata embedded in the source text. (Ie everything will be a ui test.)

But since we aren’t there yet (in terms of not being able to select eg all the run-pass tests in every suite), i would prefer to leave the tests that generate no diagnostic output in their current positions in the file system, if the // compile-pass flag indeed works in that context.

If the flag doesn’t work in that context for some reason, then I guess we can just move the files

(And of course, the best thing might be to actually turn each of these tests into meaningful run-pass tests that actually exercise the dynamic semantics...?)

@RalfJung
Copy link
Member Author

RalfJung commented Oct 2, 2018

the best thing might be to actually turn each of these tests into meaningful run-pass tests that actually exercise the dynamic semantics

I don't agree. Many of these just make sure something compiles. They test the type checker to accept stuff, and are not interested in actually running any code.

i would prefer to leave the tests that generate no diagnostic output in their current positions in the file system, if the // compile-pass flag indeed works in that context.

I can make that happen for these tests. However, there are already close to 200 compile-pass tests in the ui folder, I will not move those around.

@RalfJung
Copy link
Member Author

RalfJung commented Oct 2, 2018

But anyway that doesn't even seem to work. This panics even when I have // compile-pass:

fn main() { panic!() }

Not sure why it would do that...

EDIT: Actually, looking at this line that's not surprising.

@pnkfelix
Copy link
Member

pnkfelix commented Oct 2, 2018

I don't agree. Many of these just make sure something compiles. They test the type checker to accept stuff, and are not interested in actually running any code.

Okay. I agree that in those cases there's no reason to put in an actual main.

EDIT: Actually, looking at this line that's not surprising.

Hmm. I would suggest we collapse the first two arms in:

match self.config.mode {
RunPass => true,
Ui => self.props.run_pass,
_ => unimplemented!(),

to just say: RunPass | Ui => self.props.run_pass, but if my memory is correct, I think a problem there is that the run_pass property isn't set, at least not if you don't have the // run-pass comment in the header of the test...

Okay fine I'll just r+ this so we can stop trying to slap band-aids on this in the short term.

@pnkfelix
Copy link
Member

pnkfelix commented Oct 2, 2018

@bors r+

@bors
Copy link
Contributor

bors commented Oct 2, 2018

📌 Commit 1b22bef has been approved by pnkfelix

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Oct 2, 2018
@pnkfelix
Copy link
Member

pnkfelix commented Oct 2, 2018

@bors r-

Just realized that we haven't resolved this question:

I seem to recall this historically not being an automatable change because some of the tests are verifying link pass (possibly dynamic link pass?), and maybe llvm-pass,

Ah, dang. I can move everything pack that mentions "link" in any way and everything that has auxiliary files. Not sure if that'd be enough.

(I assume "move everything pack" there was meant to be "move everything back" ...)

@bors bors added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. labels Oct 2, 2018
@RalfJung
Copy link
Member Author

RalfJung commented Oct 2, 2018

Yes, I did grep for "link" and moved everything back that had that term in it.

I also just realized some tests used pub fn main, and added those here.

@pnkfelix
Copy link
Member

pnkfelix commented Oct 2, 2018

@bors r+

@bors
Copy link
Contributor

bors commented Oct 2, 2018

📌 Commit 454b14a has been approved by pnkfelix

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Oct 2, 2018
pietroalbini added a commit to pietroalbini/rust that referenced this pull request Oct 2, 2018
make run-pass tests with empty main just compile-pass tests

Many run-pass tests have an empty main, so there is not actually any point in running them. This makes them `compile-pass` tests instead, saving some time (generating the binary and then running it).

For now I did this only for `run-pass/issues`; if there is interest I can also do it for the other directories. I used `^\s*fn\s+main\(\s*\)\s*\{\s*\}` as regexp to identify these files.
pietroalbini added a commit to pietroalbini/rust that referenced this pull request Oct 2, 2018
make run-pass tests with empty main just compile-pass tests

Many run-pass tests have an empty main, so there is not actually any point in running them. This makes them `compile-pass` tests instead, saving some time (generating the binary and then running it).

For now I did this only for `run-pass/issues`; if there is interest I can also do it for the other directories. I used `^\s*fn\s+main\(\s*\)\s*\{\s*\}` as regexp to identify these files.
bors added a commit that referenced this pull request Oct 2, 2018
Rollup of 10 pull requests

Successful merges:

 - #54269 (#53840: Consolidate pattern check errors)
 - #54458 (Allow both explicit and elided lifetimes in the same impl header)
 - #54603 (Add `crate::` to trait suggestions in Rust 2018.)
 - #54648 (Update Cargo's submodule)
 - #54680 (make run-pass tests with empty main just compile-pass tests)
 - #54687 (Use impl_header_lifetime_elision in libcore)
 - #54699 (Re-export `getopts` so custom drivers can reference it.)
 - #54702 (do not promote comparing function pointers)
 - #54728 (Renumber `proc_macro` tracking issues)
 - #54745 (make `CStr::from_bytes_with_nul_unchecked()` a const fn)

Failed merges:

r? @ghost
@bors bors merged commit 454b14a into rust-lang:master Oct 3, 2018
@pnkfelix
Copy link
Member

Hmm. How can we best prevent cases like #44056 from being swept up in changes like this in the future...

@RalfJung RalfJung deleted the compile-pass branch November 9, 2018 15:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants