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

[AOT] Unit testing features with Native AOT #45860

Open
6 tasks
JamesNK opened this issue Jan 4, 2023 · 0 comments
Open
6 tasks

[AOT] Unit testing features with Native AOT #45860

JamesNK opened this issue Jan 4, 2023 · 0 comments
Labels
area-networking Includes servers, yarp, json patch, bedrock, websockets, http client factory, and http abstractions linker-friendliness Tracking linker friendliness NativeAOT

Comments

@JamesNK
Copy link
Member

JamesNK commented Jan 4, 2023

There are places where features use different APIs if the app is published with native AOT. For example, routing uses IL emit to generate custom lookup tables when IsDynamicCodeSupported is true, and falls back to dictionary lookup when it is false.

We should have unit tests that execute tests with native AOT to verify these code paths work correctly. Code that tests IsDynamicCodeSupported or IsDynamicCodeCompiled are likely candidates.

Known places that should have native AOT testing:

  • Building route DFA
  • ProblemDetails + Extensions
  • MapXXX methods + request filters
  • Generic host + value type container builder (verify that error is thrown)
  • Invoke middleware with parameters [AOT] Add middleware reflection fallback #45890
  • PopulateMetadata fallback

https://github.com/dotnet/runtime has a pattern for this type of testing. We should look at what runtime do.

@JamesNK JamesNK added linker-friendliness Tracking linker friendliness NativeAOT labels Jan 4, 2023
eerhardt added a commit to eerhardt/aspnetcore that referenced this issue May 2, 2023
This infrastructure was taken from https://github.com/dotnet/runtime/tree/c62f69be1405a8e41b56ffc05f22d791bf4c7d2d/eng/testing/linker and modified to work in dotnet/aspnetcore.

Added the first test:
- Generic host + value type container builder (verify that error is thrown)

Contributes to dotnet#45860
eerhardt added a commit that referenced this issue May 4, 2023
* Add infrastructure for trimming and NativeAOT test apps.

This infrastructure was taken from https://github.com/dotnet/runtime/tree/c62f69be1405a8e41b56ffc05f22d791bf4c7d2d/eng/testing/linker and modified to work in dotnet/aspnetcore.

Added the first test:
- Generic host + value type container builder (verify that error is thrown)

Contributes to #45860

* Skip IsPublishedAppTestProject projects when SkipTestBuild=true.

Use `Sdk="Microsoft.NET.Sdk"` in order to skip the build correctly. Only run the AOT tests during Test. Skip "Build" and skip publishing for Helix.

Ensure the IsPublishedAppTestProject projects aren't built until the shared fx is built using RequiresDelayedBuild.

* Add workaround for dotnet/arcade#13406
@amcasey amcasey added area-networking Includes servers, yarp, json patch, bedrock, websockets, http client factory, and http abstractions and removed area-runtime labels Dec 19, 2023
@dotnet-policy-service dotnet-policy-service bot added the pending-ci-rerun When assigned to a PR indicates that the CI checks should be rerun label Feb 6, 2024
@wtgodbe wtgodbe removed the pending-ci-rerun When assigned to a PR indicates that the CI checks should be rerun label Feb 6, 2024
@dotnet-policy-service dotnet-policy-service bot added the pending-ci-rerun When assigned to a PR indicates that the CI checks should be rerun label Feb 6, 2024
@wtgodbe wtgodbe removed the pending-ci-rerun When assigned to a PR indicates that the CI checks should be rerun label Feb 13, 2024
@dotnet dotnet deleted a comment from dotnet-policy-service bot Feb 13, 2024
@dotnet dotnet deleted a comment from dotnet-policy-service bot Feb 13, 2024
@amcasey amcasey added this to the .NET 9 Planning milestone Mar 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-networking Includes servers, yarp, json patch, bedrock, websockets, http client factory, and http abstractions linker-friendliness Tracking linker friendliness NativeAOT
Projects
None yet
Development

No branches or pull requests

4 participants