From 0715de1850a48fe088bc979fc0787ca4a51457a5 Mon Sep 17 00:00:00 2001 From: Canhua Li Date: Tue, 22 Oct 2019 11:56:47 -0700 Subject: [PATCH 01/10] Timeout for integration test --- .ado/windows-vs-pr.yml | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/.ado/windows-vs-pr.yml b/.ado/windows-vs-pr.yml index cd2fff3f60b..a821878eba1 100644 --- a/.ado/windows-vs-pr.yml +++ b/.ado/windows-vs-pr.yml @@ -229,6 +229,21 @@ jobs: filePath: $(Build.SourcesDirectory)\vnext\Scripts\Tfs\Start-TestServers.ps1 arguments: -SourcesDirectory $(Build.SourcesDirectory)\vnext -Preload -SleepSeconds 30 + - task: VSTest@2 + displayName: List Desktop Integration Tests + inputs: + testSelector: testAssemblies + testAssemblyVer2: React.Windows.Desktop.IntegrationTests\React.Windows.Desktop.IntegrationTests.dll + searchFolder: $(Build.SourcesDirectory)\vnext\target\$(BuildPlatform)\$(BuildConfiguration) + testFiltercriteria: $(Desktop.IntegrationTests.Filter) + runTestsInIsolation: true + platform: $(BuildPlatform) + configuration: $(BuildConfiguration) + publishRunAttachments: true + collectDumpOn: onAbortOnly + vsTestVersion: toolsInstaller + otherConsoleOptions: '/ListTests' + - task: VSTest@2 displayName: Run Desktop Integration Tests inputs: @@ -242,6 +257,7 @@ jobs: publishRunAttachments: true collectDumpOn: onAbortOnly vsTestVersion: toolsInstaller + otherConsoleOptions: 'RunConfiguration.TestSessionTimeout=100000' - template: templates/stop-packagers.yml From e662909e46469d53ed5444a167be52212a193c78 Mon Sep 17 00:00:00 2001 From: Canhua Li Date: Tue, 22 Oct 2019 12:29:01 -0700 Subject: [PATCH 02/10] reverse the order --- .ado/windows-vs-pr.yml | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/.ado/windows-vs-pr.yml b/.ado/windows-vs-pr.yml index a821878eba1..14d88abf9ea 100644 --- a/.ado/windows-vs-pr.yml +++ b/.ado/windows-vs-pr.yml @@ -230,7 +230,7 @@ jobs: arguments: -SourcesDirectory $(Build.SourcesDirectory)\vnext -Preload -SleepSeconds 30 - task: VSTest@2 - displayName: List Desktop Integration Tests + displayName: Run Desktop Integration Tests inputs: testSelector: testAssemblies testAssemblyVer2: React.Windows.Desktop.IntegrationTests\React.Windows.Desktop.IntegrationTests.dll @@ -242,22 +242,23 @@ jobs: publishRunAttachments: true collectDumpOn: onAbortOnly vsTestVersion: toolsInstaller - otherConsoleOptions: '/ListTests' + otherConsoleOptions: 'RunConfiguration.TestSessionTimeout=100000' - task: VSTest@2 - displayName: Run Desktop Integration Tests + displayName: List Desktop Integration Tests inputs: testSelector: testAssemblies testAssemblyVer2: React.Windows.Desktop.IntegrationTests\React.Windows.Desktop.IntegrationTests.dll searchFolder: $(Build.SourcesDirectory)\vnext\target\$(BuildPlatform)\$(BuildConfiguration) testFiltercriteria: $(Desktop.IntegrationTests.Filter) - runTestsInIsolation: true + runTestsInIsolation: false platform: $(BuildPlatform) configuration: $(BuildConfiguration) - publishRunAttachments: true + publishRunAttachments: false collectDumpOn: onAbortOnly vsTestVersion: toolsInstaller - otherConsoleOptions: 'RunConfiguration.TestSessionTimeout=100000' + otherConsoleOptions: '/ListTests' + condition: failed() - template: templates/stop-packagers.yml From 280961e3be3c72152ef99685388f497801d9536b Mon Sep 17 00:00:00 2001 From: Canhua Li Date: Tue, 22 Oct 2019 12:53:46 -0700 Subject: [PATCH 03/10] Update windows-vs-pr.yml for Azure Pipelines --- .ado/windows-vs-pr.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.ado/windows-vs-pr.yml b/.ado/windows-vs-pr.yml index 14d88abf9ea..647a6c55588 100644 --- a/.ado/windows-vs-pr.yml +++ b/.ado/windows-vs-pr.yml @@ -242,7 +242,7 @@ jobs: publishRunAttachments: true collectDumpOn: onAbortOnly vsTestVersion: toolsInstaller - otherConsoleOptions: 'RunConfiguration.TestSessionTimeout=100000' + otherConsoleOptions: '-- RunConfiguration.TestSessionTimeout=100000' - task: VSTest@2 displayName: List Desktop Integration Tests From 0ed888884005580ff6ef01a0bdcbd277674c97a1 Mon Sep 17 00:00:00 2001 From: Canhua Li Date: Tue, 22 Oct 2019 14:42:03 -0700 Subject: [PATCH 04/10] catch exception --- .ado/windows-vs-pr.yml | 2 +- vnext/IntegrationTests/TestRunner.cpp | 143 ++++++++++++++------------ 2 files changed, 76 insertions(+), 69 deletions(-) diff --git a/.ado/windows-vs-pr.yml b/.ado/windows-vs-pr.yml index 647a6c55588..77cc1614d6d 100644 --- a/.ado/windows-vs-pr.yml +++ b/.ado/windows-vs-pr.yml @@ -242,7 +242,7 @@ jobs: publishRunAttachments: true collectDumpOn: onAbortOnly vsTestVersion: toolsInstaller - otherConsoleOptions: '-- RunConfiguration.TestSessionTimeout=100000' + otherConsoleOptions: '-- RunConfiguration.TestSessionTimeout=120000' - task: VSTest@2 displayName: List Desktop Integration Tests diff --git a/vnext/IntegrationTests/TestRunner.cpp b/vnext/IntegrationTests/TestRunner.cpp index be8d8411e67..15b88926cda 100644 --- a/vnext/IntegrationTests/TestRunner.cpp +++ b/vnext/IntegrationTests/TestRunner.cpp @@ -13,6 +13,8 @@ #include #include +#include + 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> modules{make_tuple( - TestModule::name, - [this, &result, &functionCalled]() -> unique_ptr { - return make_unique( - [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 = make_shared(); - 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> modules{make_tuple( + TestModule::name, + [this, &result, &functionCalled]() -> unique_ptr { + return make_unique([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 = make_shared(); + 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 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 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; - return result; } From b9f8626afe67dc7c9a006f4f44b3a1aa51fb0891 Mon Sep 17 00:00:00 2001 From: Canhua Li Date: Tue, 22 Oct 2019 14:55:08 -0700 Subject: [PATCH 05/10] add blame --- .ado/windows-vs-pr.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.ado/windows-vs-pr.yml b/.ado/windows-vs-pr.yml index 77cc1614d6d..7bd5d860803 100644 --- a/.ado/windows-vs-pr.yml +++ b/.ado/windows-vs-pr.yml @@ -242,7 +242,7 @@ jobs: publishRunAttachments: true collectDumpOn: onAbortOnly vsTestVersion: toolsInstaller - otherConsoleOptions: '-- RunConfiguration.TestSessionTimeout=120000' + otherConsoleOptions: '/blame -- RunConfiguration.TestSessionTimeout=120000' - task: VSTest@2 displayName: List Desktop Integration Tests From 22b93617e6a57902dcf4ec4250d9664b62b10008 Mon Sep 17 00:00:00 2001 From: Canhua Li Date: Tue, 22 Oct 2019 15:00:17 -0700 Subject: [PATCH 06/10] Change files --- ...tive-windows-2019-10-22-15-00-16-azure-pipelines.json | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 change/react-native-windows-2019-10-22-15-00-16-azure-pipelines.json diff --git a/change/react-native-windows-2019-10-22-15-00-16-azure-pipelines.json b/change/react-native-windows-2019-10-22-15-00-16-azure-pipelines.json new file mode 100644 index 00000000000..fb0db79fd4d --- /dev/null +++ b/change/react-native-windows-2019-10-22-15-00-16-azure-pipelines.json @@ -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" +} \ No newline at end of file From df991afd52697fe19cf79b5767a407fd6abc0448 Mon Sep 17 00:00:00 2001 From: Canhua Li Date: Tue, 22 Oct 2019 15:55:35 -0700 Subject: [PATCH 07/10] timer to 300s --- .ado/windows-vs-pr.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.ado/windows-vs-pr.yml b/.ado/windows-vs-pr.yml index 7bd5d860803..c78a69eb86e 100644 --- a/.ado/windows-vs-pr.yml +++ b/.ado/windows-vs-pr.yml @@ -242,7 +242,7 @@ jobs: publishRunAttachments: true collectDumpOn: onAbortOnly vsTestVersion: toolsInstaller - otherConsoleOptions: '/blame -- RunConfiguration.TestSessionTimeout=120000' + otherConsoleOptions: '/blame -- RunConfiguration.TestSessionTimeout=300000' - task: VSTest@2 displayName: List Desktop Integration Tests From 6bf2fb6da4f9fb6e2f623839446cc48afdfaf05d Mon Sep 17 00:00:00 2001 From: Canhua Li Date: Tue, 22 Oct 2019 21:01:31 -0700 Subject: [PATCH 08/10] Ping metro bundle and re-run test when failed. --- .ado/windows-vs-pr.yml | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/.ado/windows-vs-pr.yml b/.ado/windows-vs-pr.yml index c78a69eb86e..776fa4c359d 100644 --- a/.ado/windows-vs-pr.yml +++ b/.ado/windows-vs-pr.yml @@ -260,6 +260,29 @@ jobs: otherConsoleOptions: '/ListTests' condition: failed() + - task: VSTest@2 + displayName: Re-Run Desktop Integration Tests + inputs: + testSelector: testAssemblies + testAssemblyVer2: React.Windows.Desktop.IntegrationTests\React.Windows.Desktop.IntegrationTests.dll + searchFolder: $(Build.SourcesDirectory)\vnext\target\$(BuildPlatform)\$(BuildConfiguration) + testFiltercriteria: $(Desktop.IntegrationTests.Filter) + runTestsInIsolation: true + platform: $(BuildPlatform) + configuration: $(BuildConfiguration) + publishRunAttachments: true + collectDumpOn: onAbortOnly + vsTestVersion: toolsInstaller + otherConsoleOptions: '/blame -- RunConfiguration.TestSessionTimeout=300000' + condition: failed() + + - task: PowerShell@2 + displayName: Check the metro bundle server + inputs: + targetType: 'inline' + script: Invoke-WebRequest -Uri "http://localhost:8081/IntegrationTests/IntegrationTestsAppWin.bundle?platform=windesktop&dev=true" + condition: failed() + - template: templates/stop-packagers.yml - template: templates/publish-build-artifacts-for-nuget.yml From 28bb5f6716257fe2427860bd92ec626469d50f92 Mon Sep 17 00:00:00 2001 From: Canhua Li Date: Wed, 23 Oct 2019 10:34:05 -0700 Subject: [PATCH 09/10] Exclude the problem of bundle server not ready Change wait time to 2min --- .ado/windows-vs-pr.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.ado/windows-vs-pr.yml b/.ado/windows-vs-pr.yml index 776fa4c359d..f6de17d73e6 100644 --- a/.ado/windows-vs-pr.yml +++ b/.ado/windows-vs-pr.yml @@ -227,7 +227,7 @@ jobs: inputs: targetType: filePath # filePath | inline filePath: $(Build.SourcesDirectory)\vnext\Scripts\Tfs\Start-TestServers.ps1 - arguments: -SourcesDirectory $(Build.SourcesDirectory)\vnext -Preload -SleepSeconds 30 + arguments: -SourcesDirectory $(Build.SourcesDirectory)\vnext -Preload -SleepSeconds 120 - task: VSTest@2 displayName: Run Desktop Integration Tests From 8d365f1243b450227a71fac1d82962df849cbcef Mon Sep 17 00:00:00 2001 From: Canhua Li Date: Wed, 23 Oct 2019 11:41:24 -0700 Subject: [PATCH 10/10] Disable IntegrationTestHarnessTest --- vnext/Desktop.IntegrationTests/RNTesterIntegrationTests.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/vnext/Desktop.IntegrationTests/RNTesterIntegrationTests.cpp b/vnext/Desktop.IntegrationTests/RNTesterIntegrationTests.cpp index c73dac0fb28..6810b92e4f4 100644 --- a/vnext/Desktop.IntegrationTests/RNTesterIntegrationTests.cpp +++ b/vnext/Desktop.IntegrationTests/RNTesterIntegrationTests.cpp @@ -102,7 +102,7 @@ TEST_CLASS(RNTesterIntegrationTests) { #pragma endregion TEST_METHOD(IntegrationTestHarness) { - TestComponent("IntegrationTestHarnessTest"); + // TestComponent("IntegrationTestHarnessTest"); } // Timer tests have been disabled in RN. (See RNTesterIntegrationTests.m)