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

Convert all Makefile tests to rmake tests with legacy-makefile-test #131598

Closed
wants to merge 1 commit into from

Conversation

Zalathar
Copy link
Contributor

We can't remove Makefile support from compiletest yet, because #121876 isn't quite complete.

But it occurred to me that we can remove some of the Makefile support with a neat little trick: give every legacy Makefile test a dummy rmake.rs file containing a special directive that tells compiletest to run the Makefile, instead of building and running the rmake recipe.

Thus, while we still can't remove run_rmake_legacy_test, we can at least start removing Makefile support from the “frontend” parts like test discovery and directive parsing.


Marking as draft for now because I want to let the idea bake a little more. But so far it does seem like a useful step towards being able to clean up various parts of the compiletest frontend.

r? ghost

@rustbot rustbot added A-run-make Area: port run-make Makefiles to rmake.rs A-testsuite Area: The testsuite used to check the correctness of rustc S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap) labels Oct 12, 2024
@Zalathar
Copy link
Contributor Author

@rustbot experimental

cc @jieyouxu

@Zalathar Zalathar added S-experimental Status: Ongoing experiment that does not require reviewing and won't be merged in its current state. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Oct 12, 2024
@Zalathar
Copy link
Contributor Author

Originally I was hoping to be able to have real rmake recipes that just called a run_make_support::make() function, but after looking at the implementation of run_rmake_legacy_test I quickly gave up on that. So then I got the idea to just have a dummy rmake.rs with a directive instead.

@jieyouxu
Copy link
Member

I'm not super keen on doing this just yet, because I feel like we're better served with waiting a bit and just yeeting the entire legacy infra in one go:

  • I would still like to first port over the existing Makefiles. I'll try to see if I can push forward with that in the coming week.
  • I would prefer to do some prototyping on how a "sane" version of test discovery and directive handling would look like first. I'm worried that trying to do ad-hoc adjustments at the moment might further obfuscate matters than it already is. I should start a bootstrap zulip thread for this, for brainstorming and discussions.

@@ -856,7 +864,7 @@ fn iter_header(
return;
}

let Some((header_revision, non_revisioned_directive_line)) = line_directive(comment, ln)
let Some((header_revision, non_revisioned_directive_line)) = line_directive("//@", ln)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

It turns out that line_directive is also called by debugger tests to parse its own “directives” with a // prefix. But I hope to be able to eventually split that off to use its own separate parsing function.

Comment on lines +131 to +137
let mut props = {
let file = match config.mode {
Mode::RunMake => &testpaths.file.join("rmake.rs"),
_ => &testpaths.file,
};
TestProps::from_file(file, revision, &config)
};
Copy link
Contributor Author

Choose a reason for hiding this comment

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

In the future I'd like to experiment with making the canonical name of a run-make test be the path of its rmake.rs, rather than the path of the enclosing directory. That should help eliminate a bunch of special cases for dealing with Mode::RunMake.

But when I tried, there were enough little complications that I didn't want to do so immediately in this PR.

Copy link
Member

@jieyouxu jieyouxu Oct 12, 2024

Choose a reason for hiding this comment

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

I have found working with the Testpaths abstraction to be tricky, among other things.

Copy link
Member

Choose a reason for hiding this comment

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

That sounds reasonable to me. Yeah, there are some quirks with a specific primary test file vs directory, but I haven't done an extensive survey on that yet.

@Zalathar
Copy link
Contributor Author

I'm not super keen on doing this just yet, because I feel like we're better served with waiting a bit and just yeeting the entire legacy infra in one go:

Fair enough. I'm happy to leave this sitting around as an experimental draft of an interesting idea, and if it turns out to be unnecessary (or unwise) then that's a fine outcome too.

@rust-log-analyzer
Copy link
Collaborator

The job mingw-check failed! Check out the build log: (web) (plain)

Click to see the possible cause of the failure (guessed by this bot)
#16 2.878 Building wheels for collected packages: reuse
#16 2.879   Building wheel for reuse (pyproject.toml): started
#16 3.123   Building wheel for reuse (pyproject.toml): finished with status 'done'
#16 3.125   Created wheel for reuse: filename=reuse-4.0.3-cp310-cp310-manylinux_2_35_x86_64.whl size=132715 sha256=dfa09868353292d98f811d3efdb0d54d07389e808efc71d68e3b93c514bf8bec
#16 3.125   Stored in directory: /tmp/pip-ephem-wheel-cache-3vmfn9ni/wheels/3d/8d/0a/e0fc6aba4494b28a967ab5eaf951c121d9c677958714e34532
#16 3.127 Installing collected packages: boolean-py, binaryornot, tomlkit, reuse, python-debian, markupsafe, license-expression, jinja2, chardet, attrs
#16 3.531 Successfully installed attrs-23.2.0 binaryornot-0.4.4 boolean-py-4.0 chardet-5.2.0 jinja2-3.1.4 license-expression-30.3.0 markupsafe-2.1.5 python-debian-0.1.49 reuse-4.0.3 tomlkit-0.13.0
#16 3.531 WARNING: Running pip as the 'root' user can result in broken permissions and conflicting behaviour with the system package manager. It is recommended to use a virtual environment instead: https://pip.pypa.io/warnings/venv
#16 DONE 3.6s
---

---- header::tests::revisions stdout ----
thread 'header::tests::revisions' panicked at src/tools/compiletest/src/header/tests.rs:228:5:
assertion `left == right` failed
  left: []
 right: ["hello", "there"]


failures:
    header::tests::revisions

@bors
Copy link
Contributor

bors commented Oct 18, 2024

☔ The latest upstream changes (presumably #131895) made this pull request unmergeable. Please resolve the merge conflicts.

@bors bors added the S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. label Oct 18, 2024
@Zalathar Zalathar closed this Nov 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-run-make Area: port run-make Makefiles to rmake.rs A-testsuite Area: The testsuite used to check the correctness of rustc S-experimental Status: Ongoing experiment that does not require reviewing and won't be merged in its current state. S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap)
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

5 participants