=?UTF-8?Q?Bernhard=20=C3=9Cbelacker=20?=: include: Implement todo_wine_if for usage in wine tests.
Alexandre Julliard
julliard at wine.codeweavers.com
Tue Apr 12 06:45:26 CDT 2016
Module: wine
Branch: stable
Commit: a467455ba0df04d46a6410eb6a956b97a0aedb24
URL: http://source.winehq.org/git/wine.git/?a=commit;h=a467455ba0df04d46a6410eb6a956b97a0aedb24
Author: Bernhard Übelacker <bernhardu at vr-web.de>
Date: Tue Feb 9 10:40:01 2016 +0100
include: Implement todo_wine_if for usage in wine tests.
Signed-off-by: Sebastian Lackner <sebastian at fds-team.de>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
(cherry picked from commit 9a08714c02ba9c5ba2fb18d1060cc27511e04d83)
Signed-off-by: Michael Stefaniuc <mstefani at winehq.org>
---
include/wine/test.h | 29 ++++++++++++--------------
programs/cmd/tests/batch.c | 52 +++++++++++++++++++++++-----------------------
2 files changed, 39 insertions(+), 42 deletions(-)
diff --git a/include/wine/test.h b/include/wine/test.h
index 567229a..862d553 100644
--- a/include/wine/test.h
+++ b/include/wine/test.h
@@ -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 );
@@ -123,10 +123,11 @@ extern void __winetest_cdecl winetest_trace( const char *msg, ... );
#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
@@ -225,7 +226,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 */
@@ -400,11 +401,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;
}
@@ -416,13 +416,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 )
diff --git a/programs/cmd/tests/batch.c b/programs/cmd/tests/batch.c
index 9b54089..7196609 100644
--- a/programs/cmd/tests/batch.c
+++ b/programs/cmd/tests/batch.c
@@ -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)
{
More information about the wine-cvs
mailing list