-
Notifications
You must be signed in to change notification settings - Fork 738
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
Test Java12 MethodHandle changes #4689
Conversation
/* test filterArgumentsWithCombiner for data type byte */ | ||
@Test(groups = { "level.extended" }) | ||
public void test_filterArgumentsWithCombiner_Byte() throws WrongMethodTypeException, Throwable { | ||
MethodHandle result; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Better declare when using it in the test.
e.g. MethodHandle result = (MethodHandle)fawcMethod.invoke(...)
result = ...
} | ||
|
||
/* combiner returns highest byte value */ | ||
public static byte combinerByte(byte v1, byte v2) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
All test methods like this should be moved to a separate file as this file only contains test cases.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure I agree with that as it introduces another helper file. Tests are already marked with an annotation. What's the rationale for moving the helper methods?
private final static boolean constBoolMin = false; | ||
|
||
private final static String MHClassName = "java.lang.invoke.MethodHandles"; | ||
private static Class<?> mhClazz; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
private static Class<?> mhClazz = MethodHandles.class;
test/functional/Jsr292/src/com/ibm/j9/jsr292/FilterArgumentsWithCombinerTest.java
Show resolved
Hide resolved
Double d1 = new Double (constDouble1); | ||
Double d2 = new Double (constDouble2); | ||
Double dMax = new Double (Double.MAX_VALUE); | ||
Double dMin = new Double (Double.MIN_VALUE); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
extra tab?
test/functional/Jsr292/src/com/ibm/j9/jsr292/FilterArgumentsWithCombinerTest.java
Show resolved
Hide resolved
} | ||
|
||
/* combiner returns highest byte value */ | ||
public static byte combinerByte(byte v1, byte v2) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure I agree with that as it introduces another helper file. Tests are already marked with an annotation. What's the rationale for moving the helper methods?
|
||
/* return the lowest value char */ | ||
public static char targetChar(char v1, char v2, char v3) { | ||
if ((v1 <= v2) & (v1 <= v3)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This can be written in fewer comparisons and ends up with simpler to read logic
public static char targetChar(char v1, char v2, char v3) {
char lowest = v1;
if (v2 < lowest) {
lowest = v2;
}
if (v3 < lowest) {
lowest = v3;
}
return lowest;
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've found for tests like this, that sometimes it more clear what is happening if the test either returns a string that concats all the arguments into a list or it returns an array of the arguments. It helps with debugging the tests when there is a problem.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
that definitely seems more straightforward. I will do something your suggestion.
ee687bb
to
0099bd7
Compare
thanks for the reviews @ChengJin01 and @DanHeidinga I've addressed your comments |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm. @llxia Can you or a delegate give this a once over to validate the way the tests are being added?
</groups> | ||
<subsets> | ||
<subset>12+</subset> | ||
</subsets> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you please add impls? Thanks
<impls>
<impl>openj9</impl>
<impl>ibm</impl>
</impls>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
these changes should not be j9 specific.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ideally try running these tests against a hotspot build, have you been able to verify that?
If so and they run fine, then you can leave out the <impls>
block, and impl specifiers, so that these tests will get run against all implementations?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the NoOptions run passes with hotspot but the Mode195 test does not. I'll add the impls
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So presumably a hotspot build chokes on the option -XX:RecreateClassfileOnload which Mode195 contains.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
makes sense. its added now
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In this case, should we break this test into two? one for NoOptions which is for all impls, and one for Mode195 which is openj9 and ibm specific?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was not going to suggest it, because it has implications for all other targets (as test team already discussed, and have deferred decision), we may want to consider other options than nearly duplicate test targets for the multi-impl test approach.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
but yes, it could broken it in 2.
Eventually, we will need to do a pass of all playlists, when we do that, we may not want to break all the test targets into 2 to achieve multi-impl testing. We may want a rule that says NoOptions gets run on all impls, or some back-end check for options that strips out modes that are not applicable.
9e37f65
to
bfc25c9
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Jenkins test sanity xlinux jdk12 |
Signed-off-by: Theresa Mammarella <Theresa.T.Mammarella@ibm.com>
bfc25c9
to
77e1f32
Compare
rebased to include build fix |
@DanHeidinga can this be merged before the 0.13 code split? |
Jenkins test sanity plinux jdk12 |
Jenkins test extended plinux jdk12 |
The reviewers have approved and the testing is passing, except for expected sanity failures. Merging. |
Fixes: #4571
Signed-off-by: Theresa Mammarella Theresa.T.Mammarella@ibm.com
fyi @ChengJin01 @DanHeidinga