Skip to content

Commit

Permalink
Merge branch 'master' of https://github.com/microsoft/vstest into rel…
Browse files Browse the repository at this point in the history
…/16.8
  • Loading branch information
nohwnd committed Sep 2, 2020
2 parents b9cd8eb + 95cb80f commit 0c0fafa
Show file tree
Hide file tree
Showing 36 changed files with 272 additions and 180 deletions.
1 change: 1 addition & 0 deletions NuGet.config
Expand Up @@ -23,4 +23,5 @@
<!-- This path is relative as a workaround to https://github.com/NuGet/Home/issues/2831 -->
<add key="globalPackagesFolder" value="packages" />
</config>
<disabledPackageSources />
</configuration>
20 changes: 10 additions & 10 deletions eng/Version.Details.xml
Expand Up @@ -3,25 +3,25 @@
<ProductDependencies>
</ProductDependencies>
<ToolsetDependencies>
<Dependency Name="Microsoft.DotNet.Arcade.Sdk" Version="1.0.0-beta.20411.9">
<Dependency Name="Microsoft.DotNet.Arcade.Sdk" Version="1.0.0-beta.20427.6">
<Uri>https://github.com/dotnet/arcade</Uri>
<Sha>2e804f8d57972faf64a19a7295728dc7bfcb5fce</Sha>
<Sha>84cd401ce792220bdb17c5587f9b39265170c03f</Sha>
</Dependency>
<Dependency Name="Microsoft.DotNet.Build.Tasks.Feed" Version="2.2.0-beta.20411.9">
<Dependency Name="Microsoft.DotNet.Build.Tasks.Feed" Version="2.2.0-beta.20427.6">
<Uri>https://github.com/dotnet/arcade</Uri>
<Sha>2e804f8d57972faf64a19a7295728dc7bfcb5fce</Sha>
<Sha>84cd401ce792220bdb17c5587f9b39265170c03f</Sha>
</Dependency>
<Dependency Name="Microsoft.DotNet.SignTool" Version="1.0.0-beta.20411.9">
<Dependency Name="Microsoft.DotNet.SignTool" Version="1.0.0-beta.20427.6">
<Uri>https://github.com/dotnet/arcade</Uri>
<Sha>2e804f8d57972faf64a19a7295728dc7bfcb5fce</Sha>
<Sha>84cd401ce792220bdb17c5587f9b39265170c03f</Sha>
</Dependency>
<Dependency Name="Microsoft.DotNet.Helix.Sdk" Version="2.0.0-beta.20411.9">
<Dependency Name="Microsoft.DotNet.Helix.Sdk" Version="2.0.0-beta.20427.6">
<Uri>https://github.com/dotnet/arcade</Uri>
<Sha>2e804f8d57972faf64a19a7295728dc7bfcb5fce</Sha>
<Sha>84cd401ce792220bdb17c5587f9b39265170c03f</Sha>
</Dependency>
<Dependency Name="Microsoft.DotNet.SwaggerGenerator.MSBuild" Version="1.0.0-beta.20411.9">
<Dependency Name="Microsoft.DotNet.SwaggerGenerator.MSBuild" Version="1.0.0-beta.20427.6">
<Uri>https://github.com/dotnet/arcade</Uri>
<Sha>2e804f8d57972faf64a19a7295728dc7bfcb5fce</Sha>
<Sha>84cd401ce792220bdb17c5587f9b39265170c03f</Sha>
</Dependency>
<Dependency Name="Microsoft.DotNet.Maestro.Client" Version="1.1.0-beta.19556.4">
<Uri>https://github.com/dotnet/arcade-services</Uri>
Expand Down
6 changes: 3 additions & 3 deletions eng/Versions.props
Expand Up @@ -60,8 +60,8 @@
<XUnitVersion>2.4.1</XUnitVersion>
<XUnitAbstractionsVersion>2.0.3</XUnitAbstractionsVersion>
<XUnitVSRunnerVersion>2.4.1</XUnitVSRunnerVersion>
<MicrosoftDotNetBuildTasksFeedVersion>2.2.0-beta.20411.9</MicrosoftDotNetBuildTasksFeedVersion>
<MicrosoftDotNetSignToolVersion>1.0.0-beta.20411.9</MicrosoftDotNetSignToolVersion>
<MicrosoftDotNetBuildTasksFeedVersion>2.2.0-beta.20427.6</MicrosoftDotNetBuildTasksFeedVersion>
<MicrosoftDotNetSignToolVersion>1.0.0-beta.20427.6</MicrosoftDotNetSignToolVersion>
<MicrosoftAzureDocumentDBVersion>1.22.0</MicrosoftAzureDocumentDBVersion>
<MicrosoftAzureCosmosDBTableVersion>1.1.2</MicrosoftAzureCosmosDBTableVersion>
<MicrosoftAspNetCoreAllVersion>2.0.0</MicrosoftAspNetCoreAllVersion>
Expand All @@ -73,7 +73,7 @@
<MicrosoftDiaSymReaderNativeVersion>1.7.0</MicrosoftDiaSymReaderNativeVersion>
<MicrosoftDotNetMaestroClientVersion>1.1.0-beta.19556.4</MicrosoftDotNetMaestroClientVersion>
<MicrosoftSourceLinkVersion>1.0.0-beta2-19554-01</MicrosoftSourceLinkVersion>
<MicrosoftDotNetSwaggerGeneratorMSBuildVersion>1.0.0-beta.20411.9</MicrosoftDotNetSwaggerGeneratorMSBuildVersion>
<MicrosoftDotNetSwaggerGeneratorMSBuildVersion>1.0.0-beta.20427.6</MicrosoftDotNetSwaggerGeneratorMSBuildVersion>
<XliffTasksVersion>1.0.0-beta.20055.1</XliffTasksVersion>
</PropertyGroup>
</Project>
30 changes: 22 additions & 8 deletions eng/common/darc-init.sh
Expand Up @@ -2,8 +2,8 @@

