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

Decrease src/rust/engine/run-all-tests.sh overhead. #4908

Merged
merged 3 commits into from
Sep 28, 2017

Conversation

jsirois
Copy link
Contributor

@jsirois jsirois commented Sep 28, 2017

This required both ensuring generated cffi code has a stable mtime for
stable contents and that the build script tell cargo which files to
change detect against.

Additionally, refactor the bootstrap.sh a bit to encapsulate calling a
bootstrapped cargo.


exit_code=0

for crate in $(find ${here} -name Cargo.toml); do
(
echo >&2 "Running tests for ${crate}:"
export RUST_BACKTRACE=1
"${CARGO_HOME}/bin/cargo" test --manifest-path=${crate}
RUST_BACKTRACE=1 PANTS_SRCPATH="${REPO_ROOT}/src/python" run_cargo test ${MODE_FLAG} \
Copy link
Contributor Author

@jsirois jsirois Sep 28, 2017

Choose a reason for hiding this comment

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

Did not mention this in the description, but specifying the same MODE_FLAG as ./pants does indirectly through bootstrap.sh (ie: --release vs nothing, aka debug), was a part of this puzzle, even after which the build.rs rename and removal of the Cargo.toml [project] build were both necessary to achieve ~0s noop test times.

@illicitonion
Copy link
Contributor

CI legit failing because the native_engine_version file is wrong

Otherwise LGTM

I'm kind of unhappy that the rust toolchain exhibits this behaviour :( Being explicit about what a build is going to do should not change its performance characteristics!

@@ -9,7 +9,7 @@ authors = [ "Pants Build <pantsbuild@gmail.com>" ]
# incremntalism is engaged; without it is not and O(10s) is sent no-op recompiling for
# `cargo test`.
#
# build = "src/build.rs"
# build = "build.rs"
Copy link
Contributor

Choose a reason for hiding this comment

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

Why drop the src/? It seemed to be working before...

Copy link
Member

@stuhood stuhood left a comment

Choose a reason for hiding this comment

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

Thanks John. Would be good to link to a ticket.

# NB: We use the custom build script below, but omit the entry and count on Cargo's default
# behavior of looking for `build.rs` in the package root and using it (see:
# http://doc.crates.io/build-script.html). By allowing the default scan proper cargo build
# incremntalism is engaged; without it is not and O(10s) is sent no-op recompiling for
Copy link
Member

Choose a reason for hiding this comment

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

"incrementalism"

Shall I file a ticket about this one upstream? Or is this one close enough? rust-lang/cargo#3076

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It may in fact explain what we're doing wrong. Gimme more time here.

This required both ensuring generated cffi code has a stable mtime for
stable contents and that the build script tell cargo which files to
change detect against.

Additionally, refactor the bootstrap.sh a bit to encapsulate calling a
bootstrapped `cargo`.
@jsirois jsirois force-pushed the jsirois/rust/improve-test-time branch from 78bfb09 to ea962f5 Compare September 28, 2017 20:05
@jsirois
Copy link
Contributor Author

jsirois commented Sep 28, 2017

Alright - we're now doing things a bit differently to work with Cargo's change detection. PTAL.

Also note the revelations here may have impact on #4910

Copy link
Member

@stuhood stuhood left a comment

Choose a reason for hiding this comment

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

Thanks John!

@illicitonion
Copy link
Contributor

Looks good :) I've reflected the cargo tracking into #4910 too :)

@jsirois jsirois merged commit 8c9f28b into pantsbuild:master Sep 28, 2017
@jsirois jsirois deleted the jsirois/rust/improve-test-time branch September 28, 2017 21:15
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.

3 participants