-
Notifications
You must be signed in to change notification settings - Fork 10.4k
fix: Remove Arduino entry points #2041
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
Conversation
Improved flexibility by removing the Arduino entry points in favor of manual calls to setup/loop that the user can call from their entry point. This is the more common use case for Arudino. Also added the gtest/gmock_main files to the PlatformIO ignore list since we are not supporting that feature.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For gtest.h are there actual changes ( I only see formatting ). If not please revert
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pls take a look
There are changes in gtest.h @ line 2334. I do not know what happened with the formatting. I will correct. I will alphabetize the file ignore list. |
Still working on getting the gtest.h resolved. It is behaving like there is some auto-formatting happen during the check in. The intent is just to add the lines at the bottom. The other items should be done. |
GTest updated. |
@gennadiycivil The other option would be to put the setup/loop functions that we took out in gtest and gmock, back in, but only for CI. A future feature could enable these for the PlatformIO framework as an opt-in feature. Thoughts? |
CI failed |
@gennadiycivil I saw that CI failed. I wasn't sure how best to proceed so I asked the question above. Thoughts on this? My vote would probably be to put the original entry points back but leave them disabled in the PlatformIO framework by not including the *_main.cc file. |
Unfortunately I don't have an opinion because I am not familiar with the platform and its common use cases. My take on the changes is to
|
Added setup()/loop() functions back to *_main.cc files to support compiling in CI. Future features could enable this for the end user.
@gennadiycivil Do you need anything else on this issue. I decided to put the functions in but only enable them for CI. If we have to have the functions, we might as well make them do the right thing and give the option for later enabling in the PlatformIO package. |
googletest/include/gtest/gtest.h
Outdated
#ifdef ARDUINO | ||
inline void gtest_setup() { | ||
// Since Arduino doesn't have a command line, fake out the argc/argv arguments | ||
int argc = 1; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let us Inot define these functions in the header. Too much noise.
Also, there is nothing interesting about this function.
If the user has to insert code to initialize GoogleTest, they might as well call testing::InitGoogleTest themselves.
At this point I think it might be simpler to provide an overload of InitGoogleTest that doesn't require argv/argc.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I like that idea better. I pushed no argument versions of the init functions and cleaned up where appropriate.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ptal
Added versions of InitGoogle[Mock|Test] that take no arguments. This is to support embedded platforms like Arduino that do not have any concept of argc/argv. Minor clang format automated changes.
googlemock/src/gmock.cc
Outdated
@@ -58,8 +57,7 @@ namespace internal { | |||
// "=value" part can be omitted. | |||
// | |||
// Returns the value of the flag, or NULL if the parsing failed. | |||
static const char* ParseGoogleMockFlagValue(const char* str, | |||
const char* flag, | |||
static const char* ParseGoogleMockFlagValue(const char* str, const char* flag, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Formatting seems to change without any actual changes. Could you please make sure that only actual changes are included
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes I will fix this. I think clang-format is ran automatically on the file edit.
googlemock/src/gmock.cc
Outdated
@@ -132,8 +130,8 @@ static bool ParseGoogleMockIntFlag(const char* str, const char* flag, | |||
if (value_str == nullptr) return false; | |||
|
|||
// Sets *value to the value of the flag. | |||
return ParseInt32(Message() << "The value of flag --" << flag, | |||
value_str, value); | |||
return ParseInt32(Message() << "The value of flag --" << flag, value_str, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same here, formatting
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will fix.
googletest/src/gtest_main.cc
Outdated
#endif | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
... and here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed.
googlemock/src/gmock_main.cc
Outdated
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
still extra new line
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
some annoying formatting changes still
@gennadiycivil Sorry for the formatting issues. Code should be good now. Thanks. |
PiperOrigin-RevId: 230554814
This should be merged now in bf07131 |
Improved flexibility by removing the Arduino entry points in favor of manual calls to setup/loop that the user can call from their entry point. This is the more common use case for Arudino.
Also added the gtest/gmock_main files to the PlatformIO ignore list since we are not supporting that feature.