RFC: include: Create todo_wine_if.
Bernhard Übelacker
bernhardu at vr-web.de
Wed Jan 27 10:28:26 CST 2016
Currently list based tests, where just some elements are todo_wine, need
the same ok()-line twice, one without and one with todo_wine.
(e.g. dlls/msvcr120/tests/msvcr120.c line 243)
This patch makes it possible to use a single ok()-line
prefixed with a todo_wine_if(condition).
e.g.:
todo_wine_if(tests[i].todo)
ok(...);
Questions:
- Should we check in winetest_vok also just for the last bit in todo_level?
Changes:
2016-01-27:
- Added message when too many nesting levels are reached.
- Changed todo_level from counter to bitmask.
2016-01-26:
- Give parameter is_todo just to *start_dodo.
- Decrement in *end_todo just when todo_level > 0.
(Thanks to Sebastian Lackner for review.)
Comments: https://www.winehq.org/pipermail/wine-devel/2016-January/111455.html
2016-01-22:
- First version
(Thanks to Sebastian Lackner for review.)
Comments: https://www.winehq.org/pipermail/wine-devel/2016-January/111386.html
---
include/wine/test.h | 23 ++++++++++++++---------
1 file changed, 14 insertions(+), 9 deletions(-)
diff --git a/include/wine/test.h b/include/wine/test.h
index bed44f9..62c7354 100644
--- a/include/wine/test.h
+++ b/include/wine/test.h
@@ -56,7 +56,8 @@ 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_if( const int is_todo, const char* platform );
+#define winetest_start_todo(platform) winetest_start_todo_if(TRUE, (platform))
extern int winetest_loop_todo(void);
extern void winetest_end_todo( const char* platform );
extern int winetest_get_mainargs( char*** pargv );
@@ -118,10 +119,12 @@ 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, platform) for (winetest_start_todo_if(is_todo, platform); \
+ winetest_loop_todo(); \
+ winetest_end_todo(platform))
+#define todo_wine todo_if(TRUE, "wine")
+#define todo_wine_if(is_todo) todo_if((is_todo), "wine")
+
#ifdef NONAMELESSUNION
@@ -220,7 +223,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 +398,13 @@ void __winetest_cdecl winetest_win_skip( const char *msg, ... )
__winetest_va_end(valist);
}
-void winetest_start_todo( const char* platform )
+void winetest_start_todo_if( const int is_todo, const char* platform )
{
tls_data* data=get_tls_data();
+ if (data->todo_level & 0x80000000)
+ printf("todo_level reached maximum nesting levels. Further test results might be wrong.\n");
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,7 +421,7 @@ void winetest_end_todo( const char* platform )
if (strcmp(winetest_platform,platform)==0)
{
tls_data* data=get_tls_data();
- data->todo_level--;
+ data->todo_level >>= 1;
}
}
--
2.1.4
More information about the wine-patches
mailing list