Skip to content
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

Reformat projects and script files #3290

Merged
merged 3 commits into from
Jan 31, 2022
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
1 change: 0 additions & 1 deletion TestPlatform.sln
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,6 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "scripts", "scripts", "{EE49
scripts\build.ps1 = scripts\build.ps1
scripts\build.sh = scripts\build.sh
scripts\PortableToFullPdb.ps1 = scripts\PortableToFullPdb.ps1
scripts\stylecop.json = scripts\stylecop.json
scripts\stylecop.ruleset = scripts\stylecop.ruleset
scripts\stylecop.test.ruleset = scripts\stylecop.test.ruleset
scripts\test.ps1 = scripts\test.ps1
Expand Down
6 changes: 3 additions & 3 deletions azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ jobs:
displayName: 'Run script build.cmd'
inputs:
filename: build.cmd
# build should not be needed in the end, we are copying the build task from the build folder, but we should get
# build should not be needed in the end, we are copying the build task from the build folder, but we should get
# it either from artifacts, if present, or from extracted package file
# Adding it at the moment to avoid this error: #[error]Copy-Item : Cannot find path 'D:\a\1\s\src\Microsoft.TestPlatform.Build\bin\Release\netstandard2.0' because it does not exist.
arguments: '-verbose -configuration $(buildConfiguration) -steps "InstallDotnet, Restore, Build, PrepareAcceptanceTests"'
Expand Down Expand Up @@ -142,7 +142,7 @@ jobs:
buildConfiguration: 'Release'
VSTestRTMBuild: 'false'
steps:
- script: chmod +x ./scripts/vsts-prebuild.sh
- script: chmod +x ./scripts/vsts-prebuild.sh
displayName: 'Preparing for set version'

- script: ./scripts/vsts-prebuild.sh -build "preview-$(Build.BuildNumber)" -rtm "$(VSTestRTMBuild)" -branch "$(Build.SourceBranch)"
Expand All @@ -152,7 +152,7 @@ jobs:
displayName: 'Build'

- script: ./test.sh -c $(buildConfiguration) -p Unit
displayName: 'Unit tests'
displayName: 'Unit tests'

- task: DownloadPipelineArtifact@2
inputs:
Expand Down
2 changes: 1 addition & 1 deletion playground/MSTest1/MSTest1.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<TargetLatestRuntimePatch>true</TargetLatestRuntimePatch>
</PropertyGroup>
<Import Project="$(TestPlatformRoot)scripts/build/TestPlatform.Settings.targets" />

<PropertyGroup>
<TargetFrameworks Condition=" '$(OS)' == 'WINDOWS_NT' ">$(TargetFrameworks);net472</TargetFrameworks>
<!-- We build this on linux as well, and are including ref assemblies for this framework only. -->
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<Project Sdk="Microsoft.NET.Sdk">
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TestPlatformRoot Condition="$(TestPlatformRoot) == ''">..\..\</TestPlatformRoot>
<TargetLatestRuntimePatch>true</TargetLatestRuntimePatch>
Expand Down
50 changes: 25 additions & 25 deletions scripts/PortableToFullPdb.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -32,45 +32,45 @@ function Locate-PdbConverterTool
}

function ConvertPortablePdbToWindowsPdb
{
{
$allPdbs = Get-ChildItem -path $TP_OUT_DIR\$Configuration *.pdb -Recurse | % {$_.FullName}
$portablePdbs = New-Object System.Collections.Generic.List[System.Object]

foreach($pdb in $allPdbs)
{
# First four bytes should be 'BSJB' for portable pdb
$bytes = [char[]](Get-Content $pdb -Encoding byte -TotalCount 4) -join ''
if( $bytes -eq "BSJB")
{
$portablePdbs.Add($pdb)
}
# First four bytes should be 'BSJB' for portable pdb
nohwnd marked this conversation as resolved.
Show resolved Hide resolved
$bytes = [char[]](Get-Content $pdb -Encoding byte -TotalCount 4) -join ''

if( $bytes -eq "BSJB")
{
$portablePdbs.Add($pdb)
}
}

$pdbConverter = Locate-PdbConverterTool

foreach($portablePdb in $portablePdbs)
{
# First check if corresponding dll exists
# 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"
}
}

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

Remove-Item -Path $portablePdb
Remove-Item -Path $portablePdb
}
}

Expand Down
136 changes: 68 additions & 68 deletions scripts/build.ps1

Large diffs are not rendered by default.

