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

Fix parallel make check #24537

Merged
merged 5 commits into from
Apr 23, 2015
Merged

Fix parallel make check #24537

merged 5 commits into from
Apr 23, 2015

Conversation

rprichard
Copy link
Contributor

This required fixing the pretty-rpass-full tests to have the same $$(CSREQ$(1)_T_$(2)_H_$(3)) dependencies as the rpass-full and cfail-full tests. It also required fixing the run-make/simd-ffi test to use unique names for its output files.

@rust-highfive
Copy link
Collaborator

r? @brson

(rust_highfive has picked a reviewer for you, use r? to override)

@rprichard
Copy link
Contributor Author

cc @pnkfelix

So far, I've tested this PR using make -j10 check, in a clean build directory.

This PR fixes #22021.

@alexcrichton
Copy link
Member

I think there's still a problem if run-pass and pretty-run-pass run concurrently as they'll tromp over each other when building the // aux-build directives, but other than that this is all I know of!

@brson
Copy link
Contributor

brson commented Apr 17, 2015

@bors r+ rollup

Nice fixes!

@bors
Copy link
Contributor

bors commented Apr 17, 2015

📌 Commit 566d653 has been approved by brson

@rprichard
Copy link
Contributor Author

I think there's still a problem if run-pass and pretty-run-pass run concurrently as they'll tromp over each other when building the // aux-build directives, but other than that this is all I know of!

Thanks for letting me know. If I have time, I'll look into it.

@bors
Copy link
Contributor

bors commented Apr 19, 2015

⌛ Testing commit 566d653 with merge 9da3545...

@bors
Copy link
Contributor

bors commented Apr 19, 2015

💔 Test failed - auto-linux-64-x-android-t

steveklabnik added a commit to steveklabnik/rust that referenced this pull request Apr 20, 2015
This required fixing the `pretty-rpass-full` tests to have the same `$$(CSREQ$(1)_T_$(2)_H_$(3))`  dependencies as the `rpass-full` and `cfail-full` tests.  It also required fixing the `run-make/simd-ffi` test to use unique names for its output files.
bors added a commit that referenced this pull request Apr 20, 2015
@steveklabnik
Copy link
Member

@bors: r-

@steveklabnik
Copy link
Member

This seems to be causing the rollup to fail, due to android. Any ideas?

@rprichard
Copy link
Contributor Author

I would think that fulldeps tests shouldn't run on cross-compiled targets, because our build system doesn't compile LLVM for those targets. I'll look into it.

@rprichard
Copy link
Contributor Author

The fulldeps tests require the rustc crates to be built, but there are two kinds of fulldeps tests:

  • Plugin tests that need host crates
  • Non-plugin tests that need target crates

When I submitted this PR, I was only thinking about the non-plugin tests. In fact, for the rpass-full and cfail-full tests, we only register the CSREQ dependency for the host crates (for syntax plugins):

CTEST_DEPS_rpass-full_$(1)-T-$(2)-H-$(3) = $$(RPASS_FULL_TESTS) $$(CSREQ$(1)_T_$(3)_H_$(3)) $$(SREQ$(1)_T_$(2)_H_$(3))
CTEST_DEPS_cfail-full_$(1)-T-$(2)-H-$(3) = $$(CFAIL_FULL_TESTS) $$(CSREQ$(1)_T_$(3)_H_$(3)) $$(SREQ$(1)_T_$(2)_H_$(3))

We depend upon $$(CSREQ$(1)_T_$(3)_H_$(3)). The T_$(3) is correct for plugin tests, but wrong for non-plugin tests. We can't just add the T_$(2) dependency, though, because librustllvm.a isn't always built for target triples (as demonstrated in the Android failure in this PR).

Currently, if someone attempts to run make check in a configuration with a target-only triple, the non-plugin fulldeps tests will generally fail. If that target-only triple is Android, though, it will succeed, because we've skipped Android on the non-plugin tests.

