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 validate_json.py script to rust in run-make/rustdoc-map-file test #129149

Merged
merged 2 commits into from
Aug 16, 2024

Conversation

GuillaumeGomez
Copy link
Member

This PR fixes the FIXME I added for future-me who become present-me. :')

Since there are multiple run-make tests using python scripts, I suppose more of them will migrate to Rust, hence why I added the jzon public reexport to the run-make-support crate.

cc @jieyouxu
r? @Kobzol

@GuillaumeGomez GuillaumeGomez changed the title Migrate validate_json.py script to rust in run-make/rustdoc-map-file test Migrate validate_json.py script to rust in run-make/rustdoc-map-file test Aug 16, 2024
@rustbot rustbot added A-run-make Area: port run-make Makefiles to rmake.rs S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Aug 16, 2024
@rustbot
Copy link
Collaborator

rustbot commented Aug 16, 2024

These commits modify the Cargo.lock file. Unintentional changes to Cargo.lock can be introduced when switching branches and rebasing PRs.

If this was unintentional then you should revert the changes before this PR is merged.
Otherwise, you can ignore this comment.

The run-make-support library was changed

cc @jieyouxu

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
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! I have a few questions about jzon and the test itself, but I'm glad it's viable to get rid of the python script :3

Cargo.lock Outdated Show resolved Hide resolved
tests/run-make/rustdoc-map-file/rmake.rs Outdated Show resolved Hide resolved
tests/run-make/rustdoc-map-file/rmake.rs Outdated Show resolved Hide resolved
tests/run-make/rustdoc-map-file/rmake.rs Outdated Show resolved Hide resolved
tests/run-make/rustdoc-map-file/rmake.rs Outdated Show resolved Hide resolved
tests/run-make/rustdoc-map-file/rmake.rs Outdated Show resolved Hide resolved
tests/run-make/rustdoc-map-file/rmake.rs Show resolved Hide resolved
tests/run-make/rustdoc-map-file/rmake.rs Show resolved Hide resolved
@jieyouxu
Copy link
Member

jieyouxu commented Aug 16, 2024

r? jieyouxu (unless you want Kobzol to review this specifically)

@rustbot rustbot assigned jieyouxu and unassigned Kobzol Aug 16, 2024
@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 Aug 16, 2024
@GuillaumeGomez
Copy link
Member Author

Sum up of what I did:

  • I replaced jzon with serde_json (still reexported).
  • I stopped recursively going through folders and simply get the file from a known path (which is actually better since if we change the path, better to know it).
  • Removed usage of exit and only use panic instead.
  • Added a comment explaining what the test is checking.

@GuillaumeGomez
Copy link
Member Author

Ah I forgot the improvement for error messages. Done as well. :)

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, this looks good! Just one minor style nit on the re-export. Feel free to r=me after the nit once PR CI is green.

src/tools/run-make-support/src/lib.rs Outdated Show resolved Hide resolved
@GuillaumeGomez
Copy link
Member Author

Moved the reexport with the others.

@rust-log-analyzer

This comment has been minimized.

@GuillaumeGomez
Copy link
Member Author

The error is super weird:

cannot determine resolution for the import

It works locally, and serde_json name is only present once at crate root. I rebased just in case...

@jieyouxu
Copy link
Member

... but that seems to work now, so... 🤷

@bors r+ rollup

@bors
Copy link
Contributor

bors commented Aug 16, 2024

📌 Commit 6b1637c has been approved by 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-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Aug 16, 2024
bors added a commit to rust-lang-ci/rust that referenced this pull request Aug 16, 2024
…iaskrgr

Rollup of 6 pull requests

Successful merges:

 - rust-lang#128990 (Re-enable more debuginfo tests on freebsd)
 - rust-lang#129042 (Special-case alias ty during the delayed bug emission in `try_from_lit`)
 - rust-lang#129086 (Stabilize `is_none_or`)
 - rust-lang#129149 (Migrate `validate_json.py` script to rust in `run-make/rustdoc-map-file` test)
 - rust-lang#129154 (Fix wrong source location for some incorrect macro definitions)
 - rust-lang#129161 (Stabilize std::thread::Builder::spawn_unchecked)

r? `@ghost`
`@rustbot` modify labels: rollup
@bors bors merged commit 7177a0e into rust-lang:master Aug 16, 2024
6 checks passed
@rustbot rustbot added this to the 1.82.0 milestone Aug 16, 2024
rust-timer added a commit to rust-lang-ci/rust that referenced this pull request Aug 16, 2024
Rollup merge of rust-lang#129149 - GuillaumeGomez:migrate-python-script, r=jieyouxu

Migrate `validate_json.py` script to rust in `run-make/rustdoc-map-file` test

This PR fixes the FIXME I added for future-me who become present-me. :')

Since there are multiple `run-make` tests using python scripts, I suppose more of them will migrate to Rust, hence why I added the `jzon` public reexport to the `run-make-support` crate.

cc `@jieyouxu`
r? `@Kobzol`
@GuillaumeGomez GuillaumeGomez deleted the migrate-python-script branch August 16, 2024 22:51
@Zalathar
Copy link
Contributor

Heh, I was also working on a version of this, and only noticed when my own changes wouldn't rebase cleanly onto master. 😅

My approach was to add a Diff::normalize_json method that pretty-prints the "actual" text before diffing it, which lets us get rid of all the ad-hoc JSON-diffing code. I might still write up my own PR because I think it's a modest improvement over this version, and a similar technique can be used to get rid of the (trivial) Python script in run-make/libtest-json.

@GuillaumeGomez
Copy link
Member Author

I'm not sure it's worth it to have anything more advanced than this but don't let it stop you. 😉

@tgross35
Copy link
Contributor

Bors is not correctly removing items from the queue

@bors r-

@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 Aug 17, 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 S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author.
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

8 participants