[MSVCRT_WINETEST] Fixes for windows 2003

This commit is contained in:
Timo Kreuzer 2025-01-30 15:30:55 +02:00
parent 063c818c72
commit 748fdbcd6a
7 changed files with 48 additions and 13 deletions

View file

@ -1338,6 +1338,11 @@ static void test_demangle(void)
for (i = 0; i < ARRAY_SIZE(test); i++)
{
if (((i == 149) || (i == 150)) && (_winver < 0x600))
{
skip("Skipping test with i = %u, because it fails on Windows 2003\n", i);
continue;
}
name = p__unDName(0, test[i].in, 0, malloc, free, test[i].flags);
ok(name != NULL, "%u: unDName failed\n", i);
if (!name) continue;

View file

@ -233,12 +233,12 @@ static void test__wenviron(void)
wchar_t ***retptr = p__p___winitenv();
wchar_t *value;
ok( *retptr != NULL, "Expected *__p___winitenv() to be NULL\n" );
skip_2k3_fail ok( *retptr != NULL, "Expected *__p___winitenv() to be NULL\n" );
ok( *retptr != *p_wenviron,
"Expected _wenviron to be different from __p___winitenv() %p %p\n", *retptr, *p_wenviron );
/* test that w-initial env is derived from current _environ[] and not from ansi initial env */
value = env_get_valueW( *retptr, L"cat" );
ok( value && !wcscmp( value, L"dog" ),
skip_2k3_fail ok( value && !wcscmp( value, L"dog" ),
"Expecting initial env to be derived from current env (got %ls)\n", value );
}
_putenv("cat=");
@ -461,7 +461,7 @@ START_TEST(environ)
{
ok( getenv( "__winetest_dog" ) && !strcmp( getenv( "__winetest_dog" ), "bark" ),
"Couldn't find env var\n" );
ok( _wgetenv( L"__winetest_\u263a" ) && !wcscmp( _wgetenv( L"__winetest_\u263a" ), L"\u03b2" ),
skip_2k3_fail ok( _wgetenv( L"__winetest_\u263a" ) && !wcscmp( _wgetenv( L"__winetest_\u263a" ), L"\u03b2" ),
"Couldn't find unicode env var\n" );
return;
}

View file

@ -2099,9 +2099,11 @@ static void test_fopen_fclose_fcloseall( void )
ret = fclose(stream3);
ok(ret == EOF, "Closing file '%s' returned %d\n", fname3, ret);
ok(errno == 0xdeadbeef, "errno = %d\n", errno);
skip_2k3_crash {
ret = fclose(NULL);
ok(ret == EOF, "Closing NULL file returned %d\n", ret);
ok(errno == EINVAL, "errno = %d\n", errno);
}
/* testing fcloseall() */
numclosed = _fcloseall();
@ -3051,13 +3053,13 @@ static void test_ioinfo_flags(void)
info = &__pioinfo[tempfd / MSVCRT_FD_BLOCK_SIZE][tempfd % MSVCRT_FD_BLOCK_SIZE];
ok(!!info, "NULL info.\n");
ok(info->handle == handle, "Unexpected handle %p, expected %p.\n", info->handle, handle);
ok(info->exflag == (EF_UTF16 | EF_CRIT_INIT | EF_UNK_UNICODE), "Unexpected exflag %#x.\n", info->exflag);
skip_2k3_fail ok(info->exflag == (EF_UTF16 | EF_CRIT_INIT | EF_UNK_UNICODE), "Unexpected exflag %#x.\n", info->exflag);
ok(info->wxflag == (WX_TEXT | WX_OPEN), "Unexpected wxflag %#x.\n", info->wxflag);
close(tempfd);
ok(info->handle == INVALID_HANDLE_VALUE, "Unexpected handle %p.\n", info->handle);
ok(info->exflag == (EF_UTF16 | EF_CRIT_INIT | EF_UNK_UNICODE), "Unexpected exflag %#x.\n", info->exflag);
skip_2k3_fail ok(info->exflag == (EF_UTF16 | EF_CRIT_INIT | EF_UNK_UNICODE), "Unexpected exflag %#x.\n", info->exflag);
ok(!info->wxflag, "Unexpected wxflag %#x.\n", info->wxflag);
info = &__pioinfo[(tempfd + 4) / MSVCRT_FD_BLOCK_SIZE][(tempfd + 4) % MSVCRT_FD_BLOCK_SIZE];

View file

@ -723,6 +723,11 @@ static void test_xcvt(void)
ok( decpt == test_cvt_testcases[i].expdecpt_e,
"%d) _ecvt() decimal point wrong, got %d expected %d\n", i, decpt,
test_cvt_testcases[i].expdecpt_e);
if (((i == 10) || (i == 11) || (i == 12)) && (_winver < 0x600))
{
skip("broken on win 2003\n");
continue;
}
ok( sign == test_cvt_testcases[i].expsign,
"%d) _ecvt() sign wrong, got %d expected %d\n", i, sign,
test_cvt_testcases[i].expsign);
@ -739,6 +744,11 @@ static void test_xcvt(void)
ok( decpt == test_cvt_testcases[i].expdecpt_f,
"%d) _fcvt() decimal point wrong, got %d expected %d\n", i, decpt,
test_cvt_testcases[i].expdecpt_f);
if (((i == 10) || (i == 11) || (i == 12)) && (_winver < 0x600))
{
skip("broken on win 2003\n");
continue;
}
ok( sign == test_cvt_testcases[i].expsign,
"%d) _fcvt() sign wrong, got %d expected %d\n", i, sign,
test_cvt_testcases[i].expsign);

View file

@ -67,10 +67,10 @@ static void test___pxcptinfoptrs(void)
signal(SIGABRT, sighandler);
res = raise(SIGABRT);
ok(res == 0, "failed to raise SIGBREAK\n");
skip_2k3_fail ok(res == 0, "failed to raise SIGBREAK\n");
ok(*ret == (void*)0xdeadbeef, "*ret = %p\n", *ret);
ok(test_value == 2, "test_value = %d\n", test_value);
skip_2k3_fail ok(test_value == 2, "test_value = %d\n", test_value);
}
START_TEST(signal)

View file

@ -338,7 +338,7 @@ static void test_mbcp(void)
expect_eq(_ismbstrail(mbsonlylead, &mbsonlylead[5]), FALSE, int, "%d");
/* _mbsbtype */
expect_eq(_mbsbtype(NULL, 0), _MBC_ILLEGAL, int, "%d");
skip_2k3_crash expect_eq(_mbsbtype(NULL, 0), _MBC_ILLEGAL, int, "%d");
expect_eq(_mbsbtype(mbstring, 0), _MBC_LEAD, int, "%d");
expect_eq(_mbsbtype(mbstring, 1), _MBC_TRAIL, int, "%d");
expect_eq(_mbsbtype(mbstring, 2), _MBC_LEAD, int, "%d");
@ -465,6 +465,7 @@ static void test_mbcp(void)
expect_bin(buf, "\x00\xff", 2);
}
skip_2k3_crash {
errno = 0xdeadbeef;
ret = _mbsncpy(NULL, mbstring, 1);
ok(ret == NULL, "_mbsncpy returned %p, expected NULL\n", ret);
@ -476,6 +477,7 @@ static void test_mbcp(void)
ok(ret == NULL, "_mbsncpy returned %p, expected NULL\n", ret);
ok(errno == EINVAL, "_mbsncpy returned %d\n", errno);
expect_bin(buf, "\xff\xff\xff", 3);
}
errno = 0xdeadbeef;
ret = _mbsncpy(NULL, mbstring, 0);
@ -488,6 +490,7 @@ static void test_mbcp(void)
ok(ret == buf, "_mbsncpy returned %p, expected %sp\n", ret, buf);
ok(errno == 0xdeadbeef, "_mbsncpy should not change errno\n");
skip_2k3_crash {
memset(buf, 0xff, sizeof(buf));
errno = 0xdeadbeef;
ret = _mbsncpy(NULL, mbstring, 1);
@ -499,6 +502,7 @@ static void test_mbcp(void)
ret = _mbsncpy(buf, NULL, 1);
ok(ret == NULL, "_mbsncpy returned %p, expected NULL\n", ret);
ok(errno == EINVAL, "_mbsncpy returned %d\n", errno);
}
memset(buf, 0xff, sizeof(buf));
ret = _mbsncpy(NULL, mbstring, 0);
@ -724,6 +728,7 @@ static void test_strcmp(void)
ret = p_strncmp( "abc", "abcd", 3 );
ok( ret == 0, "wrong ret %d\n", ret );
skip_2k3_fail {
#ifdef _WIN64
ret = p_strncmp( "", "abc", 3 );
ok( ret == -1, "wrong ret %d\n", ret );
@ -739,6 +744,7 @@ static void test_strcmp(void)
ret = p_strncmp( "ab\xb0", "ab\xa0", 3 );
ok( ret == 0xb0 - 0xa0, "wrong ret %d\n", ret );
#endif
}
ret = p_strncmp( "ab\xb0", "ab\xa0", 2 );
ok( ret == 0, "wrong ret %d\n", ret );
ret = p_strncmp( "ab\xc2", "ab\xc2", 3 );
@ -3389,6 +3395,7 @@ static void test_tolower(void)
ret = p_tolower((unsigned char)0xD0);
ok(ret == 0xF0, "ret = %x\n", ret);
skip_2k3_fail {
ok(setlocale(LC_ALL, "Japanese_Japan.932") != NULL, "setlocale failed.\n");
errno = 0xdeadbeef;
ret = p_tolower((signed char)0xd0);
@ -3428,6 +3435,7 @@ static void test_tolower(void)
ret = p_tolower(0xd0);
ok(ret == 0xd0, "Got %#x.\n", ret);
ok(errno == 0xdeadbeef, "Got errno %d.\n", errno);
}
setlocale(LC_ALL, "C");
}
@ -3578,7 +3586,7 @@ static void test__stricmp(void)
ret = _stricmp("abc\xa5\xa1", "abc");
ok(ret > 0, "_stricmp returned %d\n", ret);
ok(setlocale(LC_ALL, "Japanese_Japan.932") != NULL, "setlocale failed.\n");
skip_2k3_fail ok(setlocale(LC_ALL, "Japanese_Japan.932") != NULL, "setlocale failed.\n");
ret = _stricmp("test", "test");
ok(ret == 0, "_stricmp returned %d\n", ret);
ret = _stricmp("a", "z");
@ -3647,6 +3655,11 @@ static void test__wcstoi64(void)
for (i = 0; i < ARRAY_SIZE(tests); i++)
{
if ((i == 20) && (_winver < 0x600))
{
skip("Skipping test with i = 20, because it fails on Windows 2003\n");
continue;
}
res = p_wcstoi64( tests[i].str, &endpos, tests[i].base );
ok( res == tests[i].res, "%u: %s res %s\n",
i, wine_dbgstr_w(tests[i].str), wine_dbgstr_longlong(res) );
@ -4867,7 +4880,7 @@ static void test_mbsrev(void)
strcpy((char *)buf, "\x36\x8c");
ret = _mbsrev(buf);
ok(ret == buf, "ret = %p, expected %p\n", ret, buf);
ok(!memcmp(buf, "\x36", 2), "buf = %s\n", wine_dbgstr_a((char *)buf));
skip_2k3_fail ok(!memcmp(buf, "\x36", 2), "buf = %s\n", wine_dbgstr_a((char *)buf));
_setmbcp(cp);
}
@ -4985,7 +4998,7 @@ static void test_toupper(void)
errno = 0xdeadbeef;
ret = p_toupper((signed char)0xf0);
ok(ret == 0xd0, "Got %#x.\n", ret);
ok(errno == EILSEQ, "Got errno %d.\n", errno);
skip_2k3_fail ok(errno == EILSEQ, "Got errno %d.\n", errno);
errno = 0xdeadbeef;
ret = p_toupper(0xf0);
ok(ret == 0xd0, "Got %#x.\n", ret);
@ -4995,12 +5008,13 @@ static void test_toupper(void)
errno = 0xdeadbeef;
ret = p_toupper((signed char)0xa5);
ok(ret == 0xa5, "Got %#x.\n", ret);
ok(errno == EILSEQ, "Got errno %d.\n", errno);
skip_2k3_fail ok(errno == EILSEQ, "Got errno %d.\n", errno);
errno = 0xdeadbeef;
ret = p_toupper((signed char)0xb9);
ok(ret == 0xa5, "Got %#x.\n", ret);
ok(errno == EILSEQ, "Got errno %d.\n", errno);
skip_2k3_fail ok(errno == EILSEQ, "Got errno %d.\n", errno);
skip_2k3_fail {
ok(setlocale(LC_ALL, "Japanese_Japan.932") != NULL, "setlocale failed.\n");
errno = 0xdeadbeef;
ret = p_toupper((signed char)0xf0);
@ -5020,6 +5034,7 @@ static void test_toupper(void)
ret = p_toupper(0xf0);
ok(ret == 0xf0, "Got %#x.\n", ret);
ok(errno == 0xdeadbeef, "Got errno %d.\n", errno);
}
setlocale(LC_ALL, "C");
}

View file

@ -187,6 +187,9 @@ extern void winetest_pop_context(void);
winetest_loop_nocount(); \
winetest_end_nocount())
#define skip_2k3_crash if (_winver < 0x600) skip("Test skipped, because it crashes on win 2003\n"); else
#define skip_2k3_fail if (_winver < 0x600) skip("Test skipped, because it fails on win 2003\n"); else
#define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0]))
#ifdef NONAMELESSUNION