RFR: 8258813: [TESTBUG] Fix incorrect Vector API test output message [v2]
Ningsheng Jian
njian at openjdk.java.net
Tue Jan 5 08:21:13 UTC 2021
On Tue, 5 Jan 2021 03:12:15 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.
>
> Xiaohong Gong has updated the pull request incrementally with one additional commit since the last revision:
>
> Update copyright year to 2021
Looks good to me.
-------------
Marked as reviewed by njian (Committer).
PR: https://git.openjdk.java.net/jdk/pull/1922
More information about the hotspot-compiler-dev
mailing list