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

8258813: [TESTBUG] Fix incorrect Vector API test output message #1922

Closed
wants to merge 2 commits into from

Conversation

XiaohongGong
Copy link
Contributor

@XiaohongGong XiaohongGong commented Jan 4, 2021

Some vector api tests have incorrect output messages if assertion fails. The root cause is the improper use of "org.testng.Assert.assertEqual()", whose definition with int type is:

assertEquals(int actual, int expected, String message);

The method needs the actual value be used as the first argument and expected value as the second one. But in some vector api tests, the two arguments are swapped.

For example, here is part of the fail log in VectorReshapeTests we met:

 expect: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16]
 output: [1, 2, 3, 4, 5, 6, 7, 8, 1, 0, 0, 0, 0, 0, 0, 0]
 test VectorReshapeTests.testRebracket128(byte(i)): failure
 java.lang.AssertionError: arrays differ firstly at element [8]; expected value is <1> but was <9>.
   at org.testng.Assert.fail(Assert.java:94)
   at org.testng.Assert.assertEquals(Assert.java:774)
   ...

The assertion error should be "...expected value is <9> but was <1>."

This does not influence on the test effectiveness. However, the incorrect message is confusing which might mislead people. The simple fix is just to swap the arguments back.

This patch also adjusts the arguments order of all the assertion methods to make the actual values used as the first one. Besides, it also removes two unused assertion methods.


Progress

  • Change must not contain extraneous whitespace
  • Commit message must refer to an issue
  • Change must be properly reviewed

Issue

  • JDK-8258813: [TESTBUG] Fix incorrect Vector API test output message

Reviewers

Download

$ git fetch https://git.openjdk.java.net/jdk pull/1922/head:pull/1922
$ git checkout pull/1922

@bridgekeeper
Copy link

bridgekeeper bot commented Jan 4, 2021

👋 Welcome back xgong! A progress list of the required criteria for merging this PR into master will be added to the body of your pull request. There are additional pull request commands available for use with this pull request.

@openjdk openjdk bot added the rfr Pull request is ready for review label Jan 4, 2021
@openjdk
Copy link

openjdk bot commented Jan 4, 2021

@XiaohongGong To determine the appropriate audience for reviewing this pull request, one or more labels corresponding to different subsystems will normally be applied automatically. However, no automatic labelling rule matches the changes in this pull request. In order to have an "RFR" email sent to the correct mailing list, you will need to add one or more applicable labels manually using the /label pull request command.

Applicable Labels
  • 2d
  • awt
  • beans
  • build
  • compiler
  • core-libs
  • hotspot
  • hotspot-compiler
  • hotspot-gc
  • hotspot-jfr
  • hotspot-runtime
  • i18n
  • javadoc
  • jdk
  • jmx
  • kulla
  • net
  • nio
  • security
  • serviceability
  • shenandoah
  • sound
  • swing

@XiaohongGong
Copy link
Contributor Author

/label add hotspot-compiler

@openjdk openjdk bot added the hotspot-compiler hotspot-compiler-dev@openjdk.org label Jan 4, 2021
@openjdk
Copy link

openjdk bot commented Jan 4, 2021

@XiaohongGong
The hotspot-compiler label was successfully added.

@mlbridge
Copy link

mlbridge bot commented Jan 4, 2021

Webrevs

Copy link
Member

@PaulSandoz PaulSandoz left a comment

Choose a reason for hiding this comment

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

Thank you for fixing this. So easy to get mixed up between TestNG and JUnit!

It's tempting to change the parameter names of the assert methods to be named expected and accepted, i'll consider doing that rather than impose that on you.

@openjdk
Copy link

openjdk bot commented Jan 4, 2021

@XiaohongGong This change now passes all automated pre-integration checks.

ℹ️ This project also has non-automated pre-integration requirements. Please see the file CONTRIBUTING.md for details.

After integration, the commit message for the final commit will be:

8258813: [TESTBUG] Fix incorrect Vector API test output message

Reviewed-by: psandoz, njian

You can use pull request commands such as /summary, /contributor and /issue to adjust it as needed.