The immediate fix for this PR is to do the same thing with the pretty fulldeps tests that we already do with the other fulldeps tests.

At one point, we were skipping fulldeps tests for target-only triples, using the CTEST_DISABLE_NONSELFHOST mechanism. The mechanism is still there, but it's not used anymore. Maybe it should be reenabled, but only for non-plugin tests, somehow.

@alexcrichton
Copy link
Member

I think it should also be possible to just skip fulldeps tests whenever the target is not equal to the host as those can't link to the host libraries anyway (as they probably weren't built).

@rprichard
Copy link
Contributor Author

That's definitely possible -- it was implemented in this commit on April 2 last year, then disabled in this commit two weeks later.

The problem with the idea is: for cross-compiles, about half of the fulldeps tests are verifying that rustc correctly searches for a compiler plugin of the host triple, not the target triple. If you search this Android build log for run-pass-fulldeps, you'll see that about half of the tests are ignored (because there's no Android-targeted LLVM), but the other half pass.

I did notice that the second commit I linked removed a bunch of // ignore-cross-compile lines. I bet we could replace the existing // ignore-android lines, and it would fix the general cross-compilation issue.

@alexcrichton
Copy link
Member

Hm I think that the removal of ignore-cross-compile was intentional at that time (as the change enabled the tests to pass), but I imagine that changing many ignore-android to ignore-cross-compile would be much more "semantically correct" at least!

@rprichard
Copy link
Contributor Author

Yes, the removing of the ignore-cross-compile was intentional, because the syntax extension tests work fine with cross-compilation, which the buildbot tests today for Android. At the time it was removed, the quoting run-pass tests were the only fulldeps tests that broke with cross-compilation, and they were marked ignore-android or ignore-test.

I'm trying to change the fulldeps ignore-android directives to ignore-cross-compile and testing it with a cross-compile from x86_64 to i686. This is easier to setup than an Android cross-compile. The first thing I've noticed is that rustdoc tests using external crates also fail, and they too are marked ignore-android, so I'm changing those also.

@alexcrichton
Copy link
Member

Sounds good to me, thanks @rprichard!

@rprichard
Copy link
Contributor Author

I added a couple of commits that switch over to using ignore-cross-compile. It has passed make check on an x86_64 machine with an extra i686 target. I haven't tried testing Android, because it's inconvenient. It also didn't pass make -j10 check, ironically, because I think I finally hit the "run-pass and pretty-run-pass run concurrently" problem that @alexcrichton mentioned originally.

@@ -8,6 +8,7 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.

// ignore-cross-compile
Copy link
Contributor

Choose a reason for hiding this comment

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

did this one pass previously?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I believe the // ignore-test line in that file means that the test is unconditionally skipped. I verified the the test is skipped on one of the Linux buildbot builders. In any case, it needs // ignore-cross-compile because it uses the syntax crate.

Copy link
Contributor

Choose a reason for hiding this comment

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

