-
Notifications
You must be signed in to change notification settings - Fork 38.3k
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 support for processing test contexts ahead-of-time #28204
Labels
in: test
Issues in the test module
theme: aot
An issue related to Ahead-of-time processing
type: enhancement
A general enhancement
Milestone
Comments
snicoll
added
in: test
Issues in the test module
type: enhancement
A general enhancement
theme: aot
An issue related to Ahead-of-time processing
labels
Mar 21, 2022
sbrannen
changed the title
Add support for processing test contexts Ahead-of-time
Add support for processing test contexts ahead-of-time
Jul 14, 2022
This was referenced Jul 14, 2022
Current work on this feature can be viewed in the following feature branch. As individual aspects of the feature set mature, I incorporate them into the |
This was referenced Aug 17, 2022
sbrannen
added a commit
to sbrannen/spring-framework
that referenced
this issue
Aug 22, 2022
This commit introduces TestContextAotGenerator for processing Spring integration test classes and generating AOT artifacts. Specifically, this class performs the following. - bootstraps the TCF for a given test class - builds the MergedContextConfiguration for each test class and tracks all test classes that share the same MergedContextConfiguration - loads each test ApplicationContext without refreshing it - passes the test ApplicationContext to ApplicationContextAotGenerator to generate the AOT optimized ApplicationContextInitializer - The GenerationContext passed to ApplicationContextAotGenerator uses a feature name of the form "TestContext###_", where "###" is a 3-digit sequence ID left padded with zeros. This commit also includes tests using the TestCompiler to verify that each generated ApplicationContextInitializer can be used to populate a GenericApplicationContext as expected. See spring-projectsgh-28204
sbrannen
added a commit
to sbrannen/spring-framework
that referenced
this issue
Aug 22, 2022
sbrannen
added a commit
to sbrannen/spring-framework
that referenced
this issue
Aug 22, 2022
TestContextAotGenerator now uses AotTestMappingsCodeGenerator to generate a AotTestMappings__Generated.java class which is loaded in AotTestMappings via reflection in order to retrieve access to ApplicationContextIntializers generated during AOT processing. Furthermore, the processAheadOfTimeAndGenerateAotTestMappings() method in TestContextAotGeneratorTests now performs a rather extensive test including: - emulating TestClassScanner to find test classes - processing all test classes and generating ApplicationContextIntializers - generating mappings for AotTestMappings - compiling all generated code - loading AotTestMappings - using AotTestMappings to instantiate the generated ApplicationContextIntializers - using AotRuntimeContextLoader to load the AOT-optimized ApplicationContext - asserting the behavior of the loaded ApplicationContext See spring-projectsgh-28205 Closes spring-projectsgh-28204
sbrannen
added a commit
to sbrannen/spring-framework
that referenced
this issue
Aug 23, 2022
This commit introduces TestContextAotGenerator for processing Spring integration test classes and generating AOT artifacts. Specifically, this class performs the following. - bootstraps the TCF for a given test class - builds the MergedContextConfiguration for each test class and tracks all test classes that share the same MergedContextConfiguration - loads each test ApplicationContext without refreshing it - passes the test ApplicationContext to ApplicationContextAotGenerator to generate the AOT optimized ApplicationContextInitializer - The GenerationContext passed to ApplicationContextAotGenerator uses a feature name of the form "TestContext###_", where "###" is a 3-digit sequence ID left padded with zeros. This commit also includes tests using the TestCompiler to verify that each generated ApplicationContextInitializer can be used to populate a GenericApplicationContext as expected. See spring-projectsgh-28204
sbrannen
added a commit
to sbrannen/spring-framework
that referenced
this issue
Aug 23, 2022
sbrannen
added a commit
to sbrannen/spring-framework
that referenced
this issue
Aug 23, 2022
TestContextAotGenerator now uses AotTestMappingsCodeGenerator to generate a AotTestMappings__Generated.java class which is loaded in AotTestMappings via reflection in order to retrieve access to ApplicationContextIntializers generated during AOT processing. Furthermore, the processAheadOfTimeAndGenerateAotTestMappings() method in TestContextAotGeneratorTests now performs a rather extensive test including: - emulating TestClassScanner to find test classes - processing all test classes and generating ApplicationContextIntializers - generating mappings for AotTestMappings - compiling all generated code - loading AotTestMappings - using AotTestMappings to instantiate the generated ApplicationContextIntializer - using the AotContextLoader API to load the AOT-optimized ApplicationContext - asserting the behavior of the loaded ApplicationContext See spring-projectsgh-28205 Closes spring-projectsgh-28204
sbrannen
added a commit
to sbrannen/spring-framework
that referenced
this issue
Aug 23, 2022
This commit introduces TestContextAotGenerator for processing Spring integration test classes and generating AOT artifacts. Specifically, this class performs the following. - bootstraps the TCF for a given test class - builds the MergedContextConfiguration for each test class and tracks all test classes that share the same MergedContextConfiguration - loads each test ApplicationContext without refreshing it - passes the test ApplicationContext to ApplicationContextAotGenerator to generate the AOT optimized ApplicationContextInitializer - The GenerationContext passed to ApplicationContextAotGenerator uses a feature name of the form "TestContext###_", where "###" is a 3-digit sequence ID left padded with zeros. This commit also includes tests using the TestCompiler to verify that each generated ApplicationContextInitializer can be used to populate a GenericApplicationContext as expected. See spring-projectsgh-28204
sbrannen
added a commit
to sbrannen/spring-framework
that referenced
this issue
Aug 23, 2022
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
in: test
Issues in the test module
theme: aot
An issue related to Ahead-of-time processing
type: enhancement
A general enhancement
Overview
Now that we can process an application context for AOT optimizations, we'd like to extend that feature by providing support in other parts of the portfolio. One that we have experimented with in Spring Native is processing the application contexts that the TCF uses for a module so that they are "native-friendly".
In practice, this would mean introducing something like
TestContextAotProcessor
that builds on top ofApplicationContextAotProcessor
, pre-processing the test infrastructure for each context identified amongst a set of test classes.We'd need at least one additional context to provide a "prepared"
GenericApplicationContext
for aMergedContextConfiguration
as each "bootstrapper" can have its own logic baked in.Related Issues
The text was updated successfully, but these errors were encountered: