Skip to content

bazel: avoid invalidating analysis cache between build and tests.#7294

Merged
lizan merged 2 commits intoenvoyproxy:masterfrom
PiotrSikora:test_speedup
Jun 19, 2019
Merged

bazel: avoid invalidating analysis cache between build and tests.#7294
lizan merged 2 commits intoenvoyproxy:masterfrom
PiotrSikora:test_speedup

Conversation

@PiotrSikora
Copy link
Copy Markdown
Contributor

@PiotrSikora PiotrSikora commented Jun 16, 2019

This is achieved by pulling BAZEL_TEST_OPTIONS into BAZEL_BUILD_OPTIONS,
i.e. using the same build options for "build" and "test" commands.

Signed-off-by: Piotr Sikora piotrsikora@google.com

This is achieved by pulling BAZEL_TEST_OPTIONS into BAZEL_BUILD_OPTIONS,
i.e. using the same build options for "build" and "test" commands.

Signed-off-by: Piotr Sikora <piotrsikora@google.com>
@PiotrSikora PiotrSikora changed the title ci: speedup tests. bazel: avoid invalidating analysis cache between build and tests. Jun 16, 2019
@PiotrSikora PiotrSikora marked this pull request as ready for review June 16, 2019 05:52
@PiotrSikora
Copy link
Copy Markdown
Contributor Author

This doesn't have any measurable effect on the CI, but I think this is still a good change.

cc @lizan

Copy link
Copy Markdown
Member

@lizan lizan left a comment

Choose a reason for hiding this comment

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

Not a fan of the bazelrc change but the rest should make the script more robust to options change. Eventually I'd like to move the flag composing into bazelrc as much as possible, #5730.


# Test options
test --test_env=HEAPCHECK=normal --test_env=PPROF_PATH
build --test_env=HEAPCHECK=normal --test_env=PPROF_PATH
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Hmm, I don't think this change is needed?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

It is, otherwise --test_env changes between bazel build and bazel test.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

right, but that doesn't affect cache analysis.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

It does:

$ bazel --noworkspace_rc build //source/common/buffer:buffer_lib 2>&1 | grep test_env
$ bazel --noworkspace_rc test --test_env=TEST=1 //source/common/buffer:buffer_lib 2>&1 | grep test_env
INFO: Build option --test_env has changed, discarding analysis cache.
$ bazel --noworkspace_rc build --test_env=TEST=1 //source/common/buffer:buffer_lib 2>&1 | grep test_env
$ bazel --noworkspace_rc test --test_env=TEST=1 //source/common/buffer:buffer_lib 2>&1 | grep test_env

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

With .bazelrc from master (which sets different --test_env flags for bazel test):

$ bazel build //source/common/buffer:buffer_lib 2>&1 | grep test_env
$ bazel test //source/common/buffer:buffer_lib 2>&1 | grep test_env
INFO: Build option --test_env has changed, discarding analysis cache.

After the change from this PR:

$ bazel build //source/common/buffer:buffer_lib 2>&1 | grep test_env
$ bazel test //source/common/buffer:buffer_lib 2>&1 | grep test_env

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Hmm, it seems bazel discard analysis cache while action cache is still valid so the build doesn't take longer time. If you feel strong about this change go for it. Can you merge master in that case?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I think it makes sense to add it, otherwise this PR feels half-done. Merged master. Thanks!

…eedup

Signed-off-by: Piotr Sikora <piotrsikora@google.com>
@PiotrSikora
Copy link
Copy Markdown
Contributor Author

cc @jmarantz, since this changes #7243 (which, to be honest, should be probably replaced with BAZEL_EXTRA_BUILD_OPTIONS="--cxxopt=-DMEMORY_TEST_EXACT=1" in .circleci/config.yml).

@lizan
Copy link
Copy Markdown
Member

lizan commented Jun 19, 2019

which, to be honest, should be probably replaced with BAZEL_EXTRA_BUILD_OPTIONS="--cxxopt=-DMEMORY_TEST_EXACT=1" in .circleci/config.yml

we should do memory test exact with docker runs too.

@PiotrSikora
Copy link
Copy Markdown
Contributor Author

we should do memory test exact with docker runs too.

The exact memory test is tied to a given libstdc++ version, which means that it might fail, depending on the Docker container you're running, whereas .circleci/config.yaml is using a specific container.

But I don't feel too strongly about it, just pointing it out.

@lizan lizan merged commit 49277ce into envoyproxy:master Jun 19, 2019
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.

2 participants