Skip to content

Fix cross-os symbol generation #20481

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

Merged

Conversation

davidwrighton
Copy link
Member

  • Use the target os to determine the symbol type, not the sdk os
  • Add tests for cross os/cross arch crossgen compilation

- Use the target os to determine the symbol type, not the sdk os
- Add tests for cross os/cross arch crossgen compilation
…ternal, as the new test logic demands correctness
[InlineData("net6.0", "win-x86", "windows", "X86,X64,Arm64,Arm", "nonComposite", "nonselfcontained")]
public void It_supports_crossos_arch_compilation(string targetFramework, string runtimeIdentifier, string sdkSupportedOs, string sdkSupportedArch, string composite, string selfcontained)
{
var projectName = $"FrameworkDependentUsingCrossArchTest";// {targetFramework}{runtimeIdentifier.Replace("-",".")}{composite}{selfcontained}";
Copy link
Member

Choose a reason for hiding this comment

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

Do we need to fix this line?

[InlineData("net6.0", "linux-x64", "windows,linux,osx", "X64,Arm64", "composite", "selfcontained")] // Composite in .NET 6.0 is only supported for self-contained builds
[InlineData("net6.0", "win-x64", "windows", "X64,Arm64", "composite", "selfcontained")] // Composite in .NET 6.0 is only supported for self-contained builds
[InlineData("net6.0", "osx-arm64", "windows,linux,osx", "X64,Arm64", "nonComposite", "nonselfcontained")]
// In .NET 6.0 building targetting Windows doesn't support emitting native symbols.
Copy link
Member

Choose a reason for hiding this comment

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

This comment should be applied to win-x64 as well, correct?

[InlineData("net6.0", "osx-arm64", "windows,linux,osx", "X64,Arm64", "nonComposite", "nonselfcontained")]
// In .NET 6.0 building targetting Windows doesn't support emitting native symbols.
[InlineData("net6.0", "win-x86", "windows", "X86,X64,Arm64,Arm", "nonComposite", "nonselfcontained")]
public void It_supports_crossos_arch_compilation(string targetFramework, string runtimeIdentifier, string sdkSupportedOs, string sdkSupportedArch, string composite, string selfcontained)
Copy link
Member

Choose a reason for hiding this comment

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

I would use either just It_supports_cross_compilation or It_supports_cross_os_and_arch_compilation.


private static bool IsTargetOsOsX(string runtimeIdentifier)
{
if (runtimeIdentifier.Contains("osx") || runtimeIdentifier.Contains("macOs"))
Copy link
Member

Choose a reason for hiding this comment

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

I think macOs cannot be a part of a valid runtime identifier.

});
if (composite)
{
pdbFiles = new[] { GetPDBFileName(Path.ChangeExtension(mainProjectDll, "r2r.dll"), framework, testProject.RuntimeIdentifier) };
Copy link
Member

Choose a reason for hiding this comment

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

How would the composite tests pass without this line?

Copy link
Member Author

Choose a reason for hiding this comment

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

The tests which set composite used to not set selfcontained. This resulted in the compiler not actually producing a composite build, so the test continued to pass. The tests have been adjusted to explicitly pass composite false now.

Copy link
Member

@AntonLapounov AntonLapounov left a comment

Choose a reason for hiding this comment

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

Looks good in general. Thank you!

@davidwrighton davidwrighton merged commit cf2fd1e into dotnet:main Sep 3, 2021
@davidwrighton
Copy link
Member Author

/backport to release/6.0.1xx

davidwrighton added a commit to davidwrighton/sdk that referenced this pull request Sep 3, 2021
* Fix cross-os symbol generation
- Use the target os to determine the symbol type, not the sdk os
- Add tests for cross os/cross arch crossgen compilation

* Fix tests to specify composite accurately to TestProjectPublishing_Internal, as the new test logic demands correctness
davidwrighton added a commit that referenced this pull request Sep 3, 2021
* Fix cross-os symbol generation
- Use the target os to determine the symbol type, not the sdk os
- Add tests for cross os/cross arch crossgen compilation

* Fix tests to specify composite accurately to TestProjectPublishing_Internal, as the new test logic demands correctness
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants