[PATCH v2] msvcrt/tests: Fix some test failures.

Zhiyi Zhang zzhang at codeweavers.com
Mon Jan 20 10:03:07 CST 2020



On 1/20/20 11:56 PM, Jeff Smith wrote:
> On Mon, Jan 20, 2020 at 8:59 AM Zhiyi Zhang <zzhang at codeweavers.com> wrote:
>> Signed-off-by: Zhiyi Zhang <zzhang at codeweavers.com>
>> ---
>> v2: Supersede 176772. Fix test failures like https://test.winehq.org/data/02f3a133b64ed1f979309e1399738eaa2e204651/xp_fg-winxp-lusr/msvcrt:string.html
>>
>>  dlls/msvcrt/tests/string.c | 6 +++---
>>  1 file changed, 3 insertions(+), 3 deletions(-)
>>
>> diff --git a/dlls/msvcrt/tests/string.c b/dlls/msvcrt/tests/string.c
>> index 440bed348a..da0400fa83 100644
>> --- a/dlls/msvcrt/tests/string.c
>> +++ b/dlls/msvcrt/tests/string.c
>> @@ -648,11 +648,11 @@ static void test_strcmp(void)
>>      ret = p_strncmp( "abc", "abcd", 3 );
>>      ok( ret == 0, "wrong ret %d\n", ret );
>>      ret = p_strncmp( "", "abc", 3 );
>> -    ok( ret == 0 - 'a', "wrong ret %d\n", ret );
>> +    ok( ret == 0 - 'a' || ret == -1, "wrong ret %d\n", ret );
>>      ret = p_strncmp( "abc", "ab\xa0", 4 );
>> -    ok( ret == 'c' - 0xa0, "wrong ret %d\n", ret );
>> +    ok( ret == 'c' - 0xa0 || ret == -1, "wrong ret %d\n", ret );
>>      ret = p_strncmp( "ab\xb0", "ab\xa0", 3 );
>> -    ok( ret == 0xb0 - 0xa0, "wrong ret %d\n", ret );
>> +    ok( ret == 0xb0 - 0xa0 || ret == 1, "wrong ret %d\n", ret );
>>      ret = p_strncmp( "ab\xb0", "ab\xa0", 2 );
>>      ok( ret == 0, "wrong ret %d\n", ret );
>>      ret = p_strncmp( "ab\xc2", "ab\xc2", 3 );
>> --
>> 2.20.1
> Hi Zhiyi,
>
> Wouldn't we still prefer the original value for Wine?
> In that case, the non-preferred value should be marked broken(...).
It's not exactly broken. According to the strncmp() spec, if the first string
is smaller than the second string, a value less than zero is return.
So -1 and 0 - 'a' are both valid. Same for others.

>
> Thanks,
> Jeff




More information about the wine-devel mailing list