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

Test Java12 MethodHandle changes #4689

Merged
merged 1 commit into from
Feb 24, 2019

Conversation

theresa-m
Copy link
Contributor

Fixes: #4571

Signed-off-by: Theresa Mammarella Theresa.T.Mammarella@ibm.com

fyi @ChengJin01 @DanHeidinga

/* test filterArgumentsWithCombiner for data type byte */
@Test(groups = { "level.extended" })
public void test_filterArgumentsWithCombiner_Byte() throws WrongMethodTypeException, Throwable {
MethodHandle result;

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) {

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.

Copy link
Member

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;
Copy link
Member

@DanHeidinga DanHeidinga Feb 12, 2019

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;

Double d1 = new Double (constDouble1);
Double d2 = new Double (constDouble2);
Double dMax = new Double (Double.MAX_VALUE);
Double dMin = new Double (Double.MIN_VALUE);
Copy link
Member

Choose a reason for hiding this comment

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

extra tab?

}

/* combiner returns highest byte value */
public static byte combinerByte(byte v1, byte v2) {
Copy link
Member

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)) {
Copy link
Member

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;
}

Copy link
Member

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.

Copy link
Contributor Author

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.

@theresa-m
Copy link
Contributor Author

thanks for the reviews @ChengJin01 and @DanHeidinga I've addressed your comments

Copy link
Member

@DanHeidinga DanHeidinga left a 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?

@DanHeidinga DanHeidinga self-assigned this Feb 13, 2019
@DanHeidinga DanHeidinga requested a review from llxia February 13, 2019 22:20
</groups>
<subsets>
<subset>12+</subset>
</subsets>
Copy link
Contributor

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>

Copy link
Contributor Author

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.

Copy link
Contributor

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?

Copy link
Contributor Author

@theresa-m theresa-m Feb 14, 2019

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

Copy link
Contributor

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.

Copy link
Contributor Author

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

Copy link
Contributor

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?

Copy link
Contributor

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.

Copy link
Contributor

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.

@theresa-m theresa-m force-pushed the working_12_test_mh branch 2 times, most recently from 9e37f65 to bfc25c9 Compare February 14, 2019 18:15
Copy link
Contributor

@llxia llxia left a comment

Choose a reason for hiding this comment

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

LGTM

@DanHeidinga
Copy link
Member

Jenkins test sanity xlinux jdk12

Signed-off-by: Theresa Mammarella <Theresa.T.Mammarella@ibm.com>
@theresa-m
Copy link
Contributor Author

rebased to include build fix

@pshipton pshipton added this to the Release 0.13.0 (Java 12) milestone Feb 24, 2019
@pshipton
Copy link
Member

@DanHeidinga can this be merged before the 0.13 code split?

@pshipton
Copy link
Member

Jenkins test sanity plinux jdk12

@pshipton
Copy link
Member

Jenkins test extended plinux jdk12

@pshipton
Copy link
Member

The reviewers have approved and the testing is passing, except for expected sanity failures. Merging.

@pshipton pshipton merged commit 72bf491 into eclipse-openj9:master Feb 24, 2019
@theresa-m theresa-m deleted the working_12_test_mh branch February 25, 2019 14:15
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