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

Revert "tidy: validate LLVM component names in tests" #125949

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

erikdesjardins
Copy link
Contributor

This reverts #125472.

This has already caused a bit of trouble, and I was mistaken about the original motivation--incorrect component names will be detected by a full CI run.

I no longer think it pulls its weight.

r? @workingjubilee

…r=clubby789"

This reverts commit 64730a1, reversing
changes made to 80aea30.
@rustbot rustbot added 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 4, 2024
@RalfJung
Copy link
Member

RalfJung commented Jun 4, 2024

Ideally we'd document this somewhere. Is there a place that we document the meaning of all the ui-test annotations? For @needs-llvm-component we could then mention COMPILETEST_REQUIRE_ALL_LLVM_COMPONENTS.

@jieyouxu
Copy link
Member

jieyouxu commented Jun 4, 2024

Ideally we'd document this somewhere. Is there a place that we document the meaning of all the ui-test annotations? For @needs-llvm-component we could then mention COMPILETEST_REQUIRE_ALL_LLVM_COMPONENTS.

cc #125706

rustc-dev-guide has some non-exhaustive description of various UI test directives and annotations, but AFAIK we don't have an exhaustive list of descriptions.

@workingjubilee
Copy link
Member

@Hoverbear what do you think? would you have wanted to wait until after your PR was r+'d?

@RalfJung
Copy link
Member

RalfJung commented Jun 4, 2024 via email

@Hoverbear
Copy link
Contributor

@workingjubilee I do not believe this impacts me, go for it. :)

@erikdesjardins
Copy link
Contributor Author

Opened rust-lang/rustc-dev-guide#1990 to add COMPILETEST_REQUIRE_ALL_LLVM_COMPONENTS to the docs.

@workingjubilee
Copy link
Member

workingjubilee commented Jun 12, 2024

hmm.

I realize this caused a bit of issues but I don't think it really doesn't pull its weight? I think what the troubles point to is a need for a more centralized way in the repo of describing "this is the list of components we want to build LLVM with, generally speaking".

@workingjubilee
Copy link
Member

the troubles, after all, did also lead to us reenabling a test.

@RalfJung
Copy link
Member

The test was disabled because of a confusing a error message in the "all components must be available" check, and because that check erroneously ran on a build of LLVM that does not have all components. Not sure if this is a good argument to keep the new tidy check around: the actually relevant point is that someone looked into whether there is a "csky" component.

Having to maintain yet another list in tidy better come with sufficient benefits for this extra paperwork. I am not convinced that is the case here.

@workingjubilee
Copy link
Member

Having to maintain yet another list in tidy better come with sufficient benefits for this extra paperwork. I am not convinced that is the case here.

That's the thing that I think is the actual problem: tidy shouldn't have even one single list that is just "the list of things we're feeding into rustc's build anyways". That's a file that can be shared between crates, so it should be somewhere it can be shared.

@workingjubilee
Copy link
Member

...like, why does every single test that specifies a --target have to have a needs-llvm-components directive anyways???

if we want to talk about duplication...

@Dylan-DPC
Copy link
Member

@erikdesjardins @workingjubilee what's the status on this? thanks

@jieyouxu jieyouxu self-assigned this Oct 28, 2024
@jieyouxu
Copy link
Member

jieyouxu commented Oct 28, 2024

Could someone elaborate what the "root" thing the llvm component checks are trying to address?

let llvm::LlvmResult { llvm_config, .. } =
builder.ensure(llvm::Llvm { target: builder.config.build });
if !builder.config.dry_run() {
let llvm_version =
command(&llvm_config).arg("--version").run_capture_stdout(builder).stdout();
let llvm_components =
command(&llvm_config).arg("--components").run_capture_stdout(builder).stdout();
// Remove trailing newline from llvm-config output.
cmd.arg("--llvm-version")
.arg(llvm_version.trim())
.arg("--llvm-components")
.arg(llvm_components.trim());
llvm_components_passed = true;
}
if !builder.is_rust_llvm(target) {
// FIXME: missing Rust patches is not the same as being system llvm; we should rename the flag at some point.
// Inspecting the tests with `// no-system-llvm` in src/test *looks* like this is doing the right thing, though.
cmd.arg("--system-llvm");
}

bootstrap knows which (local) llvm components are available via llvm-config --components, and this info is made available to compiletest in

if let Some(needed_components) =
config.parse_name_value_directive(line, "needs-llvm-components")
{
let components: HashSet<_> = config.llvm_components.split_whitespace().collect();
if let Some(missing_component) = needed_components
.split_whitespace()
.find(|needed_component| !components.contains(needed_component))
{
if env::var_os("COMPILETEST_REQUIRE_ALL_LLVM_COMPONENTS").is_some() {
panic!(
"missing LLVM component {}, and COMPILETEST_REQUIRE_ALL_LLVM_COMPONENTS is set",
missing_component
);
}
return IgnoreDecision::Ignore {
reason: format!("ignored when the {missing_component} LLVM component is missing"),
};
}
}

But frankly, I don't quite understand what these things together are trying to check. In particular, what is COMPILETEST_REQUIRE_ALL_LLVM_COMPONENTS intended to do?

Note that just using a llvm-config --components might not be sufficient: our CI has a particular set of available llvm components. However, a user local custom llvm can report a different list of available llvm components. If we tried to use llvm-config --components as the ground truth on the user's system, this can cause a naively implemented unknown components check to fail.

@RalfJung
Copy link
Member

RalfJung commented Oct 28, 2024

In particular, what is COMPILETEST_REQUIRE_ALL_LLVM_COMPONENTS intended to do?

See #125710: it makes a missing LLVM component into a test failure, rather than ignoring the test.

@jieyouxu
Copy link
Member

Ah, thanks for clarifying, that makes sense.

@jieyouxu
Copy link
Member

jieyouxu commented Nov 5, 2024

So I'm inclined to drop this tidy check, in favor of something like proper //@ cross-compile-target that should infer a //@ needs-llvm-components based on the target triple. I.e. on the rationale that we should not need a separate //@ needs-llvm-components in the first place. @workingjubilee what do you think?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
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)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants