[1/2] tests: Add skip_wine, a standard way to skip tests that would cause Wine to crash.

Francois Gouget fgouget at free.fr
Wed Dec 13 11:12:59 CST 2006


---

This will be used by the next patch.

Currently there is no standard way of adding a test that works on 
Windows but is known to cause Wine to crash. For instance this is 
the case for bug 6827:

Bug 6827: The SimSig installer crashes
http://bugs.winehq.org/show_bug.cgi?id=6827

This essentially means that such tests just don't get written, or get 
put inside '#if 0' or 'if (0)' sections so that they are never executed, 
not even on Windows. This means we won't get good Windows coverage until 
Wine has been 'fixed'.

Hence skip_wine.

Just enclose the whole section with 'skip_wine { }' and it won't be 
executed if the platform is wine. Instead a failed test will be 'logged' 
so that the todo count won't misleadingly be zero. The test will be 
executed normally on Windows which lets us make sure it is correct on 
all Windows versions.


 include/wine/test.h |   17 +++++++++++++++++
 1 files changed, 17 insertions(+), 0 deletions(-)

diff --git a/include/wine/test.h b/include/wine/test.h
index 8ef8a31..0bb6035 100644
--- a/include/wine/test.h
+++ b/include/wine/test.h
@@ -56,6 +56,7 @@ 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 int winetest_skip( const char* platform );
 extern int winetest_get_mainargs( char*** pargv );
 
 #ifdef STANDALONE
@@ -90,6 +91,9 @@ extern void winetest_trace( const char *msg, ... );
                             winetest_end_todo(platform))
 #define todo_wine      todo("wine")
 
+#define skip(platform) if (!winetest_skip(platform))
+#define skip_wine      skip("wine")
+
 
 #ifdef NONAMELESSUNION
 # define U(x)  (x).u
@@ -317,6 +321,19 @@ void winetest_end_todo( const char* platform )
     }
 }
 
+int winetest_skip( const char* platform )
+{
+    tls_data* data=get_tls_data();
+    if (strcmp(winetest_platform,platform)==0)
+    {
+        data->todo_level++;
+        ok(0, "skipping test(s)\n");
+        data->todo_level--;
+        return 1;
+    }
+    return 0;
+}
+
 int winetest_get_mainargs( char*** pargv )
 {
     *pargv = winetest_argv;
-- 
1.4.4.1




More information about the wine-patches mailing list