| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -119,6 +119,8 @@ | |||
| 119 | 119 | #define GTEST_OS_NXP_QN9090 1 | |
| 120 | 120 | #elif defined(NRF52) | |
| 121 | 121 | #define GTEST_OS_NRF52 1 | |
| 122 | + #elif defined(__EMSCRIPTEN__) | ||
| 123 | + #define GTEST_OS_EMSCRIPTEN 1 | ||
| 122 | 124 | #endif // __CYGWIN__ | |
| 123 | 125 | ||
| 124 | 126 | #endif // GOOGLETEST_INCLUDE_GTEST_INTERNAL_GTEST_PORT_ARCH_H_ | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -664,12 +664,22 @@ typedef struct _RTL_CRITICAL_SECTION GTEST_CRITICAL_SECTION; | |||
| 664 | 664 | defined(GTEST_OS_NETBSD) || defined(GTEST_OS_FUCHSIA) || \ | |
| 665 | 665 | defined(GTEST_OS_DRAGONFLY) || defined(GTEST_OS_GNU_KFREEBSD) || \ | |
| 666 | 666 | defined(GTEST_OS_HAIKU) || defined(GTEST_OS_GNU_HURD)) | |
| 667 | + | ||
| 667 | 668 | // Death tests require a file system to work properly. | |
| 668 | 669 | #if GTEST_HAS_FILE_SYSTEM | |
| 669 | 670 | #define GTEST_HAS_DEATH_TEST 1 | |
| 670 | 671 | #endif // GTEST_HAS_FILE_SYSTEM | |
| 671 | 672 | #endif | |
| 672 | 673 | ||
| 674 | + // Determines whether the Premature Exit file can be created. | ||
| 675 | + // Created by default when Death tests are supported, but other platforms can | ||
| 676 | + // use the Premature exit file without Death test support (e.g. for detecting | ||
| 677 | + // crashes). | ||
| 678 | + #if GTEST_HAS_DEATH_TEST || \ | ||
| 679 | + (defined(GTEST_OS_EMSCRIPTEN) && GTEST_HAS_FILE_SYSTEM) | ||
| 680 | + #define GTEST_INTERNAL_HAS_PREMATURE_EXIT_FILE 1 | ||
| 681 | + #endif | ||
| 682 | + | ||
| 673 | 683 | // Determines whether to support type-driven tests. | |
| 674 | 684 | ||
| 675 | 685 | // Typed tests need <typeinfo> and variadic macros, which GCC, VC++ 8.0, | |
@@ -822,10 +832,10 @@ typedef struct _RTL_CRITICAL_SECTION GTEST_CRITICAL_SECTION; | |||
| 822 | 832 | #ifndef GTEST_API_ | |
| 823 | 833 | ||
| 824 | 834 | #ifdef _MSC_VER | |
| 825 | - #if defined(GTEST_LINKED_AS_SHARED_LIBRARY) && GTEST_LINKED_AS_SHARED_LIBRARY | ||
| 826 | - #define GTEST_API_ __declspec(dllimport) | ||
| 827 | - #elif defined(GTEST_CREATE_SHARED_LIBRARY) && GTEST_CREATE_SHARED_LIBRARY | ||
| 835 | + #if defined(GTEST_CREATE_SHARED_LIBRARY) && GTEST_CREATE_SHARED_LIBRARY | ||
| 828 | 836 | #define GTEST_API_ __declspec(dllexport) | |
| 837 | + #elif defined(GTEST_LINKED_AS_SHARED_LIBRARY) && GTEST_LINKED_AS_SHARED_LIBRARY | ||
| 838 | + #define GTEST_API_ __declspec(dllimport) | ||
| 829 | 839 | #endif | |
| 830 | 840 | #elif GTEST_INTERNAL_HAVE_CPP_ATTRIBUTE(gnu::visibility) | |
| 831 | 841 | #define GTEST_API_ [[gnu::visibility("default")]] | |
@@ -2242,11 +2252,11 @@ using TimeInMillis = int64_t; // Represents time in milliseconds. | |||
| 2242 | 2252 | ||
| 2243 | 2253 | // Macros for declaring flags. | |
| 2244 | 2254 | #define GTEST_DECLARE_bool_(name) \ | |
| 2245 | - ABSL_DECLARE_FLAG(bool, GTEST_FLAG_NAME_(name)) | ||
| 2255 | + GTEST_API_ ABSL_DECLARE_FLAG(bool, GTEST_FLAG_NAME_(name)) | ||
| 2246 | 2256 | #define GTEST_DECLARE_int32_(name) \ | |
| 2247 | - ABSL_DECLARE_FLAG(int32_t, GTEST_FLAG_NAME_(name)) | ||
| 2257 | + GTEST_API_ ABSL_DECLARE_FLAG(int32_t, GTEST_FLAG_NAME_(name)) | ||
| 2248 | 2258 | #define GTEST_DECLARE_string_(name) \ | |
| 2249 | - ABSL_DECLARE_FLAG(std::string, GTEST_FLAG_NAME_(name)) | ||
| 2259 | + GTEST_API_ ABSL_DECLARE_FLAG(std::string, GTEST_FLAG_NAME_(name)) | ||
| 2250 | 2260 | ||
| 2251 | 2261 | #define GTEST_FLAG_SAVER_ ::absl::FlagSaver | |
| 2252 | 2262 | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -5132,7 +5132,7 @@ void OsStackTraceGetter::UponLeavingGTest() GTEST_LOCK_EXCLUDED_(mutex_) { | |||
| 5132 | 5132 | #endif // GTEST_HAS_ABSL | |
| 5133 | 5133 | } | |
| 5134 | 5134 | ||
| 5135 | - #ifdef GTEST_HAS_DEATH_TEST | ||
| 5135 | + #ifdef GTEST_INTERNAL_HAS_PREMATURE_EXIT_FILE | ||
| 5136 | 5136 | // A helper class that creates the premature-exit file in its | |
| 5137 | 5137 | // constructor and deletes the file in its destructor. | |
| 5138 | 5138 | class ScopedPrematureExitFile { | |
@@ -5170,7 +5170,7 @@ class ScopedPrematureExitFile { | |||
| 5170 | 5170 | ScopedPrematureExitFile(const ScopedPrematureExitFile&) = delete; | |
| 5171 | 5171 | ScopedPrematureExitFile& operator=(const ScopedPrematureExitFile&) = delete; | |
| 5172 | 5172 | }; | |
| 5173 | - #endif // GTEST_HAS_DEATH_TEST | ||
| 5173 | + #endif // GTEST_INTERNAL_HAS_PREMATURE_EXIT_FILE | ||
| 5174 | 5174 | ||
| 5175 | 5175 | } // namespace internal | |
| 5176 | 5176 | ||
@@ -5515,7 +5515,7 @@ void UnitTest::RecordProperty(const std::string& key, | |||
| 5515 | 5515 | // We don't protect this under mutex_, as we only support calling it | |
| 5516 | 5516 | // from the main thread. | |
| 5517 | 5517 | int UnitTest::Run() { | |
| 5518 | - #ifdef GTEST_HAS_DEATH_TEST | ||
| 5518 | + #ifdef GTEST_INTERNAL_HAS_PREMATURE_EXIT_FILE | ||
| 5519 | 5519 | const bool in_death_test_child_process = | |
| 5520 | 5520 | !GTEST_FLAG_GET(internal_run_death_test).empty(); | |
| 5521 | 5521 | ||
@@ -5546,7 +5546,7 @@ int UnitTest::Run() { | |||
| 5546 | 5546 | : internal::posix::GetEnv("TEST_PREMATURE_EXIT_FILE")); | |
| 5547 | 5547 | #else | |
| 5548 | 5548 | const bool in_death_test_child_process = false; | |
| 5549 | - #endif // GTEST_HAS_DEATH_TEST | ||
| 5549 | + #endif // GTEST_INTERNAL_HAS_PREMATURE_EXIT_FILE | ||
| 5550 | 5550 | ||
| 5551 | 5551 | // Captures the value of GTEST_FLAG(catch_exceptions). This value will be | |
| 5552 | 5552 | // used for the duration of the program. | |
| Back | FazBrowse Home | New Git URL |
0 commit comments