diff options
Diffstat (limited to 'contrib/googletest/googletest/src/gtest_main.cc')
-rw-r--r-- | contrib/googletest/googletest/src/gtest_main.cc | 31 |
1 files changed, 30 insertions, 1 deletions
diff --git a/contrib/googletest/googletest/src/gtest_main.cc b/contrib/googletest/googletest/src/gtest_main.cc index 2113f621e654..8141caf4ca08 100644 --- a/contrib/googletest/googletest/src/gtest_main.cc +++ b/contrib/googletest/googletest/src/gtest_main.cc @@ -27,11 +27,40 @@ // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -#include <stdio.h> +#include <cstdio> + #include "gtest/gtest.h" +#if defined(GTEST_OS_ESP8266) || defined(GTEST_OS_ESP32) || \ + (defined(GTEST_OS_NRF52) && defined(ARDUINO)) +// Arduino-like platforms: program entry points are setup/loop instead of main. + +#ifdef GTEST_OS_ESP8266 +extern "C" { +#endif + +void setup() { testing::InitGoogleTest(); } + +void loop() { RUN_ALL_TESTS(); } + +#ifdef GTEST_OS_ESP8266 +} +#endif + +#elif defined(GTEST_OS_QURT) +// QuRT: program entry point is main, but argc/argv are unusable. + +GTEST_API_ int main() { + printf("Running main() from %s\n", __FILE__); + testing::InitGoogleTest(); + return RUN_ALL_TESTS(); +} +#else +// Normal platforms: program entry point is main, argc/argv are initialized. + GTEST_API_ int main(int argc, char **argv) { printf("Running main() from %s\n", __FILE__); testing::InitGoogleTest(&argc, argv); return RUN_ALL_TESTS(); } +#endif |