extern void winetest_add_failures( LONG new_failures );
extern void winetest_wait_child_process( HANDLE process );
-extern const char *wine_dbgstr_wn( const WCHAR *str, int n );
+extern const char *wine_dbgstr_wn( const WCHAR *str, intptr_t n );
+extern const char *wine_dbgstr_guid( const GUID *guid );
static inline const char *wine_dbgstr_w( const WCHAR *s ) { return wine_dbgstr_wn( s, -1 ); }
/* strcmpW is available for tests compiled under Wine, but not in standalone
# define __winetest_va_end(list) va_end(list)
#endif
+/* Define WINETEST_MSVC_IDE_FORMATTING to alter the output format winetest will use for file/line numbers.
+ This alternate format makes the file/line numbers clickable in visual studio, to directly jump to them. */
+#if defined(WINETEST_MSVC_IDE_FORMATTING)
+# define __winetest_file_line_prefix "%s(%d)"
+#else
+# define __winetest_file_line_prefix "%s:%d"
+#endif
+
struct test
{
const char *name;
DWORD last_error;
last_error=GetLastError();
- data=TlsGetValue(tls_index);
+ data=(tls_data*)TlsGetValue(tls_index);
if (!data)
{
- data=HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(tls_data));
+ data=(tls_data*)HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(tls_data));
data->str_pos = data->strings;
TlsSetValue(tls_index,data);
}
void winetest_set_location( const char* file, int line )
{
tls_data* data=get_tls_data();
+#if defined(WINETEST_MSVC_IDE_FORMATTING)
+ data->current_file = file;
+#else
data->current_file=strrchr(file,'/');
if (data->current_file==NULL)
data->current_file=strrchr(file,'\\');
data->current_file=file;
else
data->current_file++;
+#endif
data->current_line=line;
}
int broken( int condition )
{
- return (strcmp(winetest_platform, "windows") == 0) && condition;
+ return ((strcmp(winetest_platform, "windows") == 0)
+#ifndef USE_WINE_TODOS
+ || (strcmp(winetest_platform, "reactos") == 0)
+#endif
+ ) && condition;
}
/*
{
if (condition)
{
- fprintf( stdout, "%s:%d: Test succeeded inside todo block: ",
+ fprintf( stdout, __winetest_file_line_prefix ": Test succeeded inside todo block: ",
data->current_file, data->current_line );
vfprintf(stdout, msg, args);
InterlockedIncrement(&todo_failures);
/* show todos even if traces are disabled*/
/*if (winetest_debug > 0)*/
{
- fprintf( stdout, "%s:%d: Test marked todo: ",
+ fprintf( stdout, __winetest_file_line_prefix ": Test marked todo: ",
data->current_file, data->current_line );
vfprintf(stdout, msg, args);
}
{
if (!condition)
{
- fprintf( stdout, "%s:%d: Test failed: ",
+ fprintf( stdout, __winetest_file_line_prefix ": Test failed: ",
data->current_file, data->current_line );
vfprintf(stdout, msg, args);
InterlockedIncrement(&failures);
else
{
if (report_success)
- fprintf( stdout, "%s:%d: Test succeeded\n",
+ fprintf( stdout, __winetest_file_line_prefix ": Test succeeded\n",
data->current_file, data->current_line);
InterlockedIncrement(&successes);
return 1;
if (winetest_debug > 0)
{
- fprintf( stdout, "%s:%d: ", data->current_file, data->current_line );
+ fprintf( stdout, __winetest_file_line_prefix ": ", data->current_file, data->current_line );
__winetest_va_start(valist, msg);
vfprintf(stdout, msg, valist);
__winetest_va_end(valist);
{
tls_data* data=get_tls_data();
- fprintf( stdout, "%s:%d: Tests skipped: ", data->current_file, data->current_line );
+ fprintf( stdout, __winetest_file_line_prefix ": Tests skipped: ", data->current_file, data->current_line );
vfprintf(stdout, msg, args);
skipped++;
}
{
__winetest_va_list valist;
__winetest_va_start(valist, msg);
- if ((strcmp(winetest_platform, "windows") == 0) || (strcmp(winetest_platform, "reactos") == 0))
+ if ((strcmp(winetest_platform, "windows") == 0)
+#ifndef USE_WINE_TODOS
+ || (strcmp(winetest_platform, "reactos") == 0)
+#endif
+ )
winetest_vskip(msg, valist);
else
winetest_vok(0, msg, valist);
{
if (exit_code > 255)
{
- fprintf( stdout, "%s: exception 0x%08x in child process\n", current_test->name, exit_code );
+ fprintf( stdout, "%s: exception 0x%08x in child process\n", current_test->name, (unsigned)exit_code );
InterlockedIncrement( &failures );
}
else
{
fprintf( stdout, "%s: %u failures in child process\n",
- current_test->name, exit_code );
+ current_test->name, (unsigned)exit_code );
while (exit_code-- > 0)
InterlockedIncrement(&failures);
}
}
}
-const char *wine_dbgstr_wn( const WCHAR *str, int n )
+const char *wine_dbgstr_wn( const WCHAR *str, intptr_t n )
{
char *dst, *res;
size_t size;
return res;
}
+const char *wine_dbgstr_guid( const GUID *guid )
+{
+ char *res;
+
+ if (!guid) return "(null)";
+ res = get_temp_buffer( 39 ); /* CHARS_IN_GUID */
+ sprintf( res, "{%08x-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x}",
+ guid->Data1, guid->Data2, guid->Data3, guid->Data4[0],
+ guid->Data4[1], guid->Data4[2], guid->Data4[3], guid->Data4[4],
+ guid->Data4[5], guid->Data4[6], guid->Data4[7] );
+ return res;
+}
+
/* Find a test by name */
static const struct test *find_test( const char *name )
{
/* show test results even if traces are disabled */
/*if (winetest_debug)*/
{
- fprintf( stdout, "%s: %d tests executed (%d marked as todo, %d %s), %d skipped.\n",
- test->name, successes + failures + todo_successes + todo_failures,
- todo_successes, failures + todo_failures,
+ fprintf( stdout, "\n%s: %d tests executed (%d marked as todo, %d %s), %d skipped.\n",
+ test->name, (int)(successes + failures + todo_successes + todo_failures),
+ (int)todo_successes, (int)(failures + todo_failures),
(failures + todo_failures != 1) ? "failures" : "failure",
- skipped );
+ (int)skipped );
}
status = (failures + todo_failures < 255) ? failures + todo_failures : 255;
return status;
#define ok_char(expression, result) ok_hex(expression, result)
#define ok_err(error) \
- ok(GetLastError() == (error), "Wrong last error. Expected " #error ", got %d\n", (int)GetLastError())
+ ok(GetLastError() == (error), "Wrong last error. Expected " #error ", got 0x%lx\n", GetLastError())
#define ok_str(x, y) \
ok(strcmp(x, y) == 0, "Wrong string. Expected '%s', got '%s'\n", y, x)