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

Delete infra changes #50789

Merged
merged 2 commits into from
Apr 7, 2021
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 eng/testing/linker/project.csproj.template
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@

<ItemGroup>
{AdditionalProjectReferences}
{TrimmerRootAssemblies}
</ItemGroup>

<!-- Logic to override the default IlLink tasks that come from the SDK and use the one
Expand Down
6 changes: 0 additions & 6 deletions eng/testing/linker/trimmingTests.targets
Original file line number Diff line number Diff line change
Expand Up @@ -66,11 +66,6 @@
<_additionalProjectSourceFiles Include="%(TestConsoleApps.AdditionalSourceFiles)" />
</ItemGroup>

<PropertyGroup>
<_TrimmerRootAssemblies>%(TestConsoleApps.TrimmerRootAssemblies)</_TrimmerRootAssemblies>
<_TrimmerRootAssemblies Condition="'$(_TrimmerRootAssemblies)' != ''">&lt;TrimmerRootAssembly Include=&quot;$(_TrimmerRootAssemblies)&quot; /&gt;</_TrimmerRootAssemblies>
</PropertyGroup>

<MakeDir Directories="$(_projectDir)" />
<WriteLinesToFile File="$(_projectFile)"
Lines="$([System.IO.File]::ReadAllText('$(ProjectTemplate)')
Expand All @@ -82,7 +77,6 @@
.Replace('{MicrosoftNETILLinkTasksVersion}', '$(MicrosoftNETILLinkTasksVersion)')
.Replace('{ExtraTrimmerArgs}', '%(TestConsoleApps.ExtraTrimmerArgs)')
.Replace('{AdditionalProjectReferences}', '$(_additionalProjectReferencesString)')
.Replace('{TrimmerRootAssemblies}', '$(_TrimmerRootAssemblies)')
.Replace('{RepositoryEngineeringDir}', '$(RepositoryEngineeringDir)')
.Replace('{MonoAOTCompilerDir}', '$(MonoAOTCompilerDir)')
.Replace('{MonoProjectRoot}', '$(MonoProjectRoot)')
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,6 @@
<Project DefaultTargets="Build">
<Import Project="$([MSBuild]::GetPathOfFileAbove(Directory.Build.props))" />

<ItemGroup>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you leave these in place? The issue with the current behavior is that as soon as someone adds one TestConsoleAppSourceFiles item, the implicitly defined ones go away and the tests don't run.

I wish we had one model in these tests.

cc @joperezr

Copy link
Author

@pgovind pgovind Apr 6, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Right, I remember that. That's why I deleted all the TestConsoleAppSourceFiles Include=... lines. That would mean every file gets included and tested right? Anyway, this is just my curiosity. I'll add those lines back.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you remove all of the TestConsoleAppSourceFiles items, then the infra searches for all .cs files in the current directory. As soon as you add 1 TestConsoleAppSourceFiles item, it stops doing that. I want us to stop relying on the implicit behavior, so people don't make mistakes in the future.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah got it. Fixed now

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

While @eerhardt point is correct in that the model is not ideal so one inclusion overrides the default, I think you are fine to keep it the way you had it (with them removed) since it would effectively be the same thing here.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you remove all of the TestConsoleAppSourceFiles items, then the infra searches for all .cs files in the current directory. As soon as you add 1 TestConsoleAppSourceFiles item, it stops doing that. I want us to stop relying on the implicit behavior, so people don't make mistakes in the future.

I see, We could easily just remove the automatic globbing if you think that would be better. I'm happy to take care of that and find all Trimming tests depending on it and moving them to the manual specification instead.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The other option would be to make it work like all other globbing behavior in projects (for example, the *.cs Compile globbing). If I don't want a .cs file to be a top level test, I write

<TestConsoleAppSourceFiles Remove="SharedHelperFile.cs" />.

And if I need to set some metadata items for a specific file I write:

<TestConsoleAppSourceFiles Update="MyTest.cs" SomeSwitch="true" />.

And then by default the globbing just works like people normally expect - it is always there. And adding/updating/removing the TestConsoleAppSourceFiles item doesn't affect other tests.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd need to check if the Update part will work in this case since globbing will set the itemspec as the full path and I'm not sure if just filename and extension would match and appropriately set the switch, but I'll take a look to see if this could be done.

<TestConsoleAppSourceFiles Include="ComObjectTypeTest.cs" />
<TestConsoleAppSourceFiles Include="InterfaceTypeTest.cs" />
<TestConsoleAppSourceFiles Include="TypeConverterIsReadOnly.cs" />
<TestConsoleAppSourceFiles Include="TypeConverterTest.cs" />
</ItemGroup>

<Import Project="$([MSBuild]::GetPathOfFileAbove(Directory.Build.targets))" />
</Project>