Skip to content

Commit

Permalink
Move service related tests to a separate package.
Browse files Browse the repository at this point in the history
  • Loading branch information
jovanstevanovic committed Dec 19, 2024
1 parent 2d1d7b5 commit cc876d5
Show file tree
Hide file tree
Showing 13 changed files with 28 additions and 16 deletions.
6 changes: 3 additions & 3 deletions substratevm/mx.substratevm/mx_substratevm.py
Original file line number Diff line number Diff line change
Expand Up @@ -334,7 +334,7 @@ def native_image_func(args, **kwargs):
yield native_image_func

native_image_context.hosted_assertions = ['-J-ea', '-J-esa']
_native_unittest_features = '--features=com.oracle.svm.test.ImageInfoTest$TestFeature,com.oracle.svm.test.ServiceLoaderTest$TestFeature,com.oracle.svm.test.SecurityServiceTest$TestFeature,com.oracle.svm.test.ReflectionRegistrationTest$TestFeature'
_native_unittest_features = '--features=com.oracle.svm.test.ImageInfoTest$TestFeature,com.oracle.svm.test.services.ServiceLoaderTest$TestFeature,com.oracle.svm.test.services.SecurityServiceTest$TestFeature,com.oracle.svm.test.ReflectionRegistrationTest$TestFeature'

IMAGE_ASSERTION_FLAGS = svm_experimental_options(['-H:+VerifyGraalGraphs', '-H:+VerifyPhases'])

Expand Down Expand Up @@ -545,8 +545,8 @@ def native_unittests_task(extra_build_args=None):
out.write(f"Simple file{i}" + '\n')

additional_build_args = svm_experimental_options([
'-H:AdditionalSecurityProviders=com.oracle.svm.test.SecurityServiceTest$NoOpProvider',
'-H:AdditionalSecurityServiceTypes=com.oracle.svm.test.SecurityServiceTest$JCACompliantNoOpService',
'-H:AdditionalSecurityProviders=com.oracle.svm.test.services.SecurityServiceTest$NoOpProvider',
'-H:AdditionalSecurityServiceTypes=com.oracle.svm.test.services.SecurityServiceTest$JCACompliantNoOpService',
'-cp', cp_entry_name
])
if extra_build_args is not None:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -218,8 +218,20 @@ void handleServiceClassIsReachable(DuringAnalysisAccess access, Class<?> service
if (nullaryConstructor != null || nullaryProviderMethod != null) {
RuntimeReflection.register(providerClass);
if (nullaryConstructor != null) {
/*
* Registering a constructor with
* RuntimeReflection.registerConstructorLookup(providerClass) does not produce
* the same behavior as using RuntimeReflection.register(nullaryConstructor). In
* the first case, the constructor is marked for query purposes only, so this
* if-statement cannot be eliminated.
*
*/
RuntimeReflection.register(nullaryConstructor);
} else {
/*
* If there's no nullary constructor, register it as negative lookup to avoid
* throwing a MissingReflectionRegistrationError at run time.
*/
RuntimeReflection.registerConstructorLookup(providerClass);
}
if (nullaryProviderMethod != null) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ Args= \
--initialize-at-run-time=com.oracle.svm.test \
--initialize-at-build-time=com.oracle.svm.test.AbstractClassSerializationTest,com.oracle.svm.test.SerializationRegistrationTest,com.oracle.svm.test.SerializationRegistrationTest$SerializableTestClass,com.oracle.svm.test.SerializationRegistrationTest$AssociatedRegistrationTestClass,com.oracle.svm.test.LambdaClassSerializationTest,com.oracle.svm.test.LambdaClassDeserializationTest \
--features=com.oracle.svm.test.SerializationRegistrationTestFeature \
--features=com.oracle.svm.test.AbstractServiceLoaderTest$TestFeature \
--features=com.oracle.svm.test.NoProviderConstructorServiceLoaderTest$TestFeature \
--features=com.oracle.svm.test.services.AbstractServiceLoaderTest$TestFeature \
--features=com.oracle.svm.test.services.NoProviderConstructorServiceLoaderTest$TestFeature \
--features=com.oracle.svm.test.NativeImageResourceUtils$TestFeature \
--features=com.oracle.svm.test.jfr.JfrTestFeature \
--add-opens=java.base/java.lang=ALL-UNNAMED \
Expand Down

This file was deleted.

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
com.oracle.svm.test.services.AbstractServiceLoaderTest$ConcreteService
com.oracle.svm.test.services.AbstractServiceLoaderTest$AbstractService
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
com.oracle.svm.test.services.NoProviderConstructorServiceLoaderTest$ProperService
com.oracle.svm.test.services.NoProviderConstructorServiceLoaderTest$NoProviderConstructorService
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
com.oracle.svm.test.services.ServiceLoaderTest$ServiceA
com.oracle.svm.test.services.ServiceLoaderTest$ServiceB
com.oracle.svm.test.services.ServiceLoaderTest$ServiceHostedOnly
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package com.oracle.svm.test;
package com.oracle.svm.test.services;

import java.util.HashSet;
import java.util.ServiceConfigurationError;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package com.oracle.svm.test;
package com.oracle.svm.test.services;

import java.util.HashSet;
import java.util.ServiceConfigurationError;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package com.oracle.svm.test;
package com.oracle.svm.test.services;

import java.security.NoSuchAlgorithmException;
import java.security.Provider;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package com.oracle.svm.test;
package com.oracle.svm.test.services;

import java.util.ArrayList;
import java.util.List;
Expand Down

0 comments on commit cc876d5

Please sign in to comment.