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

Xiaohong Gong xgong at openjdk.java.net
Wed Jan 6 01:43:55 UTC 2021


On Mon, 4 Jan 2021 02:03:13 GMT, Xiaohong Gong <xgong at openjdk.org> wrote:

> 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.

This pull request has now been integrated.

Changeset: 52d3feec
Author:    Xiaohong Gong <xgong at openjdk.org>
Committer: Ningsheng Jian <njian at openjdk.org>
URL:       https://git.openjdk.java.net/jdk/commit/52d3feec
Stats:     7860 lines in 108 files changed: 0 ins; 682 del; 7178 mod

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

Reviewed-by: psandoz, njian

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

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


More information about the hotspot-compiler-dev mailing list