Skip to content

Commit d948cd4

Browse files
authored
Common Project | Functional Tests (dotnet#3890)
* Get project building under common project * Cleanup the rest of the functional test project * Fix reflection issue in SslOverTdsStreamTest * build.proj * Add TDS projects as dependencies for ManualTesting * AKV needs to be built in build tests target for non-windows pipeline runs
1 parent 1813106 commit d948cd4

4 files changed

Lines changed: 106 additions & 172 deletions

File tree

build.proj

Lines changed: 13 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -70,13 +70,6 @@
7070
<UnitTests Include="**/UnitTests/Microsoft.Data.SqlClient.UnitTests.csproj" />
7171
<UnitTestsProj Include="**/UnitTests/Microsoft.Data.SqlClient.UnitTests.csproj" />
7272

73-
<FunctionalTests Include="**/Common/Common.csproj" />
74-
<FunctionalTests Include="**/tools/TDS/TDS/TDS.csproj" />
75-
<FunctionalTests Include="**/tools/TDS/TDS.EndPoint/TDS.EndPoint.csproj" />
76-
<FunctionalTests Include="**/tools/TDS/TDS.Servers/TDS.Servers.csproj" />
77-
<FunctionalTests Include="**/tools/Microsoft.Data.SqlClient.TestUtilities/Microsoft.Data.SqlClient.TestUtilities.csproj" />
78-
<FunctionalTests Include="**/tools/CoreFx.Private.TestUtilities/CoreFx.Private.TestUtilities.csproj" />
79-
<FunctionalTests Include="**/ManualTests/SQL/UdtTest/UDTs/Address/Address.csproj" />
8073
<FunctionalTests Include="**/FunctionalTests/Microsoft.Data.SqlClient.FunctionalTests.csproj" />
8174
<FunctionalTestsProj Include="**/FunctionalTests/Microsoft.Data.SqlClient.FunctionalTests.csproj" />
8275

@@ -87,6 +80,9 @@
8780
<ManualTests Include="**/ManualTests/SQL/UdtTest/UDTs/Utf8String/Utf8String.csproj" />
8881
<ManualTests Include="**/tools/Microsoft.Data.SqlClient.TestUtilities/Microsoft.Data.SqlClient.TestUtilities.csproj" />
8982
<ManualTests Include="**/tools/CoreFx.Private.TestUtilities/CoreFx.Private.TestUtilities.csproj" />
83+
<ManualTests Include="**/tools/TDS/TDS/TDS.csproj" />
84+
<ManualTests Include="**/tools/TDS/TDS.EndPoint/TDS.EndPoint.csproj" />
85+
<ManualTests Include="**/tools/TDS/TDS.Servers/TDS.Servers.csproj" />
9086
<ManualTests Include="**/CustomConfigurableRetryLogic/CustomRetryLogicProvider.csproj" />
9187
<ManualTests Include="**/ManualTests/Microsoft.Data.SqlClient.ManualTesting.Tests.csproj" />
9288
<ManualTestsProj Include="**/ManualTests/Microsoft.Data.SqlClient.ManualTesting.Tests.csproj" />
@@ -97,8 +93,10 @@
9793
<Target Name="BuildAll" DependsOnTargets="BuildSqlServerLib;BuildNetFx;BuildNetCore;BuildNetStandard" />
9894
<Target Name="BuildAllConfigurations" DependsOnTargets="Restore;BuildTools;BuildSqlServerLib;BuildNetFx;BuildNetCoreAllOS;BuildNetStandard;GenerateNugetPackage" />
9995
<Target Name="BuildSqlServerPackage" DependsOnTargets="BuildSqlServerLibAnyOS;GenerateSqlServerPackage"/>
100-
<Target Name="BuildTestsNetCore" DependsOnTargets="RestoreTestsNetCore;BuildAKVNetCore;BuildFunctionalTestsNetCore;BuildManualTestsNetCore"/>
101-
<Target Name="BuildTestsNetFx" DependsOnTargets="RestoreTestsNetFx;BuildAKVNetFx;BuildFunctionalTestsNetFx;BuildManualTestsNetFx" Condition="$(IsEnabledWindows) == 'true'"/>
96+
97+
<!-- @TODO: Manual tests have a reference to AKV provider, and AKV provider is not built on non-windows pipeline runs. Thus it is added to the dependencies of the build tests target. This is not good since it means AKV is built twice on windows and once on unix, in a mix of implicit and explicit. The pipeline should be modified to build it in both cases, or the build should be updated to have dotnet build the test projects. -->
98+
<Target Name="BuildTestsNetCore" DependsOnTargets="RestoreTestsNetCore;BuildAKVNetCore;BuildManualTestsNetCore"/>
99+
<Target Name="BuildTestsNetFx" DependsOnTargets="RestoreTestsNetFx;BuildAKVNetFx;BuildManualTestsNetFx" Condition="$(IsEnabledWindows) == 'true'"/>
102100

103101
<Target Name="RestoreSqlServerLib">
104102
<MSBuild Projects="@(SqlServerLib)" Targets="restore" />
@@ -110,7 +108,6 @@
110108

111109
<Target Name="RestoreTestsNetCore">
112110
<MSBuild Projects="@(ManualTests)" Targets="restore" Properties="$(TestProjectProperties)" />
113-
<MSBuild Projects="@(FunctionalTests)" Targets="restore" Properties="$(TestProjectProperties)" />
114111
</Target>
115112

116113
<Target Name="RestoreNetFx" Condition="'$(IsEnabledWindows)' == 'true'">
@@ -119,7 +116,6 @@
119116

120117
<Target Name="RestoreTestsNetFx" Condition="'$(IsEnabledWindows)' == 'true'">
121118
<MSBuild Projects="@(ManualTests)" Targets="restore" Properties="$(TestProjectProperties)" />
122-
<MSBuild Projects="@(FunctionalTests)" Targets="restore" Properties="$(TestProjectProperties)" />
123119
</Target>
124120

125121
<Target Name="BuildTools" Condition="'$(BuildTools)' == 'true'">
@@ -167,15 +163,6 @@
167163
<Target Name="BuildNetStandard">
168164
<MSBuild Projects="@(NetStandardDriver)" Properties="$(CI);$(ProjectProperties);Platform=AnyCPU;OSGroup=AnyOS;BuildForLib=True" RemoveProperties="TargetsWindows;TargetsUnix;" />
169165
</Target>
170-
171-
<Target Name="BuildFunctionalTestsNetCore" DependsOnTargets="RestoreTestsNetCore">
172-
<Message Text=">>> Building FunctionalTestsNetCore [TestTargetOS=$(TestOS)netcoreapp;$(TestProjectProperties);Platform=AnyCPU;ReferenceType=$(ReferenceType);] ..." Condition="!$(ReferenceType.Contains('Package'))" />
173-
<MSBuild Projects="@(FunctionalTests)" Properties="TestTargetOS=$(TestOS)netcoreapp;$(TestProjectProperties);Platform=AnyCPU;" Condition="!$(ReferenceType.Contains('Package'))" />
174-
175-
<!-- Only build platform specific builds for Package reference types -->
176-
<Message Text=">>> Building FunctionalTestsNetCore [TestTargetOS=$(TestOS)netcoreapp;$(TestProjectProperties);Platform=$(Platform);ReferenceType=$(ReferenceType);] ..." Condition="$(ReferenceType.Contains('Package'))" />
177-
<MSBuild Projects="@(FunctionalTests)" Properties="TestTargetOS=$(TestOS)netcoreapp;$(TestProjectProperties);Platform=$(Platform);" Condition="$(ReferenceType.Contains('Package'))" />
178-
</Target>
179166

180167
<Target Name="BuildManualTestsNetCore" DependsOnTargets="RestoreTestsNetCore">
181168
<Message Text=">>> Building ManualTestsNetCore [TestTargetOS=$(TestOS)netcoreapp;$(TestProjectProperties);Platform=AnyCPU;ReferenceType=$(ReferenceType);] ..." Condition="!$(ReferenceType.Contains('Package'))" />
@@ -185,15 +172,6 @@
185172
<Message Text=">>> Building ManualTestsNetCore [TestTargetOS=$(TestOS)netcoreapp;$(TestProjectProperties);Platform=$(Platform);ReferenceType=$(ReferenceType);] ..." Condition="$(ReferenceType.Contains('Package'))" />
186173
<MSBuild Projects="@(ManualTests)" Properties="TestTargetOS=$(TestOS)netcoreapp;$(TestProjectProperties);Platform=$(Platform);" Condition="$(ReferenceType.Contains('Package'))" />
187174
</Target>
188-
189-
<Target Name="BuildFunctionalTestsNetFx" DependsOnTargets="RestoreTestsNetFx" Condition="'$(IsEnabledWindows)' == 'true'">
190-
<Message Text=">>> Building FunctionalTestsNetFx [TestTargetOS=$(TestOS)netfx;$(TestProjectProperties);Platform=AnyCPU;] ..." Condition="!$(ReferenceType.Contains('Package'))" />
191-
<MSBuild Projects="@(FunctionalTests)" Properties="TestTargetOS=$(TestOS)netfx;$(TestProjectProperties);Platform=AnyCPU;" Condition="!$(ReferenceType.Contains('Package'))" />
192-
193-
<!-- Only build platform specific builds for Package reference types -->
194-
<Message Text=">>> Building FunctionalTestsNetFx [TestTargetOS=$(TestOS)netfx;$(TestProjectProperties);Platform=$(Platform);] ..." Condition="$(ReferenceType.Contains('Package'))" />
195-
<MSBuild Projects="@(FunctionalTests)" Properties="TestTargetOS=$(TestOS)netfx;$(TestProjectProperties);Platform=$(Platform);" Condition="$(ReferenceType.Contains('Package'))" />
196-
</Target>
197175

198176
<Target Name="BuildManualTestsNetFx" DependsOnTargets="RestoreTestsNetFx" Condition="'$(IsEnabledWindows)' == 'true'">
199177
<Message Text=">>> Building ManualTestsNetFx [TestTargetOS=$(TestOS)netfx;$(TestProjectProperties);Platform=AnyCPU;] ..." Condition="!$(ReferenceType.Contains('Package'))" />
@@ -258,19 +236,16 @@
258236
<PropertyGroup>
259237
<TestCommand>
260238
$(DotnetPath)dotnet test "@(FunctionalTestsProj)"
261-
--no-build
262-
-v n
239+
-f $(TF)
263240
-p:Configuration=$(Configuration)
264-
-p:Target$(TFGroup)Version=$(TF)
265241
-p:ReferenceType=$(ReferenceType)
266-
-p:TestSet=$(TestSet)
267-
-p:TestTargetOS=Windows$(TargetGroup)
268242
$(CollectStatement)
269243
--results-directory $(ResultsDirectory)
270244
--filter "$(FilterStatement)"
271245
--logger:"trx;LogFilePrefix=Functional-Windows$(TargetGroup)-$(TestSet)"
272246
</TestCommand>
273-
<TestCommand>$(TestCommand.Replace($([System.Environment]::NewLine), " "))</TestCommand>
247+
<!-- Convert more than one whitespace character into one space -->
248+
<TestCommand>$([System.Text.RegularExpressions.Regex]::Replace($(TestCommand), "\s+", " "))</TestCommand>
274249
</PropertyGroup>
275250
<Message Text=">>> Running Functional test for Windows via command: $(TestCommand)" />
276251
<Exec ConsoleToMsBuild="true" Command="$(TestCommand)" />
@@ -281,19 +256,16 @@
281256
<PropertyGroup>
282257
<TestCommand>
283258
$(DotnetPath)dotnet test "@(FunctionalTestsProj)"
284-
--no-build
285-
-v n
259+
-f $(TF)
286260
-p:Configuration=$(Configuration)
287-
-p:TargetNetCoreVersion=$(TF)
288261
-p:ReferenceType=$(ReferenceType)
289-
-p:TestSet=$(TestSet)
290-
-p:TestTargetOS=Unixnetcoreapp
291262
$(CollectStatement)
292263
--results-directory $(ResultsDirectory)
293264
--filter "$(FilterStatement)"
294265
--logger:"trx;LogFilePrefix=Functional-Unixnetcoreapp-$(TestSet)"
295266
</TestCommand>
296-
<TestCommand>$(TestCommand.Replace($([System.Environment]::NewLine), " "))</TestCommand>
267+
<!-- Convert more than one whitespace character into one space -->
268+
<TestCommand>$([System.Text.RegularExpressions.Regex]::Replace($(TestCommand), "\s+", " "))</TestCommand>
297269
</PropertyGroup>
298270
<Message Text=">>> Running Functional test for Unix via command: $(TestCommand)" />
299271
<Exec ConsoleToMsBuild="true" Command="$(TestCommand)" />

0 commit comments

Comments
 (0)