Following the changes in #38216, we can share source files between linker trimming tests by manually adding the test files in the Library.TrimmingTests..proj file. Files can be added using TestConsoleAppSourceFiles and AdditionalSourceFiles properties.
When tests under a TrimmingTests directory are manually added, the full path of each test file is not shown in the test run output:
build.cmd -s libs.tests -c release /p:TestAssemblies=false /p:TestTrimming=true
[Trimming Tests] Running test: D:\repos\dotnet_runtime\src\libraries\System.Data.Common\tests\TrimmingTests\CreateSqlXmlReader.cs...
[Trimming Tests] Running test: D:\repos\dotnet_runtime\src\libraries\System.Runtime\tests\TrimmingTests\GenericArraySortHelperTest.cs...
[Trimming Tests] Running test: D:\repos\dotnet_runtime\src\libraries\System.Diagnostics.Tracing\tests\TrimmingTests\EventSourcePropertyValueTest.cs...
[Trimming Tests] Running test: D:\repos\dotnet_runtime\src\libraries\System.Diagnostics.DiagnosticSource\tests\TrimmingTests\EventSourcePropertyFetchTest.cs...
[Trimming Tests] Running test: D:\repos\dotnet_runtime\src\libraries\System.Linq.Expressions\tests\TrimmingTests\GetHelperTypeTests.cs...
[Trimming Tests] Running test: CookieExtensionsTest.Clone.cs...
[Trimming Tests] Running test: CookieExtensionsTest.InternalAdd.cs...
[Trimming Tests] Running test: CookieExtensionsTest.ToServerString.cs...
In this example, the CookieExtensionsTest files were manually added, so that a common CookiesExtensionsTest.Helper.cs could be used in each test.
We should fix this so that the full path is shown for each test, manually added or not. This is helpful for quickly jumping into the source for a failing test.
cc @joperezr
Following the changes in #38216, we can share source files between linker trimming tests by manually adding the test files in the
Library.TrimmingTests..projfile. Files can be added usingTestConsoleAppSourceFilesandAdditionalSourceFilesproperties.When tests under a
TrimmingTestsdirectory are manually added, the full path of each test file is not shown in the test run output:In this example, the
CookieExtensionsTestfiles were manually added, so that a commonCookiesExtensionsTest.Helper.cscould be used in each test.We should fix this so that the full path is shown for each test, manually added or not. This is helpful for quickly jumping into the source for a failing test.
cc @joperezr