At the time when this comment was updated there had been 69 new commits pushed to the master branch:

  • 8b45497: 8259037: livenmethods cannot find hsdis library
  • 7d76966: 8255757: Javac emits duplicate pool entries on array::clone
  • cf9908b: 8258937: Remove JVM IgnoreRewrites flag
  • 4d3d599: 8259223: Simplify boolean expression in the SunJSSE provider
  • 1b60acd: 8259252: Shenandoah: Shenandoah build failed on AArch64 after JDK-8258459
  • 7ddc2b5: 8258852: Arrays.asList() for single item could be replaced with List.of()
  • 85bac8c: 8259021: SharedSecrets should avoid double racy reads from non-volatile fields
  • d5aa49d: 8259236: C2 compilation fails with assert(is_power_of_2(value)) failed: value must be a power of 2: 8000000000000000
  • 82bdbfd: 8258857: Zero: non-PCH release build fails after JDK-8258074
  • f4122d6: 8258896: Remove the JVM ForceFloatExceptions option
  • ... and 59 more: https://git.openjdk.java.net/jdk/compare/1594372c283f1734a23f7733046febc942a3325f...master

As there are no conflicts, your changes will automatically be rebased on top of these commits when integrating. If you prefer to avoid this automatic rebasing, please check the documentation for the /integrate command for further details.

As you do not have Committer status in this project an existing Committer must agree to sponsor your change. Possible candidates are the reviewers of this PR (@PaulSandoz, @nsjian) but any other Committer may sponsor as well.

➡️ To flag this PR as ready for integration with the above commit message, type /integrate in a new comment. (Afterwards, your sponsor types /sponsor in a new comment to perform the integration).

@openjdk openjdk bot added the ready Pull request is ready to be integrated label Jan 4, 2021
@XiaohongGong
Copy link
Contributor Author

Thank you for fixing this. So easy to get mixed up between TestNG and JUnit!

It's tempting to change the parameter names of the assert methods to be named expected and accepted, i'll consider doing that rather than impose that on you.

Hi @PaulSandoz, thanks so much for looking at this PR. And I'm so sorry that I forgot to update the copyright to the new year. I'v committed one more patch to fix them. Do you mind having a looking at it again? Many thanks!

Copy link

@nsjian nsjian left a comment

Choose a reason for hiding this comment

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

Looks good to me.

@PaulSandoz
Copy link
Member

Thank you for fixing this. So easy to get mixed up between TestNG and JUnit!
It's tempting to change the parameter names of the assert methods to be named expected and accepted, i'll consider doing that rather than impose that on you.

Hi @PaulSandoz, thanks so much for looking at this PR. And I'm so sorry that I forgot to update the copyright to the new year. I'v committed one more patch to fix them. Do you mind having a looking at it again? Many thanks!

Copyright changes look good.

@XiaohongGong
Copy link
Contributor Author

/integrate

@openjdk openjdk bot added the sponsor Pull request is ready to be sponsored label Jan 6, 2021
@openjdk
Copy link

openjdk bot commented Jan 6, 2021

@XiaohongGong
Your change (at version 71190c9) is now ready to be sponsored by a Committer.

@nsjian
Copy link

nsjian commented Jan 6, 2021

/sponsor

@openjdk openjdk bot closed this Jan 6, 2021
@openjdk openjdk bot added integrated Pull request has been integrated and removed sponsor Pull request is ready to be sponsored ready Pull request is ready to be integrated rfr Pull request is ready for review labels Jan 6, 2021
@openjdk
Copy link

openjdk bot commented Jan 6, 2021

@nsjian @XiaohongGong Since your change was applied there have been 69 commits pushed to the master branch:

  • 8b45497: 8259037: livenmethods cannot find hsdis library
  • 7d76966: 8255757: Javac emits duplicate pool entries on array::clone
  • cf9908b: 8258937: Remove JVM IgnoreRewrites flag
  • 4d3d599: 8259223: Simplify boolean expression in the SunJSSE provider
  • 1b60acd: 8259252: Shenandoah: Shenandoah build failed on AArch64 after JDK-8258459
  • 7ddc2b5: 8258852: Arrays.asList() for single item could be replaced with List.of()
  • 85bac8c: 8259021: SharedSecrets should avoid double racy reads from non-volatile fields
  • d5aa49d: 8259236: C2 compilation fails with assert(is_power_of_2(value)) failed: value must be a power of 2: 8000000000000000
  • 82bdbfd: 8258857: Zero: non-PCH release build fails after JDK-8258074
  • f4122d6: 8258896: Remove the JVM ForceFloatExceptions option
  • ... and 59 more: https://git.openjdk.java.net/jdk/compare/1594372c283f1734a23f7733046febc942a3325f...master

Your commit was automatically rebased without conflicts.

Pushed as commit 52d3fee.

💡 You may see a message that your pull request was closed with unmerged commits. This can be safely ignored.

@XiaohongGong XiaohongGong deleted the JDK-8258813 branch January 6, 2021 01:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
hotspot-compiler hotspot-compiler-dev@openjdk.org integrated Pull request has been integrated
3 participants