test: Break down huge monolith mock header to improve test compilation performance#11797
test: Break down huge monolith mock header to improve test compilation performance#11797lizan merged 17 commits intoenvoyproxy:masterfrom
Conversation
Signed-off-by: Muge Chen <mugechen@google.com>
Signed-off-by: Muge Chen <mugechen@google.com>
Signed-off-by: Muge Chen <mugechen@google.com>
Signed-off-by: Muge Chen <mugechen@google.com>
test/mocks/server/drain_manager.cc
Outdated
| #include "gmock/gmock.h" | ||
| #include "gtest/gtest.h" | ||
|
|
||
| using testing::_; |
There was a problem hiding this comment.
As I mentioned on the last PR, these should be fully-qualified and inside the innermost working namespace, or removed if not being used.
There was a problem hiding this comment.
Thanks for let me know, now they should be fully qualified and stay inside the innermost namespace.
| MOCK_METHOD(std::string, name, (), (const, override)); | ||
| }; | ||
| } // namespace Configuration | ||
|
|
There was a problem hiding this comment.
Removing the blank lines between closing namespace brackets would be more consistent with the opening namespace brackets.
There was a problem hiding this comment.
Now they're removed
Signed-off-by: Muge Chen <mugechen@google.com>
Signed-off-by: Muge Chen <mugechen@google.com>
Signed-off-by: Muge Chen <mugechen@google.com>
test/mocks/server/admin_stream.h
Outdated
| @@ -0,0 +1,32 @@ | |||
| #pragma once | |||
|
|
|||
| #include <chrono> | |||
There was a problem hiding this comment.
Are we scripting the removal of extra #includes or doing it manually? We don't need most of these system headers in the new headers.
There was a problem hiding this comment.
I remove them manually, just forget to remove them. Thanks for pointing out
test/mocks/server/mocks.cc
Outdated
| } // namespace Configuration | ||
| } // namespace Server | ||
| } // namespace Envoy | ||
| namespace Envoy {} No newline at end of file |
There was a problem hiding this comment.
We can delete the .cc file.
test/mocks/server/mocks.h
Outdated
| #include "worker.h" | ||
| #include "worker_factory.h" | ||
|
|
||
| namespace Envoy {} No newline at end of file |
There was a problem hiding this comment.
This empty namespace block can be removed.
Signed-off-by: Muge Chen <mugechen@google.com>
ahedberg
left a comment
There was a problem hiding this comment.
Please fix formatting. ./ci/run_envoy_docker.sh './ci/do_ci.sh fix_format' should do it.
Signed-off-by: Muge Chen <mugechen@google.com>
|
cc @ahedberg
Now it should be fixed. Actually the empty namespace block in mocks.h from previous commits was used to make the formatter happy. now I found I can use no lint instead |
Signed-off-by: Muge Chen <mugechen@google.com>
Signed-off-by: Muge Chen <mugechen@google.com>
Signed-off-by: Muge Chen <mugechen@google.com>
Signed-off-by: Muge Chen <mugechen@google.com>
Signed-off-by: Muge Chen <mugechen@google.com>
Signed-off-by: Muge Chen <mugechen@google.com>
Signed-off-by: Muge Chen <mugechen@google.com>
… up test compilation (#12048) breakdown test/mocks/upstream/mocks.h into different mock classes test/mocks/upstream/mocks.h is a wide-used mock header included by various test files. However it's very huge and most test files only used a small portion of it. Splitting it up into different mock classes will be helpful to reduce compilation time. (similar to #11797 ) Risk Level: low Testing: existing tests Docs Changes: N/A Release Notes: no Related Issues: #10917 Signed-off-by: Muge Chen <mugechen@google.com>
… up test compilation (envoyproxy#12048) breakdown test/mocks/upstream/mocks.h into different mock classes test/mocks/upstream/mocks.h is a wide-used mock header included by various test files. However it's very huge and most test files only used a small portion of it. Splitting it up into different mock classes will be helpful to reduce compilation time. (similar to envoyproxy#11797 ) Risk Level: low Testing: existing tests Docs Changes: N/A Release Notes: no Related Issues: envoyproxy#10917 Signed-off-by: Muge Chen <mugechen@google.com> Signed-off-by: Kevin Baichoo <kbaichoo@google.com>
…n performance (envoyproxy#11797) Commit Message: breakdown `test/mocks/server/mocks.h` into different mock classes Additional Description: `test/mocks/server/mocks.h` is a wide-used mock header included by various test files. However it's very huge and most test files only used a small portion of it. Splitting it up into different mock classes will be helpful to reduce compilation time. Risk Level: low Testing: existing tests Docs Changes: N/A Release Notes: no Related Issues: envoyproxy#10917 Signed-off-by: Muge Chen <mugechen@google.com> Signed-off-by: scheler <santosh.cheler@appdynamics.com>
… up test compilation (envoyproxy#12048) breakdown test/mocks/upstream/mocks.h into different mock classes test/mocks/upstream/mocks.h is a wide-used mock header included by various test files. However it's very huge and most test files only used a small portion of it. Splitting it up into different mock classes will be helpful to reduce compilation time. (similar to envoyproxy#11797 ) Risk Level: low Testing: existing tests Docs Changes: N/A Release Notes: no Related Issues: envoyproxy#10917 Signed-off-by: Muge Chen <mugechen@google.com> Signed-off-by: chaoqinli <chaoqinli@google.com>
We need to reduce resource consumption of test compilation by simplifying mock library inclusions. #10917 One way to do that is to break the monolithic mock headers into different mock classes and then refactor the code base (like #12053 #12051 #11797) It's hard to refactor them manually. So I wrote headersplit, a tool based on libclang and python to help me divide the monolithic mock header and replace includes after dividing automatically. This tool can also generate building time comparison between before/after refactoring. Risk level: low Testing: Build succeeds. Signed-off-by: Muge Chen <mugechen@google.com>
) We need to reduce resource consumption of test compilation by simplifying mock library inclusions. envoyproxy#10917 One way to do that is to break the monolithic mock headers into different mock classes and then refactor the code base (like envoyproxy#12053 envoyproxy#12051 envoyproxy#11797) It's hard to refactor them manually. So I wrote headersplit, a tool based on libclang and python to help me divide the monolithic mock header and replace includes after dividing automatically. This tool can also generate building time comparison between before/after refactoring. Risk level: low Testing: Build succeeds. Signed-off-by: Muge Chen <mugechen@google.com> Signed-off-by: Clara Andrew-Wani <candrewwani@gmail.com>
Commit Message: breakdown
test/mocks/server/mocks.hinto different mock classesAdditional Description:
test/mocks/server/mocks.his a wide-used mock header included by various test files. However it's very huge and most test files only used a small portion of it. Splitting it up into different mock classes will be helpful to reduce compilation time.Risk Level: low
Testing: existing tests
Docs Changes: N/A
Release Notes: no
Related Issues: #10917