Skip to content

compiletest: avoid invoking rustc with absolute paths. #330

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

Merged
merged 1 commit into from
Jul 11, 2025

Conversation

eddyb
Copy link
Collaborator

@eddyb eddyb commented Jul 11, 2025

This PR makes the compiletests runner change its current working dir to tests/compiletests/, allowing the source paths, that the compiletest crate invokes rustc with, to always be relative e.g. ui/foo/bar.rs.

Among other things, this should help with @Firestar99 not being able to get the ui/spirv-attr/invalid-target.rs test to pass, because the JSON output is slightly too long and gets abbreviated with a big <<<<<< SKIPPED 1026 BYTES >>>>>> in the middle, due to harcoded limits in the compiletest crate itself.


This also cleans up the $OPSTRING_FILENAME hack used by disassembly tests, but I'm worried that will break on Windows again, so I'm opening this as a draft to see what that situation is like.
(I do think that the main reason for that hack was that the replacement of the test base path w/ $DIR wouldn't kick in on Windows, but that's a much bigger issue for absolute paths, than for relative ones, so it might be easier to work around it now)

EDIT: the situation is predictable enough that I added a "ui/dis/" -> "$DIR" normalization rule to the impacted tests (by that point, compiletest had already replaced all \\ with /, so even if its own $DIR replacement failed, it should at least predictably result in paths like ui/dis/ even on Windows).

@eddyb eddyb force-pushed the abs-no-thanks branch 2 times, most recently from 15b9980 to 76fa146 Compare July 11, 2025 14:08
@eddyb eddyb marked this pull request as ready for review July 11, 2025 14:08
@eddyb eddyb enabled auto-merge July 11, 2025 14:08
@eddyb eddyb force-pushed the abs-no-thanks branch 2 times, most recently from 69e9b65 to 8133ac2 Compare July 11, 2025 14:38
Copy link
Member

@Firestar99 Firestar99 left a comment

Choose a reason for hiding this comment

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

Works!

Eventually we should maybe have a default set of normalize-stderr-test that just applies to all tests, instead of pasting them everywhere.

@eddyb eddyb added this pull request to the merge queue Jul 11, 2025
Merged via the queue into Rust-GPU:main with commit c020eda Jul 11, 2025
13 checks passed
@eddyb eddyb deleted the abs-no-thanks branch July 11, 2025 16:05
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.

2 participants