cmd/tests: Add support for todo_wine constructions (try 3)

Frédéric Delanoy frederic.delanoy at gmail.com
Sat Jul 9 16:33:59 CDT 2011


"@todo_wine@" can be used as a marker at the beginning of expected lines to
indicate that ok tests are to be enclosed in standard todo_wine constructs.
---
 programs/cmd/tests/batch.c |   17 ++++++++++++++---
 1 files changed, 14 insertions(+), 3 deletions(-)

diff --git a/programs/cmd/tests/batch.c b/programs/cmd/tests/batch.c
index 95366da..80eb5c2 100644
--- a/programs/cmd/tests/batch.c
+++ b/programs/cmd/tests/batch.c
@@ -190,6 +190,8 @@ static void test_output(const char *out_data, DWORD out_size, const char *exp_da
 {
     const char *out_ptr = out_data, *exp_ptr = exp_data, *out_nl, *exp_nl, *err;
     DWORD line = 0;
+    static const char todo_wine_cmd[] = {'@','t','o','d','o','_','w','i','n','e','@'};
+    BOOL is_todo_wine = FALSE;
 
     while(out_ptr < out_data+out_size && exp_ptr < exp_data+exp_size) {
         line++;
@@ -197,13 +199,20 @@ static void test_output(const char *out_data, DWORD out_size, const char *exp_da
         for(exp_nl = exp_ptr; exp_nl < exp_data+exp_size && *exp_nl != '\r' && *exp_nl != '\n'; exp_nl++);
         for(out_nl = out_ptr; out_nl < out_data+out_size && *out_nl != '\r' && *out_nl != '\n'; out_nl++);
 
+        if (exp_ptr+sizeof(todo_wine_cmd) <= exp_nl
+                && !memcmp(exp_ptr, todo_wine_cmd, sizeof(todo_wine_cmd))) {
+            is_todo_wine = TRUE;
+            exp_ptr += sizeof(todo_wine_cmd);
+            winetest_start_todo("wine");
+        }
+
         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)
-            ok(0, "unexpected char 0x%x position %d in line %d (got '%.*s', wanted '%.*s')\n",
-               *err, (int)(err-out_ptr), line, (int)(out_nl-out_ptr), out_ptr, (int)(exp_nl-exp_ptr), exp_ptr);
+        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);
 
         exp_ptr = exp_nl+1;
         out_ptr = out_nl+1;
@@ -211,6 +220,8 @@ static void test_output(const char *out_data, DWORD out_size, const char *exp_da
             out_ptr++;
         if(exp_nl+1 < exp_data+exp_size && exp_nl[0] == '\r' && exp_nl[1] == '\n')
             exp_ptr++;
+        if(is_todo_wine) winetest_end_todo("wine");
+        is_todo_wine = FALSE;
     }
 
     ok(exp_ptr >= exp_data+exp_size, "unexpected end of output in line %d, missing %s\n", line, exp_ptr);
-- 
1.7.6




More information about the wine-patches mailing list