source="${BASH_SOURCE[0]}"
darcVersion=''
versionEndpoint="https://maestro-prod.westus2.cloudapp.azure.com/api/assets/darc-version?api-version=2019-01-16"
verbosity=m
versionEndpoint='https://maestro-prod.westus2.cloudapp.azure.com/api/assets/darc-version?api-version=2019-01-16'
verbosity='minimal'

while [[ $# > 0 ]]; do
opt="$(echo "$1" | awk '{print tolower($0)}')"
Expand All @@ -20,6 +20,10 @@ while [[ $# > 0 ]]; do
verbosity=$2
shift
;;
--toolpath)
toolpath=$2
shift
;;
*)
echo "Invalid argument: $1"
usage
Expand Down Expand Up @@ -52,17 +56,27 @@ function InstallDarcCli {
InitializeDotNetCli
local dotnet_root=$_InitializeDotNetCli

local uninstall_command=`$dotnet_root/dotnet tool uninstall $darc_cli_package_name -g`
local tool_list=$($dotnet_root/dotnet tool list -g)
if [[ $tool_list = *$darc_cli_package_name* ]]; then
echo $($dotnet_root/dotnet tool uninstall $darc_cli_package_name -g)
if [ -z "$toolpath" ]; then
local tool_list=$($dotnet_root/dotnet tool list -g)
if [[ $tool_list = *$darc_cli_package_name* ]]; then
echo $($dotnet_root/dotnet tool uninstall $darc_cli_package_name -g)
fi
else
local tool_list=$($dotnet_root/dotnet tool list --tool-path "$toolpath")
if [[ $tool_list = *$darc_cli_package_name* ]]; then
echo $($dotnet_root/dotnet tool uninstall $darc_cli_package_name --tool-path "$toolpath")
fi
fi

local arcadeServicesSource="https://dotnetfeed.blob.core.windows.net/dotnet-core/index.json"
local arcadeServicesSource="https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-eng/nuget/v3/index.json"

echo "Installing Darc CLI version $darcVersion..."
echo "You may need to restart your command shell if this is the first dotnet tool you have installed."
echo $($dotnet_root/dotnet tool install $darc_cli_package_name --version $darcVersion --add-source "$arcadeServicesSource" -v $verbosity -g)
if [ -z "$toolpath" ]; then
echo $($dotnet_root/dotnet tool install $darc_cli_package_name --version $darcVersion --add-source "$arcadeServicesSource" -v $verbosity -g)
else
echo $($dotnet_root/dotnet tool install $darc_cli_package_name --version $darcVersion --add-source "$arcadeServicesSource" -v $verbosity --tool-path "$toolpath")
fi
}

InstallDarcCli
4 changes: 2 additions & 2 deletions global.json
Expand Up @@ -9,7 +9,7 @@
"dotnet": "5.0.100-rc.1.20380.12"
},
"msbuild-sdks": {
"Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.20411.9",
"Microsoft.DotNet.Helix.Sdk": "2.0.0-beta.20411.9"
"Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.20427.6",
"Microsoft.DotNet.Helix.Sdk": "2.0.0-beta.20427.6"
}
}
2 changes: 1 addition & 1 deletion scripts/build.ps1
Expand Up @@ -717,7 +717,7 @@ function Create-NugetPackages