ah, I see. I'm trying to get this test compiling, but it's pretty busted :(

@rprichard
Copy link
Contributor Author

So, the appropriate title of this PR is now: "Fix cross-compiling make check, and get parallel make check incrementally closer to working". We could merge it as-is, or I could see how hard it is to fix the pretty vs non-pretty aux-build problem.

@alexcrichton
Copy link
Member

@bors: r+ 528472e

@rprichard
Copy link
Contributor Author

Adding the config.mode to the aux_output_dir_name() in compiletest should fix the known remaining problem with parallel make check, I think. Can I add a new commit to this PR (given that it has already been approved)? I assume I still need to test it, which will take a bit of time.

It will make paths a bit longer, which shouldn't be a problem on Unix, but Windows might be a concern, given its 260-character limit. The mode is frequently redundant with the directory name of the test source file, but omitting it seems hazardous. e.g. debuginfo-lldb and debuginfo-gdb use the same input files, and in principle, they could run concurrently, although currently, only one can be enabled.

@alexcrichton
Copy link
Member

Feel free to throw it in, that sounds like a good fix!

@rprichard
Copy link
Contributor Author

I think I should also squash my two commits touching tests.mk. The first commit is wrong, and the second commit corrects it.

The current code attempts to define the
PRETTY_DEPS$(1)_H_$(3)_pretty-rpass-full variable, which does not work,
because $(1) and $(3) are not inside a function. Moreover, there is a test
(run-pass-fulldeps/compiler-calls.rs) that uses rustc_driver, which is not
an indirect dependency of librustc or libsyntax. Listing all the
dependencies will be hard to maintain, but there's a better way to do
this...

As with the rpass-full and cfail-full tests, add dependencies using the
$$(CSREQ$(1)_T_$(3)_H_$(3)) variable, which includes the complete set of
host and target crates, built for a particular stage and host. We use
T_$(3), not T_$(2), because we only build LLVM for host triples (not
target triples), so we can only build rustc_llvm for host triples. The
fulldeps tests that use plugins need host rustc crates, whereas fulldeps
tests that link against rustc and run should be skipped for
cross-compilation (such as Android).

Fixes rust-lang#22021
These tests fail, in general, for cross-compilation, because they require
the rustc crates to exist for the target, and they don't. We can't compile
them for the target unless we also compile LLVM for the target (we don't).

Android is a subset of cross-compilation.

The other fulldeps tests, on the other hand, work fine for
cross-compilation, and in fact, are verifying that rustc correctly searches
for a host plugin crate, not a target plugin crate.
The problem is that rustdoc searches for external crates using the host
triple, not the target triple. It's actually unclear to me whether this is
correct behavior or not, but it is necessary to get cross-compiled tests
working.
The run-pass and pretty run-pass tests could run concurrently, and if they
do, they need to keep their output segregated.

This change might be overkill. We need the suffix for the `pretty` mode,
but we might not need it otherwise. The `debuginfo-lldb` and
`debuginfo-gdb` modes look like they could also need it, but the current
`tests.mk` file happens not to enable both lldb and gdb at the same time,
for incidental reasons.
@rprichard rprichard force-pushed the fix-parallel-check branch from 528472e to 38d26d8 Compare April 23, 2015 03:38
@rprichard
Copy link
Contributor Author

I squashed my two tests.mk changes and added a new commit changing compiletest. (Regarding the compiletest commit, previously we had been suffixing .libaux but somewhere the . was lost. I assumed it was an accident and put the . back.)

aux dirs now look like this:

./x86_64-unknown-linux-gnu/test/run-pass/check-static-recursion-foreign.stage2-i686-unknown-linux-gnu.pretty.libaux
./x86_64-unknown-linux-gnu/test/run-pass/check-static-recursion-foreign.stage2-i686-unknown-linux-gnu.run-pass.libaux

@tamird tamird mentioned this pull request Apr 23, 2015
@alexcrichton
Copy link
Member

@bors: r+ 38d26d8

bors added a commit that referenced this pull request Apr 23, 2015
This required fixing the `pretty-rpass-full` tests to have the same `$$(CSREQ$(1)_T_$(2)_H_$(3))`  dependencies as the `rpass-full` and `cfail-full` tests.  It also required fixing the `run-make/simd-ffi` test to use unique names for its output files.
@bors
Copy link
Contributor

bors commented Apr 23, 2015

⌛ Testing commit 38d26d8 with merge 69e47c7...

@bors bors merged commit 38d26d8 into rust-lang:master Apr 23, 2015
Manishearth added a commit to Manishearth/rust that referenced this pull request Apr 24, 2015
steveklabnik added a commit to steveklabnik/rust that referenced this pull request Apr 24, 2015
steveklabnik added a commit to steveklabnik/rust that referenced this pull request Apr 24, 2015
bors added a commit that referenced this pull request Apr 25, 2015
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.

7 participants