Skip to content

Commit 7d07f9a

Browse files
authored
Remove test project dir after test finished in trimmingTests.targets (#114819)
* Remove test project dir in trimmingTests.targets Should help with the out of disk space errors we've been seeing in the dotnet-linker-tests pipeline. * Improve test project cleanup logic * Fix comment
1 parent 7b2de1e commit 7d07f9a

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

eng/testing/linker/trimmingTests.targets

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -165,6 +165,14 @@
165165
</Exec>
166166

167167
<Error Condition="'$(ExecutionExitCode)' != '100'" Text="Error: [Failed Test]: %(TestConsoleApps.ProjectCompileItems). The Command %(TestConsoleApps.TestCommand) return a non-success exit code $(ExecutionExitCode)." ContinueOnError="ErrorAndContinue" />
168+
169+
<!-- Remove test projects dir to save disk space if the test was successful. Ignore failures as this is best effort.
170+
Don't use Removedir as ContinueOnError on it doesn't work when using warnaserror/TreatWarningsAsErrors. -->
171+
<PropertyGroup>
172+
<TestProjectCleanCommand Condition="'$(OS)' == 'Windows_NT'">rmdir "%(TestConsoleApps.ProjectDir.TrimEnd('\'))" /s /q</TestProjectCleanCommand>
173+
<TestProjectCleanCommand Condition="'$(OS)' != 'Windows_NT'">rm -rf "%(TestConsoleApps.ProjectDir)"</TestProjectCleanCommand>
174+
</PropertyGroup>
175+
<Exec Condition="'$(ExecutionExitCode)' == '100'" Command="$(TestProjectCleanCommand)" IgnoreExitCode="true" IgnoreStandardErrorWarningFormat="true" />
168176
</Target>
169177

170178
<Target Name="Build" DependsOnTargets="ExecuteApplications" />

0 commit comments

Comments
 (0)