# Additional external dependency folders
$microsoftFakesVersion = ([xml](Get-Content $env:TP_ROOT_DIR\scripts\build\TestPlatform.Dependencies.props)).Project.PropertyGroup.MicrosoftFakesVersion
$FakesPackageDir = Join-Path $env:TP_PACKAGES_DIR "Microsoft.VisualStudio.TestPlatform.Fakes\$microsoftFakesVersion\lib"
$FakesPackageDir = Join-Path $env:TP_PACKAGES_DIR "Microsoft.QualityTools.Testing.Fakes.TestRunnerHarness\$microsoftFakesVersion\contentFiles"

# package them from stagingDir
foreach ($file in $nuspecFiles) {
Expand Down
2 changes: 1 addition & 1 deletion scripts/build/TestPlatform.Dependencies.props
Expand Up @@ -32,7 +32,7 @@
<JsonNetVersion>9.0.1</JsonNetVersion>
<MoqVersion>4.7.63</MoqVersion>
<TestPlatformExternalsVersion>16.8.0-preview-3968212</TestPlatformExternalsVersion>
<MicrosoftFakesVersion>16.6.3-beta.20221.2</MicrosoftFakesVersion>
<MicrosoftFakesVersion>16.8.0-beta.20420.2</MicrosoftFakesVersion>

<MicrosoftBuildPackageVersion>16.0.461</MicrosoftBuildPackageVersion>
<MicrosoftBuildFrameworkPackageVersion>$(MicrosoftBuildPackageVersion)</MicrosoftBuildFrameworkPackageVersion>
Expand Down
2 changes: 1 addition & 1 deletion scripts/verify-nupkgs.ps1
Expand Up @@ -15,7 +15,7 @@ function Verify-Nuget-Packages($packageDirectory)
$expectedNumOfFiles = @{
"Microsoft.CodeCoverage" = 29;
"Microsoft.NET.Test.Sdk" = 13;
"Microsoft.TestPlatform" = 469;
"Microsoft.TestPlatform" = 477;
"Microsoft.TestPlatform.Build" = 19;
"Microsoft.TestPlatform.CLI" = 350;
"Microsoft.TestPlatform.Extensions.TrxLogger" = 33;
Expand Down
2 changes: 1 addition & 1 deletion scripts/vsts-prebuild.ps1
Expand Up @@ -41,5 +41,5 @@ $JsonNetVersion = ([xml](Get-Content $TP_ROOT_DIR\scripts\build\TestPlatform.Dep
Write-Host "##vso[task.setvariable variable=JsonNetVersion;]$JsonNetVersion"

$microsoftFakesVersion = ([xml](Get-Content $TP_ROOT_DIR\scripts\build\TestPlatform.Dependencies.props)).Project.PropertyGroup.MicrosoftFakesVersion
$FakesPackageDir = Join-Path $TP_ROOT_DIR "packages\Microsoft.VisualStudio.TestPlatform.Fakes\$microsoftFakesVersion\lib"
$FakesPackageDir = Join-Path $TP_ROOT_DIR "packages\Microsoft.QualityTools.Testing.Fakes.TestRunnerHarness\$microsoftFakesVersion\contentFiles"
Write-Host "##vso[task.setvariable variable=FakesPackageDir;]$FakesPackageDir"
Expand Up @@ -95,7 +95,7 @@ public static void UpdateRunSettingsNode(this IRunSettingsProvider runSettingsPr
/// <returns></returns>
public static Match GetTestRunParameterNodeMatch(this IRunSettingsProvider runSettingsProvider, string node)
{
var attrName = $"(?<{AttributeNameString}>\\w+)";
var attrName = $"(?<{AttributeNameString}>[\\w.:-]+)";
var attrValue = $"(?<{AttributeValueString}>.+)";
Regex regex = new Regex($"{Constants.TestRunParametersName}.{ParameterString}\\(name\\s*=\\s*\"{attrName}\"\\s*,\\s*value\\s*=\\s*\"{attrValue}\"\\)");
Match match = regex.Match(node);
Expand Down
Expand Up @@ -11,28 +11,28 @@ namespace Microsoft.VisualStudio.TestPlatform.CommunicationUtilities.Interfaces
public class CommunicationException : Exception
{
/// <summary>
/// Initializes a new instance of <see cref="CommunicationException" /> class.
/// Initializes a new instance of the <see cref="CommunicationException" /> class.
/// </summary>
public CommunicationException()
{
}

/// <summary>
/// Initializes a new instance of <see cref="CommunicationException" /> class with provided
/// Initializes a new instance of the <see cref="CommunicationException" /> class with provided
/// message.
/// </summary>
/// <param Name="message">Message describing the error.</param>
/// <param name="message">Message describing the error.</param>
public CommunicationException(string message)
: base(message)
{
}

/// <summary>
/// Initializes a new instance of <see cref="CommunicationException" /> class with provided
/// Initializes a new instance of the <see cref="CommunicationException" /> class with provided
/// message and inner exception.
/// </summary>
/// <param Name="message">Message describing the error.</param>
/// <param Name="inner">Inner exception.</param>
/// <param name="message">Message describing the error.</param>
/// <param name="inner">Inner exception.</param>
public CommunicationException(string message, Exception inner)
: base(message, inner)
{
Expand Down
Expand Up @@ -46,7 +46,6 @@ public class BlameCollector : DataCollector, ITestExecutionEnvironmentSpecifier
private IInactivityTimer inactivityTimer;
private TimeSpan inactivityTimespan = TimeSpan.FromMinutes(DefaultInactivityTimeInMinutes);
private int testHostProcessId;
private bool dumpWasCollectedByHangDumper;
private string targetFramework;
private List<KeyValuePair<string, string>> environmentVariables = new List<KeyValuePair<string, string>>();
private bool uploadDumpFiles;
Expand Down Expand Up @@ -223,7 +222,7 @@ private void CollectDumpAndAbortTesthost()
}
catch (Exception ex)
{
ConsoleOutput.Instance.Error(true, $"Blame: Creating hang dump failed with error {ex}.");
this.logger.LogError(this.context.SessionDataCollectionContext, $"Blame: Creating hang dump failed with error.", ex);
}

if (this.collectProcessDumpOnTrigger)
Expand All @@ -244,7 +243,6 @@ private void CollectDumpAndAbortTesthost()
{
if (!string.IsNullOrEmpty(dumpFile))
{
this.dumpWasCollectedByHangDumper = true;
var fileTransferInformation = new FileTransferInformation(this.context.SessionDataCollectionContext, dumpFile, true, this.fileHelper);
this.dataCollectionSink.SendFileAsync(fileTransferInformation);
}
Expand All @@ -263,7 +261,7 @@ private void CollectDumpAndAbortTesthost()
}
catch (Exception ex)
{
ConsoleOutput.Instance.Error(true, $"Blame: Collecting hang dump failed with error {ex}.");
this.logger.LogError(this.context.SessionDataCollectionContext, $"Blame: Collecting hang dump failed with error.", ex);
}
}
else
Expand Down Expand Up @@ -452,47 +450,37 @@ private void SessionEndedHandler(object sender, SessionEndEventArgs args)
this.logger.LogWarning(this.context.SessionDataCollectionContext, Resources.Resources.NotGeneratingSequenceFile);
}

if (this.collectProcessDumpOnTrigger)
if (this.uploadDumpFiles)
{
// If there was a test case crash or if we need to collect dump on process exit.
//
// Do not try to collect dump when we already collected one from the hang dump
// we won't dump the killed process again and that would just show a warning on the command line
if ((this.testStartCount > this.testEndCount || this.collectDumpAlways) && !this.dumpWasCollectedByHangDumper)
try
{
if (this.uploadDumpFiles)
var dumpFiles = this.processDumpUtility.GetDumpFiles();
foreach (var dumpFile in dumpFiles)
{
try
if (!string.IsNullOrEmpty(dumpFile))
{
var dumpFiles = this.processDumpUtility.GetDumpFiles();
foreach (var dumpFile in dumpFiles)
try
{
if (!string.IsNullOrEmpty(dumpFile))
{
try
{
var fileTranferInformation = new FileTransferInformation(this.context.SessionDataCollectionContext, dumpFile, true);
this.dataCollectionSink.SendFileAsync(fileTranferInformation);
}
catch (FileNotFoundException ex)
{
EqtTrace.Warning(ex.ToString());
this.logger.LogWarning(args.Context, ex.ToString());
}
}
var fileTranferInformation = new FileTransferInformation(this.context.SessionDataCollectionContext, dumpFile, true);
this.dataCollectionSink.SendFileAsync(fileTranferInformation);
}
catch (FileNotFoundException ex)
{
EqtTrace.Warning(ex.ToString());
this.logger.LogWarning(args.Context, ex.ToString());
}
}
catch (FileNotFoundException ex)
{
EqtTrace.Warning(ex.ToString());
this.logger.LogWarning(args.Context, ex.ToString());
}
}
else
{
EqtTrace.Info("BlameCollector.CollectDumpAndAbortTesthost: Custom path to dump directory was provided via VSTEST_DUMP_PATH. Skipping attachment upload, the caller is responsible for collecting and uploading the dumps themselves.");
}
}
catch (FileNotFoundException ex)
{
EqtTrace.Warning(ex.ToString());
this.logger.LogWarning(args.Context, ex.ToString());
}
}
else
{
EqtTrace.Info("BlameCollector.CollectDumpAndAbortTesthost: Custom path to dump directory was provided via VSTEST_DUMP_PATH. Skipping attachment upload, the caller is responsible for collecting and uploading the dumps themselves.");
}
}
finally
Expand Down
Expand Up @@ -112,15 +112,13 @@ private void TestRunCompleteHandler(object sender, TestRunCompleteEventArgs e)
return;
}

this.output.Error(false, Resources.Resources.AbortedTestRun);

StringBuilder sb = new StringBuilder();
foreach (var tcn in testCaseNames)
{
sb.Append(tcn).Append(Environment.NewLine);
}

this.output.Error(false, sb.ToString());
this.output.Error(false, Resources.Resources.AbortedTestRun, sb.ToString());
}

#endregion
Expand Down
Expand Up @@ -37,6 +37,20 @@ public ICrashDumper Create(string targetFramework)
return new ProcDumpCrashDumper();
}

// On net5.0 we don't have the capability to crash dump on exit, which is useful in rare cases
// like when user exits the testhost process with a random exit code, adding this evn variable
// to force using procdump. This relies on netclient dumper actualy doing all it's work in blame collector
// where it sets all the environment variables, so in effect we will have two crash dumpers active at the same time.
// This proven to be working okay while net5.0 could not create dumps from Task.Run, and I was using this same technique
// to get dump of testhost. This needs PROCDUMP_PATH set to directory with procdump.exe, or having it in path.
var procdumpOverride = Environment.GetEnvironmentVariable("VSTEST_DUMP_FORCEPROCDUMP")?.Trim();
var forceUsingProcdump = !string.IsNullOrWhiteSpace(procdumpOverride) && procdumpOverride != "0";
if (forceUsingProcdump)
{
EqtTrace.Info($"CrashDumperFactory: This is Windows on {targetFramework}. Forcing the use of ProcDumpCrashDumper that uses ProcDump utility, via VSTEST_DUMP_FORCEPROCDUMP={procdumpOverride}.");
return new ProcDumpCrashDumper();
}

EqtTrace.Info($"CrashDumperFactory: This is Windows on {targetFramework}, returning the .NETClient dumper which uses env variables to collect crashdumps of testhost and any child process.");
return new NetClientCrashDumper();
}
Expand Down

0 comments on commit 0c0fafa

Please sign in to comment.