include: Implement todo_wine_if for usage in wine tests.

Signed-off-by: Sebastian Lackner <sebastian@fds-team.de>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Bernhard Übelacker 2016-02-09 10:40:01 +01:00 committed by Alexandre Julliard
parent 79ada31714
commit 9a08714c02
2 changed files with 39 additions and 42 deletions

View File

@ -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); \
#define todo_if(is_todo) for (winetest_start_todo(is_todo); \
winetest_loop_todo(); \
winetest_end_todo(platform))
#define todo_wine todo("wine")
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 )
{
if (strcmp(winetest_platform,platform)==0)
void winetest_end_todo(void)
{
tls_data* data=get_tls_data();
data->todo_level--;
}
data->todo_level >>= 1;
}
int winetest_get_mainargs( char*** pargv )

View File

@ -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,10 +287,11 @@ 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");
}
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 &&
@ -311,8 +312,7 @@ static void test_output(const char *out_data, DWORD out_size, const char *exp_da
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");
}
if (is_exp_resync && err && is_todo_wine)
{