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

Migrate output-type-permutations run-make test to rmake #127098

Merged
merged 3 commits into from
Jul 6, 2024

Conversation

Oneirical
Copy link
Contributor

@Oneirical Oneirical commented Jun 28, 2024

Part of #121876 and the associated Google Summer of Code project.

try-job: x86_64-msvc
try-job: armhf-gnu
try-job: aarch64-apple
try-job: test-various

@rustbot
Copy link
Collaborator

rustbot commented Jun 28, 2024

r? @jieyouxu

rustbot has assigned @jieyouxu.
They will have a look at your PR within the next two weeks and either review your PR or reassign to another reviewer.

Use r? to explicitly pick a reviewer

@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 Jun 28, 2024
@rustbot
Copy link
Collaborator

rustbot commented Jun 28, 2024

This PR modifies tests/run-make/. If this PR is trying to port a Makefile
run-make test to use rmake.rs, please update the
run-make port tracking issue
so we can track our progress. You can either modify the tracking issue
directly, or you can comment on the tracking issue and link this PR.

cc @jieyouxu

Copy link
Contributor

@Kobzol Kobzol left a comment

Choose a reason for hiding this comment

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

Well, what a fun test this is. I think that the "middle section" (at least lines 48 - 78, but maybe even until line 123) could be made more readable by introducing some helper, that would receive rustc in a closure, set flags for it, fill in the emit combinations, and remove the created files between each invocation. But maybe the test structure is too irregular for that, it would need to be tried :)

tests/run-make/output-type-permutations/rmake.rs Outdated Show resolved Hide resolved
tests/run-make/output-type-permutations/rmake.rs Outdated Show resolved Hide resolved
tests/run-make/output-type-permutations/rmake.rs Outdated Show resolved Hide resolved
tests/run-make/output-type-permutations/rmake.rs Outdated Show resolved Hide resolved
tests/run-make/output-type-permutations/rmake.rs Outdated Show resolved Hide resolved
tests/run-make/output-type-permutations/rmake.rs Outdated Show resolved Hide resolved
tests/run-make/output-type-permutations/rmake.rs Outdated Show resolved Hide resolved
@jieyouxu
Copy link
Member

@rustbot author

@rustbot rustbot 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-review Status: Awaiting review from the assignee but also interested parties. labels Jun 29, 2024
@bors
Copy link
Contributor

bors commented Jun 29, 2024

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

@rustbot
Copy link
Collaborator

rustbot commented Jul 2, 2024

The run-make-support library was changed

cc @jieyouxu

@Oneirical Oneirical force-pushed the big-test-party branch 2 times, most recently from 81a8bf8 to da50aae Compare July 2, 2024 19:29
@Oneirical
Copy link
Contributor Author

@rustbot review

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Jul 2, 2024
Copy link
Member

@jieyouxu jieyouxu left a comment

Choose a reason for hiding this comment

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

Thanks, I do find the new structure easier to follow because each sub-test is cleanly grouped. I have some more suggestions which I think makes the test easier to read.

