-
Notifications
You must be signed in to change notification settings - Fork 12.8k
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
Make compiletest do exact matching on triples #49158
Conversation
…ang#47737" This reverts commit 16ac85c.
b7df111
to
2d5bb5c
Compare
I don't think this PR is correct, because we already rely on substring matching. For example, with this change, |
@sanxiyn: Ah, that's awkward — do you know how prevalent this is (that is: using substring matching)? Would it be plausible to special case strings like |
I think you should review the output of |
Putting all the minor variations of the triple into compiletest probably also makes adding new targets (incl. minor variations of existing targets) more annoying, but hopefully less so than learning months later your |
To clarify: you think the tests should be all updated too, so that:
I.e. no more substring matching whatsoever. |
No, that's not what I'm saying. Triples contain more information (and in some cases, random noise) than we need for the purpose of "ignore this test on this architecture". For example, consider how This is a judgement call to some degree, there may be distinctions in triples that we may want to preserve. But we'll learn about those when someone wants to make that distinction in a test. |
Okay, I've added the OSes and architectures that weren't previously considered, and added what I think are reasonable canonicalisations for each of them — they should match the previous substring matching unless something very specific was being done before (which is probably most easily observed by letting bors test it). |
src/tools/compiletest/src/util.rs
Outdated
("bitrig", "bitrig"), | ||
("cloudabi", "cloudabi"), | ||
("darwin", "macos"), | ||
("dragonfly", "dragonfly"), | ||
("eabi", "eabi"), | ||
("eabihf", "eabi"), | ||
("elf", "elf"), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Uh these seem rather odd. I know triples can be weird sometimes, are these actual "operating systems" or do they just happen to be in that position in the triple?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Um, I guess a better question is: which triples do these entries come from?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
They did seem odd, but I didn't feel certain enough to exclude them. They come fromthumbv6m-none-eabi
(and the other thumb*
triples) and msp430-none-elf
. Do you think I should just exclude these?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah so these triples have no "vendor" component, so the second component is the "OS" and the last component is the ABI.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah — is it always safe to make this assumption? (I.e. elided component is vendor?)
Edit: It seems 3-component triples are not consistent about which component they leave out, so I'm ignoring these cases specifically now. It shouldn't be a problem, because they were ignored previously too.
@varkor: 🔑 Insufficient privileges: Not in reviewers |
@varkor: 🔑 Insufficient privileges: not in try users |
Not sure why bors thought I was trying anything funny... I know my place. |
src/tools/compiletest/src/header.rs
Outdated
name == util::get_pointer_width(&self.target) || // pointer width | ||
name == self.stage_id.split('-').next().unwrap() || // stage | ||
Some(name) == util::get_env(&self.target) || // env | ||
util::matches_os(&self.target, triple.get(2), name) || // target |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was always worried about "hard-coding" the meaning of triple components like this since they are somewhat flexible. Since it turns out we even have triples in-tree for which this breaks down, let's not do that...
src/tools/compiletest/src/util.rs
Outdated
return name == "emscripten" || name == "wasm32-bare" | ||
} | ||
for &(triple_os, os) in OS_TABLE { | ||
if target_os == &triple_os { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
... instead let's simply look at all triple components (like it previously did, just without the substring search now). Namespace collisions between the different triple components are practically impossible and would cause far worse problems in the ecosystem of "things that consume triples".
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure, I wasn't sure if the components could ever coïncide — but I shall do that instead.
@varkor it was actually a bors bug (servo/homu#150), don't worry :) |
@bors r+ |
📌 Commit dfaecbb has been approved by |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't want to r- over this now, but I'd really appreciate if you squashed the commits after the revert because right now there's some back and forth (later commits undoing quite a bit of the earlier ones) which only makes sense in the context of this review, not when viewing history.
I also left two nits.
src/tools/compiletest/src/header.rs
Outdated
name == util::get_pointer_width(&self.target) || // pointer width | ||
name == self.stage_id.split('-').next().unwrap() || // stage | ||
Some(name) == util::get_env(&self.target) || // env | ||
util::matches_os(&self.target, &triple, name) || // target |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: I think now that these functions look at the whole triple again, there's not much to be gained from splitting here and passing the component explicitly (especially for matches_os
which needs the whole triple anyway). Perhaps just revert these changes and split in the util::*
functions to keep the interface simpler?
src/tools/compiletest/src/header.rs
Outdated
name == util::get_arch(&triple) || // architecture | ||
name == util::get_pointer_width(&self.target) || // pointer width | ||
name == self.stage_id.split('-').next().unwrap() || // stage | ||
Some(&name) == triple.get(3) || // env |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: This is a pure refactoring, right? If so, I'd prefer to leave it out of this PR, for consistency. (Splitting multiple times is sure to have completely neglegible performance impact.)
This avoids the issues of the previous substring matching, ensuring `ARCH_TABLE` and `OS_TABLE` will no longer contain redundant entries.
dfaecbb
to
61e1fbc
Compare
@rkruppe: bors can wait! I've squashed most of the commits down and simplified the changes. |
Thanks! @bors r+ |
📌 Commit 61e1fbc has been approved by |
Make compiletest do exact matching on triples This avoids the issues of the previous substring matching, ensuring `ARCH_TABLE` and `OS_TABLE` will no longer contain redundant entries. Fixes rust-lang#48893. r? @rkruppe
Make compiletest do exact matching on triples This avoids the issues of the previous substring matching, ensuring `ARCH_TABLE` and `OS_TABLE` will no longer contain redundant entries. Fixes rust-lang#48893. r? @rkruppe
☔ The latest upstream changes (presumably #49264) made this pull request unmergeable. Please resolve the merge conflicts. |
This avoids the issues of the previous substring matching, ensuring
ARCH_TABLE
andOS_TABLE
will no longer contain redundant entries. Fixes #48893.r? @rkruppe