24 changes: 12 additions & 12 deletions scripts/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ function ReadGlobalVersion {
#
# Dotnet configuration
#
# Disable first run since we want to control all package sources
# Disable first run since we want to control all package sources
export DOTNET_SKIP_FIRST_TIME_EXPERIENCE=1
# Dotnet build doesnt support --packages yet. See https://github.com/dotnet/cli/issues/2712
export NUGET_PACKAGES=$TP_PACKAGES_DIR
Expand Down Expand Up @@ -266,7 +266,7 @@ function invoke_build()
log "invoke_build: Start build."
local start=$SECONDS
log ".. .. Build: Source: $TPB_Solution"

# Workaround for https://github.com/dotnet/sdk/issues/335
export FrameworkPathOverride=$TP_PACKAGES_DIR/microsoft.targetingpack.netframework.v4.7.2/1.0.0/lib/net472/
if [ -z "$PROJECT_NAME_PATTERNS" ]
Expand Down Expand Up @@ -296,7 +296,7 @@ function publish_package()

log "publish_package: Started."
local start=$SECONDS

local packageDir=$TP_OUT_DIR/$TPB_Configuration/$TPB_TargetFramework/$TPB_TargetRuntime
local coreCLRPackageDir=$TP_OUT_DIR/$TPB_Configuration/$TPB_TargetFrameworkCore
local frameworkPackageDirMap=( \
Expand Down Expand Up @@ -360,13 +360,13 @@ function publish_package()
mkdir -p $extensionsDir

#*************************************************************************************************************#
# Note Note: If there are some dependencies for the logger assemblies, those need to be moved too.
# Note Note: If there are some dependencies for the logger assemblies, those need to be moved too.
# Ideally we should just be publishing the loggers to the Extensions folder.
loggers=( \
"Microsoft.TestPlatform.Extensions.TrxLogger/bin/$TPB_Configuration/$current_tfn/Microsoft.VisualStudio.TestPlatform.Extensions.Trx.TestLogger.dll" \
"Microsoft.TestPlatform.Extensions.TrxLogger/bin/$TPB_Configuration/$current_tfn/Microsoft.VisualStudio.TestPlatform.Extensions.Trx.TestLogger.pdb" \
"Microsoft.TestPlatform.Extensions.HtmlLogger/bin/$TPB_Configuration/$current_tfn/Microsoft.VisualStudio.TestPlatform.Extensions.Html.TestLogger.dll" \
"Microsoft.TestPlatform.Extensions.HtmlLogger/bin/$TPB_Configuration/$current_tfn/Microsoft.VisualStudio.TestPlatform.Extensions.Html.TestLogger.pdb"
"Microsoft.TestPlatform.Extensions.HtmlLogger/bin/$TPB_Configuration/$current_tfn/Microsoft.VisualStudio.TestPlatform.Extensions.Html.TestLogger.pdb"
)

for i in ${loggers[@]}; do
Expand All @@ -388,7 +388,7 @@ function publish_package()
"DataCollectors/Microsoft.TestPlatform.Extensions.EventLogCollector/bin/$TPB_Configuration/$current_tfn/Microsoft.TestPlatform.Extensions.EventLogCollector.dll" \
"DataCollectors/Microsoft.TestPlatform.Extensions.EventLogCollector/bin/$TPB_Configuration/$current_tfn/Microsoft.TestPlatform.Extensions.EventLogCollector.pdb"
)

for i in ${blame[@]}; do
if [[ $TP_USE_REPO_API = 1 ]]; then
log ".. Package: ${i} (Source Build)"
Expand All @@ -399,14 +399,14 @@ function publish_package()
done
# TODO: move loc files too
#*************************************************************************************************************#

#*************************************************************************************************************#
# Note Note: If there are some dependencies for the TestHostRuntimeProvider assemblies, those need to be moved too.
runtimeproviders=( \
"Microsoft.TestPlatform.TestHostProvider/bin/$TPB_Configuration/$current_tfn/Microsoft.TestPlatform.TestHostRuntimeProvider.dll" \
"Microsoft.TestPlatform.TestHostProvider/bin/$TPB_Configuration/$current_tfn/Microsoft.TestPlatform.TestHostRuntimeProvider.pdb"
)

for i in ${runtimeproviders[@]}; do
if [[ $TP_USE_REPO_API = 1 ]]; then
log ".. Package: ${i} (Source Build)"
Expand All @@ -424,7 +424,7 @@ function publish_package()
# "microsoft.internal.dia.interop/$TPB_EXTERNALS_VERSION/tools/net451" \ # no linux support (cp to $testhost)
"microsoft.visualstudio.coverage.io/$TPB_CC_EXTERNALS_VERSION/lib/netstandard2.0/"
)

