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

Add a source-build smoke test for native debug symbols #16488

Merged

Conversation

omajid
Copy link
Member

@omajid omajid commented May 23, 2023

This test runs file to find ELF binaries, and then eu-readelf against it to find if all the indicators for native debug symbols are present.

The technique was explained to me by Mark Wielaard ages ago.

This test currently fails. It will continue to fail until dotnet/sdk-container-builds#440 is fixed.

Contributes to dotnet/source-build#3462

@omajid omajid requested a review from a team as a code owner May 23, 2023 21:49
@omajid
Copy link
Member Author

omajid commented May 24, 2023

Hm, tests are failing because mcr.microsoft.com/dotnet-buildtools/prereqs:centos-stream8 (https://github.com/dotnet/dotnet-buildtools-prereqs-docker/blob/main/src/centos/stream8/Dockerfile) doesn't have file and elfutils. Should I update the existing buildtools dockerfile for CentOS Stream 8? Or should I create something specific for our testing scenario?

@MichaelSimons
Copy link
Member

IMO, these dependencies should be added to build buildtools-prereqs container.

omajid added a commit to omajid/dotnet-buildtools-prereqs-docker that referenced this pull request May 25, 2023
@omajid omajid force-pushed the source-build-smoke-test-debugging branch from 70332ee to ce5bfc5 Compare May 26, 2023 15:37
@omajid
Copy link
Member Author

omajid commented May 27, 2023

Test is working correctly now and fails due to dotnet/sdk-container-builds#440

Copy link
Member

@MichaelSimons MichaelSimons left a comment

Choose a reason for hiding this comment

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

@baronfel - is dotnet/sdk-container-builds#440 something that will be fixed soon? If not, @omajid, what do you think about adding an exclusion for containerize so that we can merge this PR to ensure no more regressions are submitted.

}
}

Assert.False(foundIssue);
Copy link
Member

Choose a reason for hiding this comment

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

The UX when the Assert fails requires the user to wade through the test output to find the source of the failure. This is a bit burdensome. This could be improved by capturing the issues in a StringBuilder variable and including it in the userMessage of the Assert.False method.


private ScanResult ScanFile(string fileName)
{
string readelfSStdOut = ExecuteHelper.ExecuteProcessValidateExitCode("eu-readelf", $"-S {fileName}", OutputHelper);
Copy link
Member

Choose a reason for hiding this comment

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

I see eu-readelf and file were added utils to the centos stream 8 image in dotnet/dotnet-buildtools-prereqs-docker@b15dff8. This dependency is going to be required for all of the other distros/images we run in CI - https://github.com/dotnet/installer/blob/main/eng/pipelines/templates/stages/vmr-build.yml#L16.

This leads me to think we should document these native dependencies in the test's readme - https://github.com/dotnet/installer/blob/main/src/SourceBuild/content/test/Microsoft.DotNet.SourceBuild.SmokeTests/README.md

@baronfel
Copy link
Member

@MichaelSimons there's a PR by @vlada-shubina that should solve it, just gotta get it green

@omajid omajid force-pushed the source-build-smoke-test-debugging branch 10 times, most recently from 4ef5517 to 050cd97 Compare June 7, 2023 14:19
@omajid omajid force-pushed the source-build-smoke-test-debugging branch from 050cd97 to ffe4d74 Compare June 12, 2023 16:21
@omajid
Copy link
Member Author

omajid commented Jun 12, 2023

Not sure where this error is coming from:

    /vmr/.dotnet/sdk/8.0.100-preview.6.23312.1/Sdks/Microsoft.NET.Sdk/targets/Microsoft.NET.Sdk.FrameworkReferenceResolution.targets(90,5): error NETSDK1195: Trimming, or code compatibility analysis for trimming, single-file deployment, or ahead-of-time compilation is not supported for the target framework. For more information, see https://aka.ms/netsdk1195 [/vmr/src/runtime/artifacts/source-build/self/src/Build.proj]

I filed #16648 to update Fedora 36 to Fedora 38, and the Fedora 38 containers include file and eu-readelf utilities.

@mthalman
Copy link
Member

@eerhardt - See #16488 (comment)

@eerhardt
Copy link
Member

@sbomer any idea on the above error?

error NETSDK1195: Trimming, or code compatibility analysis for trimming, single-file deployment, or ahead-of-time compilation is not supported for the target framework. For more information, see https://aka.ms/netsdk1195 [/vmr/src/runtime/artifacts/source-build/self/src/Build.proj]

@mthalman @omajid - is there a binlog of the build with this error?

@sbomer
Copy link
Member

sbomer commented Jun 12, 2023

It's the same error that came up in dotnet/source-build#3490 - which if the root cause is the same should be fixed by dotnet/runtime#87071. Is that runtime fix included in the bits which produced the error?

@mthalman
Copy link
Member

It's the same error that came up in dotnet/source-build#3490 - which if the root cause is the same should be fixed by dotnet/runtime#87071. Is that runtime fix included in the bits which produced the error?

Oh yes, sorry about that. @omajid, these errors are expected currently in the main branch. Should be resolved once #16621 gets merged and incorporated in the VMR.

@omajid
Copy link
Member Author

omajid commented Jun 19, 2023

This is a new error:

MSBUILD : error MSB1021: Cannot create an instance of the logger. Microsoft.Build.BackEnd.Logging.CentralForwardingLogger Could not load type of field 'Microsoft.Build.Shared.TypeLoader:_context' (4) due to: Could not load file or assembly 'System.Reflection.MetadataLoadContext, Version=7.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51' or one of its dependencies.

Anyone seen this before?

@MichaelSimons
Copy link
Member

This is a new error:

MSBUILD : error MSB1021: Cannot create an instance of the logger. Microsoft.Build.BackEnd.Logging.CentralForwardingLogger Could not load type of field 'Microsoft.Build.Shared.TypeLoader:_context' (4) due to: Could not load file or assembly 'System.Reflection.MetadataLoadContext, Version=7.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51' or one of its dependencies.

Anyone seen this before?

This same error is appearing in dotnet/source-build#3528 when building smoke-tests

@MichaelSimons
Copy link
Member

The VMR Source-Build Fedora38_Offline_CurrentSourceBuiltSdk_x64 leg is failing because of dotnet/source-build#3515.

@omajid omajid force-pushed the source-build-smoke-test-debugging branch from 35f01ff to f4e4dfd Compare July 13, 2023 18:16
@omajid omajid force-pushed the source-build-smoke-test-debugging branch 2 times, most recently from 1a48b13 to f00fee1 Compare July 19, 2023 14:33
@MichaelSimons
Copy link
Member

@omajid, looks like the tests passed. When convenient, revert the changes to validate in PR validation.

This test runs `file` to find ELF binaries, and then `eu-readelf`
against it to find if all the indicators for native debug symbols are
present.

The technique was explained to me by Mark Wielaard ages ago.

This test currently fails. It will continue to fail until
dotnet/sdk-container-builds#440 is fixed.

Contributes to dotnet/source-build#3462
@omajid omajid force-pushed the source-build-smoke-test-debugging branch from e9afb75 to db9fc52 Compare August 8, 2023 22:55
@MichaelSimons MichaelSimons merged commit c796ecb into dotnet:main Aug 9, 2023
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.

6 participants