Author: jgardou
Date: Sat Jul 21 17:15:08 2012
New Revision: 56925
URL:
http://svn.reactos.org/svn/reactos?rev=56925&view=rev
Log:
[APITESTS]
- Move _vsnprintf to crt tests, where it belongs, and make it pass for crtdll
Added:
trunk/rostests/apitests/crt/_vsnprintf.c
- copied, changed from r56924, trunk/rostests/apitests/msvcrt/_vsnprintf.c
Removed:
trunk/rostests/apitests/msvcrt/_vsnprintf.c
Modified:
trunk/rostests/apitests/crt/crtdll_crt_apitest.cmake
trunk/rostests/apitests/crt/msvcrt_crt_apitest.cmake
trunk/rostests/apitests/crt/ntdll_crt_apitest.cmake
trunk/rostests/apitests/crt/testlist.c
trunk/rostests/apitests/msvcrt/CMakeLists.txt
trunk/rostests/apitests/msvcrt/testlist.c
Copied: trunk/rostests/apitests/crt/_vsnprintf.c (from r56924,
trunk/rostests/apitests/msvcrt/_vsnprintf.c)
URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/apitests/crt/_vsnprintf.c…
==============================================================================
--- trunk/rostests/apitests/msvcrt/_vsnprintf.c [iso-8859-1] (original)
+++ trunk/rostests/apitests/crt/_vsnprintf.c [iso-8859-1] Sat Jul 21 17:15:08 2012
@@ -4,11 +4,16 @@
* PURPOSE: Test for _vsnprintf
*/
+#define WIN32_NO_STATUS
+#include <stdio.h>
#include <wine/test.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <strings.h>
-#include <stdarg.h>
+#include <tchar.h>
+#include <pseh/pseh2.h>
+#include <ndk/mmfuncs.h>
+#include <ndk/rtlfuncs.h>
+
+#define StartSeh() ExceptionStatus = STATUS_SUCCESS; _SEH2_TRY {
+#define EndSeh(ExpectedStatus) } _SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER) {
ExceptionStatus = _SEH2_GetExceptionCode(); } _SEH2_END; ok(ExceptionStatus ==
ExpectedStatus, "Exception %lx, expected %lx\n", ExceptionStatus,
ExpectedStatus)
void call_varargs(char* buf, size_t buf_size, int expected_ret, LPCSTR formatString,
...)
{
@@ -23,10 +28,23 @@
START_TEST(_vsnprintf)
{
char buffer[255];
+ NTSTATUS ExceptionStatus;
/* Test basic functionality */
call_varargs(buffer, 255, 12, "%s world!", "hello");
/* This is how WINE implements _vcsprintf, and they are obviously wrong */
- call_varargs(NULL, INT_MAX, -1, "%s it really work?", "does");
+ StartSeh()
+ call_varargs(NULL, INT_MAX, -1, "%s it really work?",
"does");
+#if defined(TEST_CRTDLL) || defined(TEST_USER32)
+ EndSeh(STATUS_ACCESS_VIOLATION);
+#else
+ EndSeh(STATUS_SUCCESS);
+#endif
/* This one is no better */
- call_varargs(NULL, 0, -1, "%s it really work?", "does");
+ StartSeh()
+ call_varargs(NULL, 0, -1, "%s it really work?", "does");
+#if defined(TEST_CRTDLL) || defined(TEST_USER32)
+ EndSeh(STATUS_ACCESS_VIOLATION);
+#else
+ EndSeh(STATUS_SUCCESS);
+#endif
}
Modified: trunk/rostests/apitests/crt/crtdll_crt_apitest.cmake
URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/apitests/crt/crtdll_crt_a…
==============================================================================
--- trunk/rostests/apitests/crt/crtdll_crt_apitest.cmake [iso-8859-1] (original)
+++ trunk/rostests/apitests/crt/crtdll_crt_apitest.cmake [iso-8859-1] Sat Jul 21 17:15:08
2012
@@ -314,7 +314,7 @@
# _unlink.c
# _unloaddll.c
# _utime.c
-# _vsnprintf.c
+ _vsnprintf.c
# _vsnwprintf.c
# _wcsdup.c
# _wcsicmp.c
Modified: trunk/rostests/apitests/crt/msvcrt_crt_apitest.cmake
URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/apitests/crt/msvcrt_crt_a…
==============================================================================
--- trunk/rostests/apitests/crt/msvcrt_crt_apitest.cmake [iso-8859-1] (original)
+++ trunk/rostests/apitests/crt/msvcrt_crt_apitest.cmake [iso-8859-1] Sat Jul 21 17:15:08
2012
@@ -832,7 +832,7 @@
# _vscwprintf.c
# _vscwprintf_l
# _vscwprintf_p_l
-# _vsnprintf.c
+ _vsnprintf.c
# _vsnprintf_c.c _vsnprintf
# _vsnprintf_c_l.c _vsnprintf_l
# _vsnprintf_l.c
Modified: trunk/rostests/apitests/crt/ntdll_crt_apitest.cmake
URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/apitests/crt/ntdll_crt_ap…
==============================================================================
--- trunk/rostests/apitests/crt/ntdll_crt_apitest.cmake [iso-8859-1] (original)
+++ trunk/rostests/apitests/crt/ntdll_crt_apitest.cmake [iso-8859-1] Sat Jul 21 17:15:08
2012
@@ -34,7 +34,7 @@
# _ultoa.c
# _ultow.c
# _vscwprintf.c
-# _vsnprintf.c
+ _vsnprintf.c
# _vsnwprintf.c
# _wcsicmp.c
# _wcslwr.c
Modified: trunk/rostests/apitests/crt/testlist.c
URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/apitests/crt/testlist.c?r…
==============================================================================
--- trunk/rostests/apitests/crt/testlist.c [iso-8859-1] (original)
+++ trunk/rostests/apitests/crt/testlist.c [iso-8859-1] Sat Jul 21 17:15:08 2012
@@ -5,11 +5,13 @@
#define STANDALONE
#include "wine/test.h"
+extern void func__vsnprintf(void);
extern void func_sprintf(void);
extern void func_strcpy(void);
const struct test winetest_testlist[] =
{
+ { "_vsnprintf", func__vsnprintf },
{ "sprintf", func_sprintf },
{ "strcpy", func_strcpy },
#if defined(TEST_CRTDLL) || defined(TEST_MSVCRT) || defined(TEST_STATIC_CRT)
Modified: trunk/rostests/apitests/msvcrt/CMakeLists.txt
URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/apitests/msvcrt/CMakeList…
==============================================================================
--- trunk/rostests/apitests/msvcrt/CMakeLists.txt [iso-8859-1] (original)
+++ trunk/rostests/apitests/msvcrt/CMakeLists.txt [iso-8859-1] Sat Jul 21 17:15:08 2012
@@ -2,7 +2,6 @@
add_definitions(-D_DLL -D__USE_CRTIMP)
list(APPEND SOURCE
- _vsnprintf.c
ieee.c
splitpath.c
testlist.c)
Removed: trunk/rostests/apitests/msvcrt/_vsnprintf.c
URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/apitests/msvcrt/_vsnprint…
==============================================================================
--- trunk/rostests/apitests/msvcrt/_vsnprintf.c [iso-8859-1] (original)
+++ trunk/rostests/apitests/msvcrt/_vsnprintf.c (removed)
@@ -1,32 +1,0 @@
-/*
- * PROJECT: ReactOS api tests
- * LICENSE: GPL - See COPYING in the top level directory
- * PURPOSE: Test for _vsnprintf
- */
-
-#include <wine/test.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <strings.h>
-#include <stdarg.h>
-
-void call_varargs(char* buf, size_t buf_size, int expected_ret, LPCSTR formatString,
...)
-{
- va_list args;
- int ret;
- /* Test the basic functionality */
- va_start(args, formatString);
- ret = _vsnprintf(buf, 255, formatString, args);
- ok(expected_ret == ret, "Test failed: expected %i, got %i.\n",
expected_ret, ret);
-}
-
-START_TEST(_vsnprintf)
-{
- char buffer[255];
- /* Test basic functionality */
- call_varargs(buffer, 255, 12, "%s world!", "hello");
- /* This is how WINE implements _vcsprintf, and they are obviously wrong */
- call_varargs(NULL, INT_MAX, -1, "%s it really work?", "does");
- /* This one is no better */
- call_varargs(NULL, 0, -1, "%s it really work?", "does");
-}
Modified: trunk/rostests/apitests/msvcrt/testlist.c
URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/apitests/msvcrt/testlist.…
==============================================================================
--- trunk/rostests/apitests/msvcrt/testlist.c [iso-8859-1] (original)
+++ trunk/rostests/apitests/msvcrt/testlist.c [iso-8859-1] Sat Jul 21 17:15:08 2012
@@ -5,13 +5,11 @@
#define STANDALONE
#include "wine/test.h"
-extern void func__vsnprintf(void);
extern void func_ieee(void);
extern void func_splitpath(void);
const struct test winetest_testlist[] =
{
- { "_vsnprintf", func__vsnprintf},
{ "ieee", func_ieee },
{ "splitpath", func_splitpath },