[1/2] tests: Add functions to make it possible to handle Windows misbehaviors that we don't want to reproduce in Wine.
Francois Gouget
fgouget at free.fr
Wed May 28 17:22:51 CDT 2008
---
This patch introduces the buggy(), deprecated() and strict_wine
functions I mentioned in:
http://www.winehq.org/pipermail/wine-devel/2008-April/065322.html
And the next patch makes use of this infrastructure.
include/wine/test.h | 51 +++++++++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 51 insertions(+), 0 deletions(-)
diff --git a/include/wine/test.h b/include/wine/test.h
index 1c91077..f3f4c39 100644
--- a/include/wine/test.h
+++ b/include/wine/test.h
@@ -56,6 +56,9 @@ extern void winetest_set_location( const char* file, int line );
extern void winetest_start_todo( const char* platform );
extern int winetest_loop_todo(void);
extern void winetest_end_todo( const char* platform );
+extern void winetest_start_strict( const char* platform );
+extern int winetest_loop_strict(void);
+extern void winetest_end_strict( const char* platform );
extern int winetest_get_mainargs( char*** pargv );
extern void winetest_wait_child_process( HANDLE process );
@@ -68,6 +71,9 @@ extern void winetest_wait_child_process( HANDLE process );
#define START_TEST(name) void func_##name(void)
#endif
+extern int buggy( int condition );
+extern int deprecated( int condition );
+
#ifdef __GNUC__
extern int winetest_ok( int condition, const char *msg, ... ) __attribute__((format (printf,2,3) ));
@@ -95,6 +101,11 @@ extern void winetest_trace( const char *msg, ... );
winetest_end_todo(platform))
#define todo_wine todo("wine")
+#define strict(platform) for (winetest_start_strict(platform); \
+ winetest_loop_strict(); \
+ winetest_end_strict(platform))
+#define strict_wine strict("wine")
+
#ifdef NONAMELESSUNION
# define U(x) (x).u
@@ -185,6 +196,8 @@ typedef struct
int current_line; /* line of current check */
int todo_level; /* current todo nesting level */
int todo_do_loop;
+ int strict_level; /* current strict nesting level */
+ int strict_do_loop;
} tls_data;
static DWORD tls_index;
@@ -224,6 +237,19 @@ void winetest_set_location( const char* file, int line )
data->current_line=line;
}
+int buggy( int condition )
+{
+ tls_data* data=get_tls_data();
+ printf("strict_level=%d\n", data->strict_level);
+ return !data->strict_level && condition;
+}
+
+int deprecated( int condition )
+{
+ tls_data* data=get_tls_data();
+ return !data->strict_level && condition;
+}
+
/*
* Checks condition.
* Parameters:
@@ -335,6 +361,31 @@ void winetest_end_todo( const char* platform )
}
}
+void winetest_start_strict( const char* platform )
+{
+ tls_data* data=get_tls_data();
+ if (strcmp(winetest_platform,platform)==0)
+ data->strict_level++;
+ data->strict_do_loop=1;
+}
+
+int winetest_loop_strict(void)
+{
+ tls_data* data=get_tls_data();
+ int do_loop=data->strict_do_loop;
+ data->strict_do_loop=0;
+ return do_loop;
+}
+
+void winetest_end_strict( const char* platform )
+{
+ if (strcmp(winetest_platform,platform)==0)
+ {
+ tls_data* data=get_tls_data();
+ data->strict_level--;
+ }
+}
+
int winetest_get_mainargs( char*** pargv )
{
*pargv = winetest_argv;
--
1.5.5.1
More information about the wine-patches
mailing list