Commit 9a08714c authored by Bernhard Übelacker's avatar Bernhard Übelacker Committed by Alexandre Julliard

include: Implement todo_wine_if for usage in wine tests.

parent 79ada317
......@@ -56,9 +56,9 @@ extern int winetest_interactive;
extern const char *winetest_platform;
extern void winetest_set_location( const char* file, int line );
extern void winetest_start_todo( const char* platform );
extern void winetest_start_todo( int is_todo );
extern int winetest_loop_todo(void);
extern void winetest_end_todo( const char* platform );
extern void winetest_end_todo(void);
extern int winetest_get_mainargs( char*** pargv );
extern LONG winetest_get_failures(void);
extern void winetest_add_failures( LONG new_failures );
......@@ -118,10 +118,11 @@ extern void __winetest_cdecl winetest_trace( const char *msg, ... ) WINETEST_PRI
#define win_skip win_skip_(__FILE__, __LINE__)
#define trace trace_(__FILE__, __LINE__)
#define todo(platform) for (winetest_start_todo(platform); \
winetest_loop_todo(); \
winetest_end_todo(platform))
#define todo_wine todo("wine")
#define todo_if(is_todo) for (winetest_start_todo(is_todo); \
winetest_loop_todo(); \
winetest_end_todo())
#define todo_wine todo_if(!strcmp(winetest_platform, "wine"))
#define todo_wine_if(is_todo) todo_if((is_todo) && !strcmp(winetest_platform, "wine"))
#ifdef NONAMELESSUNION
......@@ -220,7 +221,7 @@ typedef struct
{
const char* current_file; /* file of current check */
int current_line; /* line of current check */
int todo_level; /* current todo nesting level */
unsigned int todo_level; /* current todo nesting level */
int todo_do_loop;
char *str_pos; /* position in debug buffer */
char strings[2000]; /* buffer for debug strings */
......@@ -395,11 +396,10 @@ void __winetest_cdecl winetest_win_skip( const char *msg, ... )
__winetest_va_end(valist);
}
void winetest_start_todo( const char* platform )
void winetest_start_todo( int is_todo )
{
tls_data* data=get_tls_data();
if (strcmp(winetest_platform,platform)==0)
data->todo_level++;
data->todo_level = (data->todo_level << 1) | (is_todo != 0);
data->todo_do_loop=1;
}
......@@ -411,13 +411,10 @@ int winetest_loop_todo(void)
return do_loop;
}
void winetest_end_todo( const char* platform )
void winetest_end_todo(void)
{
if (strcmp(winetest_platform,platform)==0)
{
tls_data* data=get_tls_data();
data->todo_level--;
}
tls_data* data=get_tls_data();
data->todo_level >>= 1;
}
int winetest_get_mainargs( char*** pargv )
......
......@@ -273,11 +273,11 @@ static const char *compare_line(const char *out_line, const char *out_end, const
static void test_output(const char *out_data, DWORD out_size, const char *exp_data, DWORD exp_size)
{
const char *out_ptr = out_data, *exp_ptr = exp_data, *out_nl, *exp_nl, *err;
const char *out_ptr = out_data, *exp_ptr = exp_data, *out_nl, *exp_nl, *err = NULL;
DWORD line = 0;
static const char todo_wine_cmd[] = {'@','t','o','d','o','_','w','i','n','e','@'};
static const char resync_cmd[] = {'-','-','-'};
BOOL is_todo_wine, is_out_resync, is_exp_resync;
BOOL is_todo_wine, is_out_resync = FALSE, is_exp_resync = FALSE;
while(out_ptr < out_data+out_size && exp_ptr < exp_data+exp_size) {
line++;
......@@ -287,32 +287,32 @@ static void test_output(const char *out_data, DWORD out_size, const char *exp_da
is_todo_wine = (exp_ptr+sizeof(todo_wine_cmd) <= exp_nl &&
!memcmp(exp_ptr, todo_wine_cmd, sizeof(todo_wine_cmd)));
if (is_todo_wine) {
if (is_todo_wine)
exp_ptr += sizeof(todo_wine_cmd);
winetest_start_todo("wine");
}
is_exp_resync=(exp_ptr+sizeof(resync_cmd) <= exp_nl &&
!memcmp(exp_ptr, resync_cmd, sizeof(resync_cmd)));
is_out_resync=(out_ptr+sizeof(resync_cmd) <= out_nl &&
!memcmp(out_ptr, resync_cmd, sizeof(resync_cmd)));
err = compare_line(out_ptr, out_nl, exp_ptr, exp_nl);
if(err == out_nl)
ok(0, "unexpected end of line %d (got '%.*s', wanted '%.*s')\n",
line, (int)(out_nl-out_ptr), out_ptr, (int)(exp_nl-exp_ptr), exp_ptr);
else if(err == exp_nl)
ok(0, "excess characters on line %d (got '%.*s', wanted '%.*s')\n",
line, (int)(out_nl-out_ptr), out_ptr, (int)(exp_nl-exp_ptr), exp_ptr);
else if (!err && is_todo_wine && is_out_resync && is_exp_resync)
/* Consider that the todo_wine was to deal with extra lines,
* not for the resync line itself
*/
err = NULL;
else
ok(!err, "unexpected char 0x%x position %d in line %d (got '%.*s', wanted '%.*s')\n",
(err ? *err : 0), (err ? (int)(err-out_ptr) : -1), line, (int)(out_nl-out_ptr), out_ptr, (int)(exp_nl-exp_ptr), exp_ptr);
if(is_todo_wine) winetest_end_todo("wine");
todo_wine_if(is_todo_wine)
{
is_exp_resync=(exp_ptr+sizeof(resync_cmd) <= exp_nl &&
!memcmp(exp_ptr, resync_cmd, sizeof(resync_cmd)));
is_out_resync=(out_ptr+sizeof(resync_cmd) <= out_nl &&
!memcmp(out_ptr, resync_cmd, sizeof(resync_cmd)));
err = compare_line(out_ptr, out_nl, exp_ptr, exp_nl);
if(err == out_nl)
ok(0, "unexpected end of line %d (got '%.*s', wanted '%.*s')\n",
line, (int)(out_nl-out_ptr), out_ptr, (int)(exp_nl-exp_ptr), exp_ptr);
else if(err == exp_nl)
ok(0, "excess characters on line %d (got '%.*s', wanted '%.*s')\n",
line, (int)(out_nl-out_ptr), out_ptr, (int)(exp_nl-exp_ptr), exp_ptr);
else if (!err && is_todo_wine && is_out_resync && is_exp_resync)
/* Consider that the todo_wine was to deal with extra lines,
* not for the resync line itself
*/
err = NULL;
else
ok(!err, "unexpected char 0x%x position %d in line %d (got '%.*s', wanted '%.*s')\n",
(err ? *err : 0), (err ? (int)(err-out_ptr) : -1), line, (int)(out_nl-out_ptr), out_ptr, (int)(exp_nl-exp_ptr), exp_ptr);
}
if (is_exp_resync && err && is_todo_wine)
{
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment