mirror of
https://github.com/reactos/reactos.git
synced 2025-08-02 01:03:08 +00:00
[MSVCRT_WINETEST] Sync with Wine Staging 3.3. CORE-14434
This commit is contained in:
parent
3479eb396c
commit
1c9ac7a2d2
15 changed files with 325 additions and 25 deletions
|
@ -16,8 +16,9 @@
|
|||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
*/
|
||||
|
||||
#include "precomp.h"
|
||||
#include "wine/test.h"
|
||||
#include "winbase.h"
|
||||
#include "winnt.h"
|
||||
|
||||
typedef void (*vtable_ptr)(void);
|
||||
|
||||
|
|
|
@ -18,8 +18,18 @@
|
|||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
*/
|
||||
|
||||
#include "precomp.h"
|
||||
|
||||
#include "wine/test.h"
|
||||
#include <stdarg.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <fcntl.h>
|
||||
#include <sys/stat.h>
|
||||
#include <io.h>
|
||||
#include <windef.h>
|
||||
#include <winbase.h>
|
||||
#include <winnls.h>
|
||||
#include <process.h>
|
||||
#include <errno.h>
|
||||
#include <direct.h>
|
||||
|
||||
void __cdecl __getmainargs(int *, char ***, char ***, int, int *);
|
||||
|
|
|
@ -18,12 +18,25 @@
|
|||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
*/
|
||||
|
||||
#include "precomp.h"
|
||||
|
||||
#include "wine/test.h"
|
||||
#include <stdarg.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <fcntl.h>
|
||||
#include <direct.h>
|
||||
#include <sys/stat.h>
|
||||
#include <io.h>
|
||||
#include <mbctype.h>
|
||||
#include <windef.h>
|
||||
#include <winbase.h>
|
||||
#include <winnls.h>
|
||||
#include <process.h>
|
||||
#include <errno.h>
|
||||
|
||||
static int (__cdecl *p_makepath_s)(char *, size_t, const char *, const char *, const char *, const char *);
|
||||
static int (__cdecl *p_wmakepath_s)(wchar_t *, size_t, const wchar_t *,const wchar_t *, const wchar_t *, const wchar_t *);
|
||||
static int (__cdecl *p_searchenv_s)(const char*, const char*, char*, size_t);
|
||||
static int (__cdecl *p_wsearchenv_s)(const wchar_t*, const wchar_t*, wchar_t*, size_t);
|
||||
|
||||
static void init(void)
|
||||
{
|
||||
|
@ -31,6 +44,8 @@ static void init(void)
|
|||
|
||||
p_makepath_s = (void *)GetProcAddress(hmod, "_makepath_s");
|
||||
p_wmakepath_s = (void *)GetProcAddress(hmod, "_wmakepath_s");
|
||||
p_searchenv_s = (void *)GetProcAddress(hmod, "_searchenv_s");
|
||||
p_wsearchenv_s = (void *)GetProcAddress(hmod, "_wsearchenv_s");
|
||||
}
|
||||
|
||||
typedef struct
|
||||
|
@ -406,6 +421,195 @@ static void test_splitpath(void)
|
|||
_setmbcp(prev_cp);
|
||||
}
|
||||
|
||||
static void test_searchenv(void)
|
||||
{
|
||||
const char *dirs[] = {
|
||||
"\\search_env_test",
|
||||
"\\search_env_test\\dir1",
|
||||
"\\search_env_test\\dir2",
|
||||
"\\search_env_test\\dir3longer"
|
||||
};
|
||||
|
||||
const char *files[] = {
|
||||
"\\search_env_test\\dir1\\1.dat",
|
||||
"\\search_env_test\\dir1\\2.dat",
|
||||
"\\search_env_test\\dir2\\1.dat",
|
||||
"\\search_env_test\\dir2\\3.dat",
|
||||
"\\search_env_test\\dir3longer\\3.dat"
|
||||
};
|
||||
|
||||
const WCHAR env_w[] = {'T','E','S','T','_','P','A','T','H',0};
|
||||
const WCHAR dat1_w[] = {'1','.','d','a','t',0};
|
||||
const WCHAR dat3_w[] = {'3','.','d','a','t',0};
|
||||
|
||||
char env1[4*MAX_PATH], env2[4*MAX_PATH], tmppath[MAX_PATH], path[2*MAX_PATH];
|
||||
char result[MAX_PATH], exp[2*MAX_PATH];
|
||||
WCHAR result_w[MAX_PATH];
|
||||
int i, path_len;
|
||||
FILE *tmp_file;
|
||||
|
||||
if (getenv("TEST_PATH")) {
|
||||
skip("TEST_PATH environment variable already set\n");
|
||||
return;
|
||||
}
|
||||
|
||||
path_len = GetTempPathA(MAX_PATH, tmppath);
|
||||
ok(path_len, "GetTempPath failed\n");
|
||||
memcpy(path, tmppath, path_len);
|
||||
|
||||
for(i=0; i<sizeof(dirs)/sizeof(*dirs); i++) {
|
||||
strcpy(path+path_len, dirs[i]);
|
||||
ok(!mkdir(path), "mkdir failed (dir = %s)\n", path);
|
||||
}
|
||||
|
||||
for(i=0; i<sizeof(files)/sizeof(*files); i++) {
|
||||
strcpy(path+path_len, files[i]);
|
||||
tmp_file = fopen(path, "wb");
|
||||
ok(tmp_file != NULL, "fopen failed (file = %s)\n", path);
|
||||
fclose(tmp_file);
|
||||
}
|
||||
|
||||
strcpy(env1, "TEST_PATH=");
|
||||
strcpy(env2, "TEST_PATH=;");
|
||||
for(i=1; i<sizeof(dirs)/sizeof(*dirs); i++) {
|
||||
strcat(env1, tmppath);
|
||||
strcat(env1, dirs[i]);
|
||||
strcat(env1, ";");
|
||||
|
||||
strcat(env2, tmppath);
|
||||
strcat(env2, dirs[i]);
|
||||
strcat(env2, ";;");
|
||||
}
|
||||
|
||||
if (!p_searchenv_s || !p_wsearchenv_s)
|
||||
win_skip("searchenv_s or wsearchenv_s function is not available\n");
|
||||
|
||||
putenv(env1);
|
||||
memset(result, 'x', sizeof(result));
|
||||
_searchenv("fail", "TEST_PATH", result);
|
||||
ok(!result[0], "got %s, expected ''\n", result);
|
||||
|
||||
if (p_searchenv_s) {
|
||||
memset(result, 'x', sizeof(result));
|
||||
i = p_searchenv_s("fail", "TEST_PATH", result, MAX_PATH);
|
||||
ok(i == ENOENT, "searchenv_s returned %d\n", i);
|
||||
ok(!result[0], "got %s, expected ''\n", result);
|
||||
}
|
||||
|
||||
memset(result, 'x', sizeof(result));
|
||||
strcpy(exp, tmppath);
|
||||
strcat(exp, files[0]);
|
||||
_searchenv("1.dat", "TEST_PATH", result);
|
||||
ok(!strcmp(result, exp), "got %s, expected '%s'\n", result, exp);
|
||||
|
||||
if (p_searchenv_s) {
|
||||
memset(result, 'x', sizeof(result));
|
||||
i = p_searchenv_s("1.dat", "TEST_PATH", result, MAX_PATH);
|
||||
ok(!i, "searchenv_s returned %d\n", i);
|
||||
ok(!strcmp(result, exp), "got %s, expected '%s'\n", result, exp);
|
||||
}
|
||||
|
||||
memset(result_w, 'x', sizeof(result_w));
|
||||
_wsearchenv(dat1_w, env_w, result_w);
|
||||
WideCharToMultiByte(CP_ACP, 0, result_w, -1, result, MAX_PATH, NULL, NULL);
|
||||
ok(!strcmp(result, exp), "got %s, expected '%s'\n", result, exp);
|
||||
|
||||
if (p_wsearchenv_s) {
|
||||
memset(result_w, 'x', sizeof(result_w));
|
||||
i = p_wsearchenv_s(dat1_w, env_w, result_w, MAX_PATH);
|
||||
ok(!i, "wsearchenv_s returned %d\n", i);
|
||||
ok(!strcmp(result, exp), "got %s, expected '%s'\n", result, exp);
|
||||
}
|
||||
|
||||
memset(result, 'x', sizeof(result));
|
||||
strcpy(exp, tmppath);
|
||||
strcat(exp, files[3]);
|
||||
_searchenv("3.dat", "TEST_PATH", result);
|
||||
ok(!strcmp(result, exp), "got %s, expected '%s'\n", result, exp);
|
||||
|
||||
if (p_searchenv_s) {
|
||||
memset(result, 'x', sizeof(result));
|
||||
i = p_searchenv_s("3.dat", "TEST_PATH", result, MAX_PATH);
|
||||
ok(!i, "searchenv_s returned %d\n", i);
|
||||
ok(!strcmp(result, exp), "got %s, expected '%s'\n", result, exp);
|
||||
}
|
||||
|
||||
memset(result_w, 'x', sizeof(result_w));
|
||||
_wsearchenv(dat3_w, env_w, result_w);
|
||||
WideCharToMultiByte(CP_ACP, 0, result_w, -1, result, MAX_PATH, NULL, NULL);
|
||||
ok(!strcmp(result, exp), "got %s, expected '%s'\n", result, exp);
|
||||
|
||||
if (p_wsearchenv_s) {
|
||||
memset(result_w, 'x', sizeof(result_w));
|
||||
i = p_wsearchenv_s(dat3_w, env_w, result_w, MAX_PATH);
|
||||
ok(!i, "wsearchenv_s returned %d\n", i);
|
||||
ok(!strcmp(result, exp), "got %s, expected '%s'\n", result, exp);
|
||||
}
|
||||
|
||||
putenv(env2);
|
||||
memset(result, 'x', sizeof(result));
|
||||
strcpy(exp, tmppath);
|
||||
strcat(exp, files[0]);
|
||||
_searchenv("1.dat", "TEST_PATH", result);
|
||||
ok(!strcmp(result, exp), "got %s, expected '%s'\n", result, exp);
|
||||
|
||||
if (p_searchenv_s) {
|
||||
memset(result, 'x', sizeof(result));
|
||||
i = p_searchenv_s("1.dat", "TEST_PATH", result, MAX_PATH);
|
||||
ok(!i, "searchenv_s returned %d\n", i);
|
||||
ok(!strcmp(result, exp), "got %s, expected '%s'\n", result, exp);
|
||||
}
|
||||
|
||||
memset(result_w, 'x', sizeof(result_w));
|
||||
_wsearchenv(dat1_w, env_w, result_w);
|
||||
WideCharToMultiByte(CP_ACP, 0, result_w, -1, result, MAX_PATH, NULL, NULL);
|
||||
ok(!strcmp(result, exp), "got %s, expected '%s'\n", result, exp);
|
||||
|
||||
if (p_wsearchenv_s) {
|
||||
memset(result_w, 'x', sizeof(result_w));
|
||||
i = p_wsearchenv_s(dat1_w, env_w, result_w, MAX_PATH);
|
||||
ok(!i, "wsearchenv_s returned %d\n", i);
|
||||
ok(!strcmp(result, exp), "got %s, expected '%s'\n", result, exp);
|
||||
}
|
||||
|
||||
memset(result, 'x', sizeof(result));
|
||||
strcpy(exp, tmppath);
|
||||
strcat(exp, files[3]);
|
||||
_searchenv("3.dat", "TEST_PATH", result);
|
||||
ok(!strcmp(result, exp), "got %s, expected '%s'\n", result, exp);
|
||||
|
||||
if (p_searchenv_s) {
|
||||
memset(result, 'x', sizeof(result));
|
||||
i = p_searchenv_s("3.dat", "TEST_PATH", result, MAX_PATH);
|
||||
ok(!i, "searchenv_s returned %d\n", i);
|
||||
ok(!strcmp(result, exp), "got %s, expected '%s'\n", result, exp);
|
||||
}
|
||||
|
||||
memset(result_w, 'x', sizeof(result_w));
|
||||
_wsearchenv(dat3_w, env_w, result_w);
|
||||
WideCharToMultiByte(CP_ACP, 0, result_w, -1, result, MAX_PATH, NULL, NULL);
|
||||
ok(!strcmp(result, exp), "got %s, expected '%s'\n", result, exp);
|
||||
|
||||
if (p_wsearchenv_s) {
|
||||
memset(result_w, 'x', sizeof(result_w));
|
||||
i = p_wsearchenv_s(dat3_w, env_w, result_w, MAX_PATH);
|
||||
ok(!i, "wsearchenv_s returned %d\n", i);
|
||||
ok(!strcmp(result, exp), "got %s, expected '%s'\n", result, exp);
|
||||
}
|
||||
|
||||
putenv("TEST_PATH=");
|
||||
|
||||
for(i=sizeof(files)/sizeof(*files)-1; i>=0; i--) {
|
||||
strcpy(path+path_len, files[i]);
|
||||
ok(!remove(path), "remove failed (file = %s)\n", path);
|
||||
}
|
||||
|
||||
for(i=sizeof(dirs)/sizeof(*dirs)-1; i>=0; i--) {
|
||||
strcpy(path+path_len, dirs[i]);
|
||||
ok(!rmdir(path), "rmdir failed (dir = %s)\n", path);
|
||||
}
|
||||
}
|
||||
|
||||
START_TEST(dir)
|
||||
{
|
||||
init();
|
||||
|
@ -414,4 +618,5 @@ START_TEST(dir)
|
|||
test_makepath();
|
||||
test_makepath_s();
|
||||
test_splitpath();
|
||||
test_searchenv();
|
||||
}
|
||||
|
|
|
@ -18,7 +18,8 @@
|
|||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
*/
|
||||
|
||||
#include "precomp.h"
|
||||
#include "wine/test.h"
|
||||
#include <stdlib.h>
|
||||
|
||||
static const char *a_very_long_env_string =
|
||||
"LIBRARY_PATH="
|
||||
|
|
|
@ -19,13 +19,22 @@
|
|||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
*/
|
||||
|
||||
#include "precomp.h"
|
||||
|
||||
#include <winreg.h>
|
||||
#include "wine/test.h"
|
||||
#include <stdarg.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <fcntl.h>
|
||||
#include <share.h>
|
||||
#include <sys/stat.h>
|
||||
#include <io.h>
|
||||
#include <direct.h>
|
||||
#include <windef.h>
|
||||
#include <winbase.h>
|
||||
#include <winnls.h>
|
||||
#include <winreg.h>
|
||||
#include <process.h>
|
||||
#include <errno.h>
|
||||
#include <locale.h>
|
||||
|
||||
#define MSVCRT_FD_BLOCK_SIZE 32
|
||||
typedef struct {
|
||||
|
|
|
@ -20,7 +20,39 @@
|
|||
* symbols defined in msvcrt.h (prefixed by MSVCRT_).
|
||||
*/
|
||||
|
||||
#include "precomp.h"
|
||||
#include "dos.h"
|
||||
#include "math.h"
|
||||
#include "stdlib.h"
|
||||
#include "io.h"
|
||||
#include "errno.h"
|
||||
#include "fcntl.h"
|
||||
#include "malloc.h"
|
||||
#include "limits.h"
|
||||
#include "mbctype.h"
|
||||
#include "stdio.h"
|
||||
#include "wchar.h"
|
||||
#include "ctype.h"
|
||||
#include "crtdbg.h"
|
||||
#include "share.h"
|
||||
#include "search.h"
|
||||
#include "wctype.h"
|
||||
#include "float.h"
|
||||
#include "stddef.h"
|
||||
#include "mbstring.h"
|
||||
#include "sys/locking.h"
|
||||
#include "sys/utime.h"
|
||||
#include "sys/types.h"
|
||||
#include "sys/stat.h"
|
||||
#include "sys/timeb.h"
|
||||
#include "direct.h"
|
||||
#include "conio.h"
|
||||
#include "process.h"
|
||||
#include "string.h"
|
||||
#include "signal.h"
|
||||
#include "time.h"
|
||||
#include "locale.h"
|
||||
#include "setjmp.h"
|
||||
#include "wine/test.h"
|
||||
|
||||
#ifdef __WINE_USE_MSVCRT
|
||||
/* Wine-specific msvcrt headers */
|
||||
|
|
|
@ -18,9 +18,10 @@
|
|||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
*/
|
||||
|
||||
#include "precomp.h"
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <malloc.h>
|
||||
#include <errno.h>
|
||||
#include "wine/test.h"
|
||||
|
||||
static void (__cdecl *p_aligned_free)(void*) = NULL;
|
||||
static void * (__cdecl *p_aligned_malloc)(size_t,size_t) = NULL;
|
||||
|
|
|
@ -18,7 +18,10 @@
|
|||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
*/
|
||||
|
||||
#include "precomp.h"
|
||||
#include <locale.h>
|
||||
|
||||
#include "wine/test.h"
|
||||
#include "winnls.h"
|
||||
|
||||
static BOOL (__cdecl *p__crtGetStringTypeW)(DWORD, DWORD, const wchar_t*, int, WORD*);
|
||||
static int (__cdecl *pmemcpy_s)(void *, size_t, void*, size_t);
|
||||
|
|
|
@ -18,15 +18,21 @@
|
|||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
*/
|
||||
|
||||
#include "precomp.h"
|
||||
|
||||
#include <msvcrt.h>
|
||||
#include "wine/test.h"
|
||||
#include <errno.h>
|
||||
#include <stdio.h>
|
||||
#include <math.h>
|
||||
#include "msvcrt.h"
|
||||
#include <process.h>
|
||||
|
||||
static inline float __port_infinity(void)
|
||||
{
|
||||
static const unsigned __inf_bytes = 0x7f800000;
|
||||
return *(const float *)&__inf_bytes;
|
||||
}
|
||||
#ifdef __REACTOS__
|
||||
#undef INFINITY
|
||||
#endif
|
||||
#define INFINITY __port_infinity()
|
||||
|
||||
static inline float __port_nan(void)
|
||||
|
@ -34,6 +40,9 @@ static inline float __port_nan(void)
|
|||
static const unsigned __nan_bytes = 0x7fc00000;
|
||||
return *(const float *)&__nan_bytes;
|
||||
}
|
||||
#ifdef __REACTOS__
|
||||
#undef NAN
|
||||
#endif
|
||||
#define NAN __port_nan()
|
||||
|
||||
static inline BOOL almost_equal(double d1, double d2) {
|
||||
|
|
|
@ -1,9 +1,11 @@
|
|||
|
||||
#ifndef _MSVCRT_WINETEST_PRECOMP_H_
|
||||
#define _MSVCRT_WINETEST_PRECOMP_H_
|
||||
|
||||
#define WIN32_NO_STATUS
|
||||
#define _INC_WINDOWS
|
||||
#define COM_NO_WINDOWS_H
|
||||
|
||||
#define _CRT_NON_CONFORMING_SWPRINTFS
|
||||
|
||||
#include <wine/test.h>
|
||||
|
|
|
@ -23,8 +23,17 @@
|
|||
/* With Visual Studio >= 2005, swprintf() takes an extra parameter unless
|
||||
* the following macro is defined.
|
||||
*/
|
||||
#define _CRT_NON_CONFORMING_SWPRINTFS
|
||||
|
||||
#include <stdio.h>
|
||||
#include <errno.h>
|
||||
#include <locale.h>
|
||||
|
||||
#include "precomp.h"
|
||||
#include "windef.h"
|
||||
#include "winbase.h"
|
||||
#include "winnls.h"
|
||||
|
||||
#include "wine/test.h"
|
||||
|
||||
static inline float __port_infinity(void)
|
||||
{
|
||||
|
|
|
@ -18,7 +18,9 @@
|
|||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
*/
|
||||
|
||||
#include "precomp.h"
|
||||
#include <stdio.h>
|
||||
|
||||
#include "wine/test.h"
|
||||
|
||||
static void test_sscanf( void )
|
||||
{
|
||||
|
|
|
@ -18,8 +18,8 @@
|
|||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
*/
|
||||
|
||||
#include "precomp.h"
|
||||
|
||||
#include "wine/test.h"
|
||||
#include <winbase.h>
|
||||
#include <signal.h>
|
||||
|
||||
static int test_value = 0;
|
||||
|
|
|
@ -18,13 +18,23 @@
|
|||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
*/
|
||||
|
||||
#include "precomp.h"
|
||||
|
||||
#include "wine/test.h"
|
||||
#include <string.h>
|
||||
#include <mbstring.h>
|
||||
#include <wchar.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <mbctype.h>
|
||||
#include <locale.h>
|
||||
#include <errno.h>
|
||||
#include <limits.h>
|
||||
#include <math.h>
|
||||
|
||||
/* make it use a definition from string.h */
|
||||
#undef strncpy
|
||||
#include "winbase.h"
|
||||
#include "winnls.h"
|
||||
|
||||
static char *buf_to_string(const unsigned char *bin, int len, int nr)
|
||||
{
|
||||
static char buf[2][1024];
|
||||
|
|
|
@ -18,9 +18,15 @@
|
|||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
*/
|
||||
|
||||
#include "precomp.h"
|
||||
#include "wine/test.h"
|
||||
#include "winbase.h"
|
||||
#include "winnls.h"
|
||||
#include "time.h"
|
||||
|
||||
#include <time.h>
|
||||
#include <stdlib.h> /*setenv*/
|
||||
#include <stdio.h> /*printf*/
|
||||
#include <locale.h>
|
||||
#include <errno.h>
|
||||
|
||||
#define _MAX__TIME64_T (((__time64_t)0x00000007 << 32) | 0x93406FFF)
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue