Skip to content

Commit

Permalink
fix path too long in test
Browse files Browse the repository at this point in the history
  • Loading branch information
nagilson committed Apr 25, 2023
1 parent ef50ea6 commit 7d7f707
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,8 @@ Copyright (c) .NET Foundation. All rights reserved.
<!-- Breaking change in .NET 8: Some publish properties used to imply SelfContained or require it at the time of this PR to work. We decided to infer SelfContained still in these situations. -->
<PropertyGroup Condition="'$(SelfContained)' == '' and
'$(PublishSelfContained)' == '' and
'$(_TargetFrameworkVersionWithoutV)' &gt; '7.0' and
'$(_TargetFrameworkVersionWithoutV)' != '' and
'$(_TargetFrameworkVersionWithoutV)' &gt; '7.0' and
(
'$(PublishTrimmed)' == 'true' or
'$(PublishSingleFile)' == 'true' or
Expand Down
25 changes: 18 additions & 7 deletions src/Tests/Microsoft.NET.Publish.Tests/RuntimeIdentifiersTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -279,8 +279,9 @@ public void PublishRuntimeIdentifierOverridesUseCurrentRuntime()
[InlineData("PublishReadyToRun", false)]
[InlineData("PublishSingleFile", false)]
[InlineData("PublishTrimmed", false)]
public void DesiredPublishPropertiesImplySelfContainedForFrameworkDepedentDefaultFrameworks(string property, bool useFrameworkDependentDefaultTargetFramework)
public void SomePublishPropertiesInferSelfContained(string property, bool useFrameworkDependentDefaultTargetFramework)
{
// Note: there is a bug with PublishAot I think where this test will fail for Aot if the testname is too long. Do not make it longer.
var tfm = useFrameworkDependentDefaultTargetFramework ? ToolsetInfo.CurrentTargetFramework : "net7.0"; // net 7 is the last non FDD default TFM at the time of this PR.
var testProject = new TestProject()
{
Expand All @@ -293,20 +294,30 @@ public void DesiredPublishPropertiesImplySelfContainedForFrameworkDepedentDefaul
var testAsset = _testAssetsManager.CreateTestProject(testProject, identifier: $"{property}-{useFrameworkDependentDefaultTargetFramework}");

var publishCommand = new DotnetPublishCommand(Log, Path.Combine(testAsset.TestRoot, testProject.Name));
publishCommand
.Execute()
.Should()
.Pass();
if (property == "PublishTrimmed" && !useFrameworkDependentDefaultTargetFramework)
{
publishCommand
.Execute("-bl:C:\\users\\noahgilson\\whydoespublishaotfail.binlog")
.Should()
.Fail();
}
else
{
publishCommand
.Execute("-bl:C:\\users\\noahgilson\\whydoespublishaotfail.binlog")
.Should()
.Pass();
}

var properties = testProject.GetPropertyValues(testAsset.TestRoot, targetFramework: tfm);
var properties = testProject.GetPropertyValues(testAsset.TestRoot, targetFramework: tfm, configuration: useFrameworkDependentDefaultTargetFramework ? "Release" : "Debug");

var expectedSelfContainedValue = "true";
if (
(property == "PublishReadyToRun" && useFrameworkDependentDefaultTargetFramework) || // This property should no longer infer SelfContained in net 8
(property == "PublishTrimmed" && !useFrameworkDependentDefaultTargetFramework) // This property did not infer SelfContained until net 8
)
{
expectedSelfContainedValue = "";
expectedSelfContainedValue = "false";
}

properties["SelfContained"].Should().Be(expectedSelfContainedValue);
Expand Down

0 comments on commit 7d7f707

Please sign in to comment.