diff --git a/build.proj b/build.proj index b8ac7d44ed..c13b40e246 100644 --- a/build.proj +++ b/build.proj @@ -259,6 +259,20 @@ -p:SigningKeyPath="$(SigningKeyPath)" + + + + -p:TestSigningKeyPath="$(TestSigningKeyPath)" + + - SqlClientUnit-$(OS) $(LogFilePrefix)-$(TestFramework) @@ -692,6 +702,10 @@ $(TestCodeCoverageArgument) $(TestFiltersArgument) $(TestFrameworkArgument) + $(ReferenceTypeArgument) + $(TestSigningKeyPathArgument) + $(PackageVersionSqlClientArgument) + $(PackageVersionSqlServerArgument) --results-directory "$(TestResultsFolderPath)" --logger:"trx;LogFilePrefix=$(LogFilePrefix)" @@ -862,7 +876,7 @@ AbstractionsTests-$(OS) $(LogFilePrefix)-$(TestFramework) diff --git a/eng/pipelines/common/templates/steps/run-all-tests-step.yml b/eng/pipelines/common/templates/steps/run-all-tests-step.yml index 5730b8cc0d..e41c7d22b2 100644 --- a/eng/pipelines/common/templates/steps/run-all-tests-step.yml +++ b/eng/pipelines/common/templates/steps/run-all-tests-step.yml @@ -79,51 +79,62 @@ steps: condition: succeededOrFailed() - ${{if eq(parameters.operatingSystem, 'Windows')}}: - - ${{if eq(parameters.referenceType, 'Project')}}: - - task: DotNetCoreCLI@2 - displayName: 'Run Unit Tests ${{parameters.msbuildArchitecture }}' - condition: and(eq(variables['setupSucceeded'], 'true'), succeededOrFailed()) - inputs: - command: build - projects: build.proj - ${{ if eq(parameters.msbuildArchitecture, 'x64') }}: - arguments: >- - -t:TestSqlClientUnit - -p:TestFramework=${{ parameters.targetFramework }} - -p:Configuration=${{ parameters.buildConfiguration }} - -p:TestResultsFolderPath=TestResults - ${{ else }}: # x86 - arguments: >- - -t:TestSqlClientUnit - -p:TestFramework=${{ parameters.targetFramework }} - -p:Configuration=${{ parameters.buildConfiguration }} - -p:DotnetPath=${{ parameters.dotnetx86RootPath }} - -p:TestResultsFolderPath=TestResults + - task: DotNetCoreCLI@2 + displayName: 'Run Unit Tests ${{parameters.msbuildArchitecture }}' + condition: and(eq(variables['setupSucceeded'], 'true'), succeededOrFailed()) + inputs: + command: build + projects: build.proj + ${{ if eq(parameters.msbuildArchitecture, 'x64') }}: + arguments: >- + -t:TestSqlClientUnit + -p:TestFramework=${{ parameters.targetFramework }} + -p:ReferenceType=${{ parameters.referenceType }} + -p:Configuration=${{ parameters.buildConfiguration }} + -p:PackageVersionSqlClient=${{ parameters.mdsPackageVersion }} + -p:PackageVersionSqlServer=${{ parameters.sqlServerPackageVersion }} + -p:TestResultsFolderPath=TestResults + ${{ else }}: # x86 + arguments: >- + -t:TestSqlClientUnit + -p:TestFramework=${{ parameters.targetFramework }} + -p:ReferenceType=${{ parameters.referenceType }} + -p:Configuration=${{ parameters.buildConfiguration }} + -p:PackageVersionSqlClient=${{ parameters.mdsPackageVersion }} + -p:PackageVersionSqlServer=${{ parameters.sqlServerPackageVersion }} + -p:DotnetPath=${{ parameters.dotnetx86RootPath }} + -p:TestResultsFolderPath=TestResults - - task: DotNetCoreCLI@2 - displayName: 'Run Flaky Unit Tests ${{parameters.msbuildArchitecture }}' - condition: and(eq(variables['setupSucceeded'], 'true'), succeededOrFailed()) - inputs: - command: build - projects: build.proj - ${{ if eq(parameters.msbuildArchitecture, 'x64') }}: - arguments: >- - -t:TestSqlClientUnit - -p:TestFramework=${{ parameters.targetFramework }} - -p:Configuration=${{ parameters.buildConfiguration }} - -p:TestFilters="category=flaky" - -p:TestResultsFolderPath=TestResults - -p:TestCodeCoverage=false - ${{ else }}: # x86 - arguments: >- - -t:TestSqlClientUnit - -p:TestFramework=${{ parameters.targetFramework }} - -p:Configuration=${{ parameters.buildConfiguration }} - -p:DotnetPath=${{ parameters.dotnetx86RootPath }} - -p:TestFilters="category=flaky" - -p:TestResultsFolderPath=TestResults - -p:TestCodeCoverage=false - continueOnError: true + - task: DotNetCoreCLI@2 + displayName: 'Run Flaky Unit Tests ${{parameters.msbuildArchitecture }}' + condition: and(eq(variables['setupSucceeded'], 'true'), succeededOrFailed()) + inputs: + command: build + projects: build.proj + ${{ if eq(parameters.msbuildArchitecture, 'x64') }}: + arguments: >- + -t:TestSqlClientUnit + -p:TestFramework=${{ parameters.targetFramework }} + -p:ReferenceType=${{ parameters.referenceType }} + -p:Configuration=${{ parameters.buildConfiguration }} + -p:PackageVersionSqlClient=${{ parameters.mdsPackageVersion }} + -p:PackageVersionSqlServer=${{ parameters.sqlServerPackageVersion }} + -p:TestFilters="category=flaky" + -p:TestResultsFolderPath=TestResults + -p:TestCodeCoverage=false + ${{ else }}: # x86 + arguments: >- + -t:TestSqlClientUnit + -p:TestFramework=${{ parameters.targetFramework }} + -p:ReferenceType=${{ parameters.referenceType }} + -p:Configuration=${{ parameters.buildConfiguration }} + -p:PackageVersionSqlClient=${{ parameters.mdsPackageVersion }} + -p:PackageVersionSqlServer=${{ parameters.sqlServerPackageVersion }} + -p:DotnetPath=${{ parameters.dotnetx86RootPath }} + -p:TestFilters="category=flaky" + -p:TestResultsFolderPath=TestResults + -p:TestCodeCoverage=false + continueOnError: true - task: DotNetCoreCLI@2 displayName: 'Run Functional Tests ${{parameters.msbuildArchitecture }}' @@ -261,33 +272,38 @@ steps: continueOnError: true - ${{ else }}: # Linux or macOS - - ${{if eq(parameters.referenceType, 'Project')}}: - - task: DotNetCoreCLI@2 - displayName: 'Run Unit Tests' - condition: and(eq(variables['setupSucceeded'], 'true'), succeededOrFailed()) - inputs: - command: build - projects: build.proj - arguments: >- - -t:TestSqlClientUnit - -p:TestFramework=${{ parameters.targetFramework }} - -p:Configuration=${{ parameters.buildConfiguration }} - -p:TestResultsFolderPath=TestResults + - task: DotNetCoreCLI@2 + displayName: 'Run Unit Tests' + condition: and(eq(variables['setupSucceeded'], 'true'), succeededOrFailed()) + inputs: + command: build + projects: build.proj + arguments: >- + -t:TestSqlClientUnit + -p:TestFramework=${{ parameters.targetFramework }} + -p:ReferenceType=${{ parameters.referenceType }} + -p:Configuration=${{ parameters.buildConfiguration }} + -p:PackageVersionSqlClient=${{ parameters.mdsPackageVersion }} + -p:PackageVersionSqlServer=${{ parameters.sqlServerPackageVersion }} + -p:TestResultsFolderPath=TestResults - - task: DotNetCoreCLI@2 - displayName: 'Run Flaky Unit Tests' - condition: and(eq(variables['setupSucceeded'], 'true'), succeededOrFailed()) - inputs: - command: build - projects: build.proj - arguments: >- - -t:TestSqlClientUnit - -p:TestFramework=${{ parameters.targetFramework }} - -p:Configuration=${{ parameters.buildConfiguration }} - -p:TestFilters="category=flaky" - -p:TestResultsFolderPath=TestResults - -p:TestCodeCoverage=false - continueOnError: true + - task: DotNetCoreCLI@2 + displayName: 'Run Flaky Unit Tests' + condition: and(eq(variables['setupSucceeded'], 'true'), succeededOrFailed()) + inputs: + command: build + projects: build.proj + arguments: >- + -t:TestSqlClientUnit + -p:TestFramework=${{ parameters.targetFramework }} + -p:ReferenceType=${{ parameters.referenceType }} + -p:Configuration=${{ parameters.buildConfiguration }} + -p:PackageVersionSqlClient=${{ parameters.mdsPackageVersion }} + -p:PackageVersionSqlServer=${{ parameters.sqlServerPackageVersion }} + -p:TestFilters="category=flaky" + -p:TestResultsFolderPath=TestResults + -p:TestCodeCoverage=false + continueOnError: true - task: DotNetCoreCLI@2 displayName: 'Run Functional Tests' diff --git a/src/Microsoft.Data.SqlClient/src/Microsoft.Data.SqlClient.csproj b/src/Microsoft.Data.SqlClient/src/Microsoft.Data.SqlClient.csproj index d7a7ef060a..24c6a548f9 100644 --- a/src/Microsoft.Data.SqlClient/src/Microsoft.Data.SqlClient.csproj +++ b/src/Microsoft.Data.SqlClient/src/Microsoft.Data.SqlClient.csproj @@ -62,13 +62,26 @@ - + + <_Parameter1>UnitTests + + + + <_Parameter1>UnitTests, PublicKey=00240000048000001401000006020000002400005253413100080000010001003D19684676DA365F331D00CE7BD4B8EF03E74102F39A5681B40622703D68F0298ECACECC723D3FFC1EA9365AF4958578550EA1EBEEC084B0B3757F3762449F5365E872802A4B548056760764FAD062BFEE81ED26183109AD46810E7E6E965419D0A10473680144D20C1BFE1027A5F586CA987523C06F5C126C44EA7D4F51EB023867A9F294315F95775ACEFD2D678186919458DFCCB4DE2E9F53AEFC766C7CBCEC474ED21C1616E5A9414D366D91D121C39F5FE6641295ADC058EF3FB10593BCDE2E82D9F217C2634909EEF496CD53AE78ABBEA572B871D72EBFC5378205950ABA97C7CCC2B9635D96933D5F9C9624D71FF53EE2094CF3A6BD38534D66E414B7 + + + $(RepoRoot)artifacts/ diff --git a/src/Microsoft.Data.SqlClient/tests/Common/Microsoft.Data.SqlClient.TestCommon.csproj b/src/Microsoft.Data.SqlClient/tests/Common/Microsoft.Data.SqlClient.TestCommon.csproj index 71e4f305e1..548dd641f6 100644 --- a/src/Microsoft.Data.SqlClient/tests/Common/Microsoft.Data.SqlClient.TestCommon.csproj +++ b/src/Microsoft.Data.SqlClient/tests/Common/Microsoft.Data.SqlClient.TestCommon.csproj @@ -12,6 +12,13 @@ false + + + + true + $(TestSigningKeyPath) + + net8.0;net9.0;net10.0 @@ -26,7 +33,10 @@ - + + diff --git a/src/Microsoft.Data.SqlClient/tests/UnitTests/Microsoft.Data.SqlClient.UnitTests.csproj b/src/Microsoft.Data.SqlClient/tests/UnitTests/Microsoft.Data.SqlClient.UnitTests.csproj index 82e900e54c..4501d710a9 100644 --- a/src/Microsoft.Data.SqlClient/tests/UnitTests/Microsoft.Data.SqlClient.UnitTests.csproj +++ b/src/Microsoft.Data.SqlClient/tests/UnitTests/Microsoft.Data.SqlClient.UnitTests.csproj @@ -36,22 +36,53 @@ + + + + true + $(TestSigningKeyPath) + + - - + - - - + + + <_SqlClientRid Condition="'$(OS)' != 'Windows_NT'">unix + <_SqlClientRid Condition="'$(OS)' == 'Windows_NT'">win + + <_SqlClientPackageTfm Condition="'$(TargetFramework)' == 'net8.0'">net8.0 + <_SqlClientPackageTfm Condition="'$(TargetFramework)' == 'net462'">net462 + <_SqlClientPackageTfm Condition="'$(_SqlClientPackageTfm)' == ''">net9.0 + + + + + + + + diff --git a/src/Microsoft.Data.SqlClient/tests/tools/Microsoft.Data.SqlClient.TestUtilities/Microsoft.Data.SqlClient.TestUtilities.csproj b/src/Microsoft.Data.SqlClient/tests/tools/Microsoft.Data.SqlClient.TestUtilities/Microsoft.Data.SqlClient.TestUtilities.csproj index 083cca8a61..c50a251e4f 100644 --- a/src/Microsoft.Data.SqlClient/tests/tools/Microsoft.Data.SqlClient.TestUtilities/Microsoft.Data.SqlClient.TestUtilities.csproj +++ b/src/Microsoft.Data.SqlClient/tests/tools/Microsoft.Data.SqlClient.TestUtilities/Microsoft.Data.SqlClient.TestUtilities.csproj @@ -2,6 +2,14 @@ netstandard2.0 + + + + + true + $(TestSigningKeyPath) + + diff --git a/src/Microsoft.Data.SqlClient/tests/tools/TDS/TDS.EndPoint/TDS.EndPoint.csproj b/src/Microsoft.Data.SqlClient/tests/tools/TDS/TDS.EndPoint/TDS.EndPoint.csproj index 2e1a1b5c81..c9dce97ddb 100644 --- a/src/Microsoft.Data.SqlClient/tests/tools/TDS/TDS.EndPoint/TDS.EndPoint.csproj +++ b/src/Microsoft.Data.SqlClient/tests/tools/TDS/TDS.EndPoint/TDS.EndPoint.csproj @@ -3,6 +3,15 @@ Microsoft.SqlServer.TDS.EndPoint Microsoft.SqlServer.TDS.EndPoint netstandard2.0 + + + + + true + $(TestSigningKeyPath) + + + false diff --git a/src/Microsoft.Data.SqlClient/tests/tools/TDS/TDS.Servers/TDS.Servers.csproj b/src/Microsoft.Data.SqlClient/tests/tools/TDS/TDS.Servers/TDS.Servers.csproj index 57d3dfadd2..b6f33b0977 100644 --- a/src/Microsoft.Data.SqlClient/tests/tools/TDS/TDS.Servers/TDS.Servers.csproj +++ b/src/Microsoft.Data.SqlClient/tests/tools/TDS/TDS.Servers/TDS.Servers.csproj @@ -4,6 +4,12 @@ Microsoft.SqlServer.TDS.Servers netstandard2.0 + + + + true + $(TestSigningKeyPath) + diff --git a/src/Microsoft.Data.SqlClient/tests/tools/TDS/TDS/TDS.csproj b/src/Microsoft.Data.SqlClient/tests/tools/TDS/TDS/TDS.csproj index a4da7c8b92..39d5aae2de 100644 --- a/src/Microsoft.Data.SqlClient/tests/tools/TDS/TDS/TDS.csproj +++ b/src/Microsoft.Data.SqlClient/tests/tools/TDS/TDS/TDS.csproj @@ -4,4 +4,10 @@ Microsoft.SqlServer.TDS netstandard2.0 + + + + true + $(TestSigningKeyPath) +