-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Add more logs and attempt to fix CI Loop instability: Build and Pack NuGet randomly fails #3492
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
Changes from all commits
0715de1
e662909
280961e
0ed8888
b9f8626
22b9361
df991af
6bf2fb6
28bb5f6
8d365f1
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,9 @@ | ||
| { | ||
| "type": "none", | ||
| "comment": "Add more logs to troubleshoot undefinedBuild and Pack NuGet randomly fails", | ||
| "packageName": "react-native-windows", | ||
| "email": "licanhua@live.com", | ||
| "commit": "b9f8626afe67dc7c9a006f4f44b3a1aa51fb0891", | ||
| "date": "2019-10-22T22:00:15.617Z", | ||
| "file": "f:\\repo\\react-native-windows\\change\\react-native-windows-2019-10-22-15-00-16-azure-pipelines.json" | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -13,6 +13,8 @@ | |
| #include <objbase.h> | ||
| #include <locale> | ||
|
|
||
| #include <boost/exception/all.hpp> | ||
|
|
||
| using namespace facebook::react; | ||
| using namespace facebook::xplat::module; | ||
| using namespace folly; | ||
|
|
@@ -52,76 +54,81 @@ TestResult TestRunner::RunTest( | |
| assert(functionCalled != NULL); | ||
| TestResult result{TestStatus::Pending, wstring()}; | ||
|
|
||
| // TODO: Defer MessageQueueThread creation to variant implementations (Win32, | ||
| // WinRT). | ||
| vector<tuple<string, CxxModule::Provider>> modules{make_tuple( | ||
| TestModule::name, | ||
| [this, &result, &functionCalled]() -> unique_ptr<CxxModule> { | ||
| return make_unique<TestModule>( | ||
| [this, &result, &functionCalled](bool success) { | ||
| if (TestStatus::Pending != result.Status) | ||
| return; | ||
|
|
||
| result.Status = success ? TestStatus::Passed : TestStatus::Failed; | ||
| result.Message = L"markTestSucceeded(false)"; | ||
| ::SetEvent(functionCalled); | ||
| }); | ||
| })}; | ||
|
|
||
| // Note, further configuration should be done in each Windows variant's | ||
| // TestRunner implementation. | ||
| shared_ptr<DevSettings> devSettings = make_shared<DevSettings>(); | ||
| devSettings->useWebDebugger = | ||
| false; // WebSocketJSExecutor can't register native log hooks. | ||
| devSettings->debugHost = "localhost:8081"; | ||
| devSettings->liveReloadCallback = []() {}; // Enables ChakraExecutor | ||
| devSettings->errorCallback = [&result](string message) { | ||
| result.Message = Microsoft::Common::Unicode::Utf8ToUtf16(message); | ||
| try { | ||
| // TODO: Defer MessageQueueThread creation to variant implementations | ||
| // (Win32, WinRT). | ||
| vector<tuple<string, CxxModule::Provider>> modules{make_tuple( | ||
| TestModule::name, | ||
| [this, &result, &functionCalled]() -> unique_ptr<CxxModule> { | ||
| return make_unique<TestModule>([this, &result, &functionCalled]( | ||
| bool success) { | ||
| if (TestStatus::Pending != result.Status) | ||
| return; | ||
|
|
||
| result.Status = success ? TestStatus::Passed : TestStatus::Failed; | ||
| result.Message = L"markTestSucceeded(false)"; | ||
| ::SetEvent(functionCalled); | ||
| }); | ||
| })}; | ||
|
|
||
| // Note, further configuration should be done in each Windows variant's | ||
| // TestRunner implementation. | ||
| shared_ptr<DevSettings> devSettings = make_shared<DevSettings>(); | ||
| devSettings->useWebDebugger = | ||
| false; // WebSocketJSExecutor can't register native log hooks. | ||
| devSettings->debugHost = "localhost:8081"; | ||
| devSettings->liveReloadCallback = []() {}; // Enables ChakraExecutor | ||
| devSettings->errorCallback = [&result](string message) { | ||
| result.Message = Microsoft::Common::Unicode::Utf8ToUtf16(message); | ||
| result.Status = TestStatus::Failed; | ||
| }; | ||
| devSettings->loggingCallback = std::move(loggingCallback); | ||
|
|
||
| // React instance scope | ||
| { | ||
| shared_ptr<ITestInstance> instance = GetInstance( | ||
| std::move(bundlePath), std::move(modules), std::move(devSettings)); | ||
|
|
||
| InitializeLogging([&result, &functionCalled]( | ||
| RCTLogLevel logLevel, const char *message) { | ||
| if (TestStatus::Pending != result.Status) | ||
| return; | ||
|
|
||
| switch (logLevel) { | ||
| case RCTLogLevel::Error: | ||
| case RCTLogLevel::Fatal: | ||
| result.Message = Microsoft::Common::Unicode::Utf8ToUtf16(message); | ||
| result.Status = TestStatus::Failed; | ||
| ::SetEvent(functionCalled); | ||
| break; | ||
|
|
||
| case RCTLogLevel::Info: | ||
| case RCTLogLevel::Trace: | ||
| case RCTLogLevel::Warning: | ||
| default: | ||
| break; | ||
| } | ||
| }); | ||
|
|
||
| instance->AttachMeasuredRootView(move(appName)); | ||
|
|
||
| // Failure on instance creation. | ||
| if (TestStatus::Failed == result.Status) | ||
| return result; | ||
|
|
||
| AwaitEvent(functionCalled, result); | ||
|
|
||
| instance->DetachRootView(); | ||
| } | ||
|
|
||
| // Tear down | ||
| CloseHandle(functionCalled); | ||
| functionCalled = NULL; | ||
| } catch (...) { | ||
| result.Message = Microsoft::Common::Unicode::Utf8ToUtf16( | ||
| boost::current_exception_diagnostic_information(/*verbose*/ true)); | ||
| result.Status = TestStatus::Failed; | ||
| }; | ||
| devSettings->loggingCallback = std::move(loggingCallback); | ||
|
|
||
| // React instance scope | ||
| { | ||
| shared_ptr<ITestInstance> instance = GetInstance( | ||
| std::move(bundlePath), std::move(modules), std::move(devSettings)); | ||
|
|
||
| InitializeLogging( | ||
| [&result, &functionCalled](RCTLogLevel logLevel, const char *message) { | ||
| if (TestStatus::Pending != result.Status) | ||
| return; | ||
|
|
||
| switch (logLevel) { | ||
| case RCTLogLevel::Error: | ||
| case RCTLogLevel::Fatal: | ||
| result.Message = Microsoft::Common::Unicode::Utf8ToUtf16(message); | ||
| result.Status = TestStatus::Failed; | ||
| ::SetEvent(functionCalled); | ||
| break; | ||
|
|
||
| case RCTLogLevel::Info: | ||
| case RCTLogLevel::Trace: | ||
| case RCTLogLevel::Warning: | ||
| default: | ||
| break; | ||
| } | ||
| }); | ||
|
|
||
| instance->AttachMeasuredRootView(move(appName)); | ||
|
|
||
| // Failure on instance creation. | ||
| if (TestStatus::Failed == result.Status) | ||
| return result; | ||
|
|
||
| AwaitEvent(functionCalled, result); | ||
|
|
||
| instance->DetachRootView(); | ||
| } | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. we wouldn't get a stack trace here though? can we capture the stack trace from the exception? #Resolved
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Stack trace is not what I target yet. In reply to: 337866067 [](ancestors = 337866067) |
||
|
|
||
| // Tear down | ||
| CloseHandle(functionCalled); | ||
| functionCalled = NULL; | ||
|
|
||
| return result; | ||
| } | ||
|
|
||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.