Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 41 additions & 1 deletion .ado/windows-vs-pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -242,6 +242,46 @@ jobs:
publishRunAttachments: true
collectDumpOn: onAbortOnly
vsTestVersion: toolsInstaller
otherConsoleOptions: '/blame -- RunConfiguration.TestSessionTimeout=300000'

- 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: false
platform: $(BuildPlatform)
configuration: $(BuildConfiguration)
publishRunAttachments: false
collectDumpOn: onAbortOnly
vsTestVersion: toolsInstaller
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

Expand Down
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
Expand Up @@ -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)
Expand Down
143 changes: 75 additions & 68 deletions vnext/IntegrationTests/TestRunner.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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();
}
Copy link
Member

@asklar asklar Oct 23, 2019

Choose a reason for hiding this comment

The 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

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Stack trace is not what I target yet.
exception is just suspicious which may contribute the timeout. Here catching all exception is just help to narrow down the problem.
If I see this error, I will provide more logs like catch(std::exception) and log the stack.


In reply to: 337866067 [](ancestors = 337866067)


// Tear down
CloseHandle(functionCalled);
functionCalled = NULL;

return result;
}

Expand Down