Skip to content

Commit

Permalink
[Symbol archiving]Converting Portable pdb to full (#375)
Browse files Browse the repository at this point in the history
* COnverting portable pdbs to full for Symbol archiving

* Fixing nuget package path

* Test fix

* Indent fix
  • Loading branch information
jayaranigarg authored Feb 28, 2018
1 parent 189f3b1 commit 83c5981
Show file tree
Hide file tree
Showing 4 changed files with 75 additions and 5 deletions.
1 change: 1 addition & 0 deletions Nuget.config
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
<add key="api.nuget.org" value="https://api.nuget.org/v3/index.json" />
<add key="vstest" value="https://dotnet.myget.org/F/vstest/api/v3/index.json" />
<add key="mstestv2" value="https://dotnet.myget.org/F/mstestv2/auth/1e768268-8c95-4e7e-9fd2-0eb1b1b69b18/api/v3/index.json" />
<add key="pdb2pdb.myget" value="https://dotnet.myget.org/F/symreader-converter/api/v3/index.json" />
</packageSources>
<activePackageSource>
<add key="All" value="(Aggregate source)" />
Expand Down
70 changes: 70 additions & 0 deletions scripts/PortableToFullPdb.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
# Copyright (c) Microsoft. All rights reserved.
# Portable to Full PDB conversion script for Test Platform.

[CmdletBinding()]
Param(
[Parameter(Mandatory=$false)]
[ValidateSet("Debug", "Release")]
[System.String] $Configuration = "Release"
)

#
# Variables
#
Write-Verbose "Setup environment variables."
$TF_ROOT_DIR = (Get-Item (Split-Path $MyInvocation.MyCommand.Path)).Parent.FullName
$TF_PACKAGES_DIR = Join-Path $TF_ROOT_DIR "packages"
$TF_OUT_DIR = Join-Path $TF_ROOT_DIR "artifacts"
$TF_PortablePdbs =@("PlatformServices.NetCore\netstandard1.5\Microsoft.VisualStudio.TestPlatform.MSTestAdapter.PlatformServices.pdb")

$PdbConverterToolVersion = "1.1.0-beta1-62316-01"

function Locate-PdbConverterTool
{
$pdbConverter = Join-Path -path $TF_PACKAGES_DIR -ChildPath "Pdb2Pdb.$PdbConverterToolVersion\tools\Pdb2Pdb.exe"

if (!(Test-Path -path $pdbConverter))
{
throw "Unable to locate Pdb2Pdb converter exe in path '$pdbConverter'."
}

Write-Verbose "Pdb2Pdb converter path is : $pdbConverter"
return $pdbConverter

}

function ConvertPortablePdbToWindowsPdb
{
foreach($TF_PortablePdb in $TF_PortablePdbs)
{
$portablePdbs += Join-Path -path $TF_OUT_DIR\$Configuration -childPath $TF_PortablePdb
}

$pdbConverter = Locate-PdbConverterTool

foreach($portablePdb in $portablePdbs)
{
# First check if corresponding dll exists
$dllOrExePath = $portablePdb -replace ".pdb",".dll"

if(!(Test-Path -path $dllOrExePath))
{
# If no corresponding dll found, check if exe exists
$dllOrExePath = $portablePdb -replace ".pdb",".exe"

if(!(Test-Path -path $dllOrExePath))
{
throw "Unable to locate dll/exe corresponding to $portablePdb"
}
}

$fullpdb = $portablePdb -replace ".pdb",".pdbfull"

Write-Verbose "$pdbConverter $dll /pdb $portablePdb /out $fullpdb"
& $pdbConverter $dllOrExePath /pdb $portablePdb /out $fullpdb
}
}

Write-Verbose "Converting Portable pdbs to Windows(Full) Pdbs..."
ConvertPortablePdbToWindowsPdb

1 change: 1 addition & 0 deletions scripts/toolset/packages.config
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,5 @@
<package id="fmdev.xlftool" version="0.1.3" />
<package id="MSTest.Internal.TestFx.Localized.Documentation" version="1.0.0-build-20170420-1" />
<package id="vswhere" version="2.0.2" />
<package id="Pdb2Pdb" version="1.1.0-beta1-62316-01" />
</packages>
Original file line number Diff line number Diff line change
Expand Up @@ -148,14 +148,12 @@ public void RunTestsForMultipleTestShouldSendMultipleResults()

List<string> expectedTestCaseStartList = new List<string>() { "PassingTest", "FailingTest" };
List<string> expectedTestCaseEndList = new List<string>() { "PassingTest:Passed", "FailingTest:Failed" };
List<string> expectedResultList = new List<string>() { "PassingTest Passed", "FailingTest Failed\r\n Message: (null)" };
List<string> expectedResultList = new List<string>() { "PassingTest Passed", "FailingTest Failed\r\n Message: Assert.Fail failed." };

CollectionAssert.AreEqual(expectedTestCaseStartList, this.frameworkHandle.TestCaseStartList);
CollectionAssert.AreEqual(expectedTestCaseEndList, this.frameworkHandle.TestCaseEndList);
Assert.AreEqual("PassingTest Passed", this.frameworkHandle.ResultsList[0]);
StringAssert.Contains(
this.frameworkHandle.ResultsList[1],
"FailingTest Failed\r\n Message: Assert.Fail failed. \r\n StackTrace:\r\n at Microsoft.VisualStudio.TestPlatform.MSTestAdapter.UnitTests.Execution.TestExecutionManagerTests.DummyTestClass.FailingTest()");
Assert.AreEqual(expectedResultList[0], this.frameworkHandle.ResultsList[0]);
StringAssert.Contains(this.frameworkHandle.ResultsList[1], expectedResultList[1]);
}

[TestMethodV1]
Expand Down

0 comments on commit 83c5981

Please sign in to comment.