for i in ${externals[@]}; do
if [[ $TP_USE_REPO_API = 1 ]]; then
log ".. Package: ${i} (Source Build)"
Expand All @@ -450,9 +450,9 @@ function publish_package()
#
assemblies=( \
"Microsoft.TestPlatform.PlatformAbstractions/bin/$TPB_Configuration/$current_tfn" \
"Microsoft.TestPlatform.ObjectModel/bin/$TPB_Configuration/$current_tfn"
"Microsoft.TestPlatform.ObjectModel/bin/$TPB_Configuration/$current_tfn"
)

for i in ${assemblies[@]}; do
if [[ $TP_USE_REPO_API = 1 ]]; then
log ".. Package: ${i} (Source Build)"
Expand All @@ -463,7 +463,7 @@ function publish_package()
done
# TODO: move loc files too
#*************************************************************************************************************#

log "publish_package: Complete. Elapsed $(( SECONDS - start ))s."
}

Expand Down
14 changes: 7 additions & 7 deletions scripts/build/TestPlatform.Dependencies.props
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@

<!-- Name of the elements must be in sync with test\Microsoft.TestPlatform.TestUtilities\IntegrationTestBase.cs -->

<!-- this version needs to be the same as in TestPlatform.Settings.targets, we might want to unify this into
a single .props file, but the other version is used by multiple build scripts, so I just query it and validate that
<!-- this version needs to be the same as in TestPlatform.Settings.targets, we might want to unify this into
a single .props file, but the other version is used by multiple build scripts, so I just query it and validate that
they are both the same during build -->
<!-- this version also needs to be "statically" readable because the test fixture will inspect this file for the version
and because during the test `dotnet test` will run and re-build some of the test projects and at that time the version
from a build parameter would not be available, so I am writing this version from the build.ps1 script to keep it in sync -->
<!-- this version also needs to be "statically" readable because the test fixture will inspect this file for the version
and because during the test `dotnet test` will run and re-build some of the test projects and at that time the version
from a build parameter would not be available, so I am writing this version from the build.ps1 script to keep it in sync -->
<NETTestSdkVersion>17.2.0-dev</NETTestSdkVersion>

<MSTestFrameworkVersion>2.1.0</MSTestFrameworkVersion>
Expand All @@ -37,14 +37,14 @@
<TestPlatformMSDiaVersion>17.1.0-preview-2-31925-026</TestPlatformMSDiaVersion>
<!-- Portable CPP test runner -->
<TestPlatformRemoteExternalsVersion>17.1.0-preview-2-31925-026</TestPlatformRemoteExternalsVersion>

<InteropExternalsVersion>17.1.0-preview-2-31925-026</InteropExternalsVersion>
<MicrosoftFakesVersion>17.0.0-beta.21179.1</MicrosoftFakesVersion>

<MicrosoftBuildPackageVersion>16.0.461</MicrosoftBuildPackageVersion>
<MicrosoftBuildFrameworkPackageVersion>$(MicrosoftBuildPackageVersion)</MicrosoftBuildFrameworkPackageVersion>
<MicrosoftBuildUtilitiesCorePackageVersion>$(MicrosoftBuildPackageVersion)</MicrosoftBuildUtilitiesCorePackageVersion>

<MicrosoftExtensionsDependencyModelPackageVersion>3.0.0-preview4-27615-11</MicrosoftExtensionsDependencyModelPackageVersion>
<MicrosoftExtensionsFileSystemGlobbingPackageVersion>1.1.1</MicrosoftExtensionsFileSystemGlobbingPackageVersion>

Expand Down
2 changes: 1 addition & 1 deletion scripts/build/TestPlatform.targets
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,5 @@
<NoWarn>$(NoWarn);CA1416</NoWarn>
</PropertyGroup>

