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

Xiaohong Gong xgong at openjdk.java.net
Tue Jan 5 03:12:15 UTC 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.

Xiaohong Gong has updated the pull request incrementally with one additional commit since the last revision:

  Update copyright year to 2021

-------------

Changes:
  - all: https://git.openjdk.java.net/jdk/pull/1922/files
  - new: https://git.openjdk.java.net/jdk/pull/1922/files/c3fb2986..71190c9f

Webrevs:
 - full: https://webrevs.openjdk.java.net/?repo=jdk&pr=1922&range=01
 - incr: https://webrevs.openjdk.java.net/?repo=jdk&pr=1922&range=00-01

  Stats: 64 lines in 64 files changed: 0 ins; 0 del; 64 mod
  Patch: https://git.openjdk.java.net/jdk/pull/1922.diff
  Fetch: git fetch https://git.openjdk.java.net/jdk pull/1922/head:pull/1922

PR: https://git.openjdk.java.net/jdk/pull/1922


More information about the hotspot-compiler-dev mailing list