src/tools/run-make-support/src/lib.rs Outdated Show resolved Hide resolved
src/tools/run-make-support/src/lib.rs Outdated Show resolved Hide resolved
Comment on lines 19 to 21
must_exist: &[&'static str],
can_exist: &[&'static str],
dir: &str,
Copy link
Member

Choose a reason for hiding this comment

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

Suggestion: so I thought maybe we could have a param struct for must_exist, can_exist and dir, something like

struct Expectations {
    /// Name of the directory where the test happens.
    test_dir: String,
    /// Output files which must be found. The test fails if any are absent.
    expected_files: Vec<String>,
    /// Allowed output files which will not trigger a failure.
    allowed_files: Vec<String>,
}

and callsite (each test call) can be like

assert_expected_output_files(
    Expectations {
        test_dir: "foo.bar".to_string(),
        expected_files: s!["a.lib", static_lib_name("bar")],
        allowed_files: s!["b.dylib"],
    },
    || { todo!() }
);

I find this helpful because it clearly documents which each parameter means local to each assert_expected_output_files call.

the s![] macro is just a little helper so we can have a mixed list of various kinds of strings (so as long as they impl ToString), it just converts them to a simple Vec<String>.

macro_rules! s {
    ( $( $x:expr ),* ) => {
        {
            let mut temp_vec = Vec::new();
            $(
                temp_vec.push($x.to_string());
            )*
            temp_vec
        }
    };
}

This avoids having to do the Box::leak(Box::new(...)) dance you have below.

Copy link
Member

@jieyouxu jieyouxu Jul 3, 2024

Choose a reason for hiding this comment

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

Note that I used a s![] declarative macro here and not try to do something like I: IntoIterator, I::Item: AsRef<str> because that can't handle heterogeneous element types (like having [&'a str, String] wouldn't work.

Copy link
Contributor Author

@Oneirical Oneirical Jul 3, 2024

Choose a reason for hiding this comment

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

Implemented, see latest commit. Waiting for green CI to switch to review.

@jieyouxu
Copy link
Member

jieyouxu commented Jul 3, 2024

@rustbot author

@rustbot rustbot 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-review Status: Awaiting review from the assignee but also interested parties. labels Jul 3, 2024
Copy link
Member

@jieyouxu jieyouxu left a comment

Choose a reason for hiding this comment

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

Cool, let's run some try jobs, r=me if they come back green.

@jieyouxu
Copy link
Member

jieyouxu commented Jul 3, 2024

@bors try

bors added a commit to rust-lang-ci/rust that referenced this pull request Jul 3, 2024
Migrate `output-type-permutations` `run-make` test to rmake

Part of rust-lang#121876 and the associated [Google Summer of Code project](https://blog.rust-lang.org/2024/05/01/gsoc-2024-selected-projects.html).

try-job: x86_64-msvc
try-job: armhf-gnu
try-job: aarch64-apple
try-job: test-various
@bors
Copy link
Contributor

bors commented Jul 3, 2024

⌛ Trying commit 8378da4 with merge 0e21599...

@rust-log-analyzer

This comment has been minimized.

@bors
Copy link
Contributor

bors commented Jul 4, 2024

⌛ Trying commit db010c6 with merge 87c83f3...

bors added a commit to rust-lang-ci/rust that referenced this pull request Jul 4, 2024
Migrate `output-type-permutations` `run-make` test to rmake

Part of rust-lang#121876 and the associated [Google Summer of Code project](https://blog.rust-lang.org/2024/05/01/gsoc-2024-selected-projects.html).

try-job: x86_64-msvc
try-job: armhf-gnu
try-job: aarch64-apple
try-job: test-various
@bors
Copy link
Contributor

bors commented Jul 4, 2024

☀️ Try build successful - checks-actions
Build commit: 87c83f3 (87c83f3ad1560ed8b67e213f4473f1817b8f5683)

@Oneirical
Copy link
Contributor Author

I added the PathBuf on the line fs_wrapper::remove_file(PathBuf::from(&dir).join(&file)); and the Windows test passes. If you think the test is ready, do not r+ just yet as it will conflict with #126709.

@rustbot review

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Jul 4, 2024
Copy link
Member

@jieyouxu jieyouxu left a comment

Choose a reason for hiding this comment

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

Thanks, looks good, can you x fmt this test? (does x fmt currently work on rmake.rs, I forgor)

tests/run-make/output-type-permutations/rmake.rs Outdated Show resolved Hide resolved
@jieyouxu
Copy link
Member

jieyouxu commented Jul 4, 2024

Marking this as blocked

@rustbot blocked (waiting on #126709)

@rustbot rustbot added S-blocked Status: Marked as blocked ❌ on something else such as an RFC or other implementation work. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Jul 4, 2024
@bors
Copy link
Contributor

bors commented Jul 5, 2024

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

@Oneirical
Copy link
Contributor Author

@rustbot review

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-blocked Status: Marked as blocked ❌ on something else such as an RFC or other implementation work. labels Jul 5, 2024
@jieyouxu
Copy link
Member

jieyouxu commented Jul 6, 2024

@bors r=Kobzol,jieyouxu

@bors
Copy link
Contributor

bors commented Jul 6, 2024

📌 Commit 811532b has been approved by Kobzol,jieyouxu

It is now in the queue for this repository.

@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 Jul 6, 2024
bors added a commit to rust-lang-ci/rust that referenced this pull request Jul 6, 2024
…kingjubilee

Rollup of 5 pull requests

Successful merges:

 - rust-lang#125751 (Add `new_range_api` for RFC 3550)
 - rust-lang#127098 (Migrate `output-type-permutations` `run-make` test to rmake)
 - rust-lang#127369 (Match ergonomics 2024: align with RFC again)
 - rust-lang#127383 (Use verbose style for argument removal suggestion)
 - rust-lang#127392 (Use verbose suggestion for changing arg type)

r? `@ghost`
`@rustbot` modify labels: rollup
@bors bors merged commit 0262972 into rust-lang:master Jul 6, 2024
6 checks passed
@rustbot rustbot added this to the 1.81.0 milestone Jul 6, 2024
rust-timer added a commit to rust-lang-ci/rust that referenced this pull request Jul 6, 2024
Rollup merge of rust-lang#127098 - Oneirical:big-test-party, r=Kobzol,jieyouxu

Migrate `output-type-permutations` `run-make` test to rmake

Part of rust-lang#121876 and the associated [Google Summer of Code project](https://blog.rust-lang.org/2024/05/01/gsoc-2024-selected-projects.html).

try-job: x86_64-msvc
try-job: armhf-gnu
try-job: aarch64-apple
try-job: test-various
@Oneirical Oneirical deleted the big-test-party branch July 6, 2024 14:45
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-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. 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.

6 participants