<Import Project="$(MSBuildThisFileDirectory)TestPlatform.Localization.targets" />
<Import Project="$(MSBuildThisFileDirectory)TestPlatform.Localization.targets" />
</Project>
22 changes: 11 additions & 11 deletions scripts/perf/perf.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -273,14 +273,14 @@ function Invoke-PerformanceTests
$testContainerPath = Join-Path $testOutputPath "$($testContainerName).dll"
foreach($fx in $Script:TPT_TargetFrameworks)
{
if ($Script:TPT_TargetFramework -ne "" -and $fx -ne $Script:TPT_TargetFramework)
if ($Script:TPT_TargetFramework -ne "" -and $fx -ne $Script:TPT_TargetFramework)
{
# Write-Log "Skipped framework $fx based on user setting."
continue;
}

$testContainer = [System.String]::Format($testContainerPath, $fx)

if (Test-Path $testContainer)
{
$adapter = $payload.adapter
Expand All @@ -302,12 +302,12 @@ function Invoke-PerformanceTests
$payload | Add-Member currentRunner $runner -Force
$payload | Add-Member currentAdapter $null -Force
$payload | Add-Member currentAdapterVersion $null -Force

if($runner -eq "vstest.console")
{
$payload | Add-Member currentRunnerVersion (Get-ProductVersion($runnerPath)) -Force
$payload.currentAdapter = $adapter

Measure-DiscoveryTime {&$runnerPath $testContainer --listtests --testadapterpath:$testAdapterPath} $payload
Measure-ExecutionTime {&$runnerPath $testContainer --testadapterpath:$testAdapterPath} $payload
}
Expand All @@ -328,7 +328,7 @@ function Invoke-PerformanceTests
Write-Log "Specified runner $runner doesn't exist at $runnerPath"
}
}

}
else
{
Expand Down Expand Up @@ -358,19 +358,19 @@ function Invoke-DisplayResults
"`n"
"Machine Configuration"
$osDetails | Format-List 'MachineName', 'OSName', 'OSVersion', 'MachineType' , 'Processor', 'LogicalCores', 'RAMSize'

if($DefaultAction -eq "Both" -or $DefaultAction -eq "Discovery")
{
$Script:TPT_Results | Where-Object {$_.Action -like "Discovery"} | Format-Table 'Runner', 'Adapter', 'Action', 'ElapsedTime', 'Goal', 'Delta', 'Status', 'PayLoad', 'RunnerVersion', 'AdapterVersion' -AutoSize
}

if($DefaultAction -eq "Both" -or $DefaultAction -eq "Execution")
{
$Script:TPT_Results | Where-Object {$_.Action -like "Execution"} | Format-Table 'Runner', 'Adapter', 'Action', 'ElapsedTime', 'Goal', 'Delta', 'Status', 'PayLoad', 'RunnerVersion', 'AdapterVersion' -AutoSize
}

$Host.UI.RawUI.ForegroundColor = $currentColor

if($ExportResults -ne $null -and $ExportResults -eq "csv")
{
$Script:TPT_Results | Export-Csv -Path "PerformanceResults.csv" -Force -NoTypeInformation
Expand All @@ -389,4 +389,4 @@ else
}

Invoke-PerformanceTests
Invoke-DisplayResults
Invoke-DisplayResults
12 changes: 6 additions & 6 deletions scripts/test.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ Param(
[System.String] $TargetFramework,

# Only test sources matching the pattern are run.
# Use End2End to run E2E tests. Or to run any one assembly tests, use the
# assembly name. E.g. test -p Microsoft.TestPlatform.CoreUtilities.UnitTests
# Use End2End to run E2E tests. Or to run any one assembly tests, use the
# assembly name. E.g. test -p Microsoft.TestPlatform.CoreUtilities.UnitTests
[Parameter(Mandatory=$false)]
[Alias("p")]
[System.String] $Pattern = "Unit",
Expand Down Expand Up @@ -71,8 +71,8 @@ ${env:DOTNET_ROOT(x86)} = "${env:DOTNET_ROOT}_x86"
# disable looking up other dotnets in programfiles
$env:DOTNET_MULTILEVEL_LOOKUP = 0

# Disable first run since we want to control all package sources
$env:DOTNET_SKIP_FIRST_TIME_EXPERIENCE = 1
# Disable first run since we want to control all package sources
$env:DOTNET_SKIP_FIRST_TIME_EXPERIENCE = 1

# list what we have set and what is available
"---- dotnet environment variables"
Expand Down Expand Up @@ -185,7 +185,7 @@ function Invoke-Test
$testContainerName = $_.BaseName
$testOutputPath = Join-Path $_.Directory.FullName "bin/$($Script:TPT_Configuration)/{0}"
$testContainerPath = Join-Path $testOutputPath "$($testContainerName).dll"

$skip = "False"

foreach ($project in $Script:TPT_SkipProjects)
Expand Down Expand Up @@ -265,7 +265,7 @@ function Invoke-Test
{
Remove-Item $fullTrxFilePath
}

Set-TestEnvironment
if($fx -eq $TPT_TargetFrameworkFullCLR)
{
Expand Down
2 changes: 1 addition & 1 deletion scripts/test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ TP_OUT_DIR="$TP_ROOT_DIR/artifacts"
#
# Dotnet configuration
#
# Disable first run since we want to control all package sources
# Disable first run since we want to control all package sources
export DOTNET_SKIP_FIRST_TIME_EXPERIENCE=1
# Dotnet build doesnt support --packages yet. See https://github.com/dotnet/cli/issues/2712
export NUGET_PACKAGES=$TP_PACKAGES_DIR
Expand Down
2 changes: 1 addition & 1 deletion scripts/verify-nupkgs.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -60,4 +60,4 @@ function Verify-Nuget-Packages($packageDirectory, $version)
}

Write-Log "Completed Verify-Nuget-Packages."
}
}
Loading