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

Make compiletest do exact matching on triples #49158

Merged
merged 3 commits into from
Mar 22, 2018

Conversation

varkor
Copy link
Member

@varkor varkor commented Mar 19, 2018

This avoids the issues of the previous substring matching, ensuring ARCH_TABLE and OS_TABLE will no longer contain redundant entries. Fixes #48893.

r? @rkruppe

@sanxiyn
Copy link
Member

sanxiyn commented Mar 19, 2018

I don't think this PR is correct, because we already rely on substring matching. For example, with this change, arm-linux-androideabi will not match ignore-android.

@varkor
Copy link
Member Author

varkor commented Mar 19, 2018

@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 android instead?

@sanxiyn
Copy link
Member

sanxiyn commented Mar 19, 2018

I think you should review the output of rustc --print target-list and add missing entries to ARCH_TABLE and OS_TABLE. It should be doable although tedious.

@hanna-kruppe
Copy link
Contributor

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 ignore-* lines don't do what they appear to be doing.

@varkor
Copy link
Member Author

varkor commented Mar 19, 2018

To clarify: you think the tests should be all updated too, so that:
// ignore-android becomes:

// ignore-android
// ignore-androideabi

I.e. no more substring matching whatsoever.

@hanna-kruppe
Copy link
Contributor

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 i386, i586 and i686 triples are all considered for ignore-x86 currently, or how arm64 in triples is treated as an alias for aarch64. I'm in favor of extending that canonicalization to other variations in arch and OS components. This still requires someone to go through all the triples, but only in compiletest, not in every test ever (where it would add no useful information).

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.

@varkor
Copy link
Member Author

varkor commented Mar 19, 2018

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).

("bitrig", "bitrig"),
("cloudabi", "cloudabi"),
("darwin", "macos"),
("dragonfly", "dragonfly"),
("eabi", "eabi"),
("eabihf", "eabi"),
("elf", "elf"),
Copy link
Contributor

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?

Copy link
Contributor

@hanna-kruppe hanna-kruppe Mar 19, 2018

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?

Copy link
Member Author

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?

Copy link
Contributor

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.

Copy link
Member Author

@varkor varkor Mar 19, 2018

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.

@bors
Copy link
Contributor

bors commented Mar 19, 2018

@varkor: 🔑 Insufficient privileges: Not in reviewers

@bors
Copy link
Contributor

bors commented Mar 19, 2018

@varkor: 🔑 Insufficient privileges: not in try users

@varkor
Copy link
Member Author

varkor commented Mar 19, 2018

Not sure why bors thought I was trying anything funny... I know my place.

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
Copy link
Contributor

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...

return name == "emscripten" || name == "wasm32-bare"
}
for &(triple_os, os) in OS_TABLE {
if target_os == &triple_os {
Copy link
Contributor

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".

Copy link
Member Author

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.

@pietroalbini pietroalbini added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Mar 19, 2018
@pietroalbini
Copy link
Member

pietroalbini commented Mar 19, 2018

@varkor it was actually a bors bug (servo/homu#150), don't worry :)

@rust-lang rust-lang deleted a comment from bors Mar 20, 2018
@rust-lang rust-lang deleted a comment from bors Mar 20, 2018
@rust-lang rust-lang deleted a comment from bors Mar 20, 2018
@rust-lang rust-lang deleted a comment from bors Mar 20, 2018
@sanxiyn
Copy link
Member

sanxiyn commented Mar 20, 2018

@bors r+

@bors
Copy link
Contributor

bors commented Mar 20, 2018

📌 Commit dfaecbb has been approved by sanxiyn

@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 Mar 20, 2018
Copy link
Contributor

@hanna-kruppe hanna-kruppe left a 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.

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
Copy link
Contributor

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?

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
Copy link
Contributor

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.
@varkor
Copy link
Member Author

varkor commented Mar 20, 2018

@rkruppe: bors can wait! I've squashed most of the commits down and simplified the changes.

@hanna-kruppe
Copy link
Contributor

Thanks!

@bors r+

@bors
Copy link
Contributor

bors commented Mar 20, 2018

📌 Commit 61e1fbc has been approved by rkruppe

kennytm added a commit to kennytm/rust that referenced this pull request Mar 21, 2018
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
kennytm added a commit to kennytm/rust that referenced this pull request Mar 22, 2018
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
bors added a commit that referenced this pull request Mar 22, 2018
@bors
Copy link
Contributor

bors commented Mar 22, 2018

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

@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 Mar 22, 2018
@alexcrichton alexcrichton merged commit 61e1fbc into rust-lang:master Mar 22, 2018
@varkor varkor deleted the compiletest-triples branch March 22, 2018 21:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants