winapi_test updates and fixes

Francois Gouget fgouget at free.fr
Sat Oct 18 17:57:34 CDT 2003


I noticed that the test have not been regenerated for quite some time.
Since then:
 * the generated.c files have been modified manually to fix the header
includes (instead of fixing tests.dat as would have been correct)
 * winapi_test has been updated to check that _MSC_VER is defined but
due to lack of regeneration this did not get to the tests
 * the headers have changed quite a bit which means the tests were out
of date

Maybe the issue was that winapi_test did not include pragma statements
that used the #include <...> form rather than #include "...". This
caused it to generate tests that failed. I have fixed that and now
winapi_test generates tests that succeed, at least in Wine.
So I think we can now regenerate the generated.c files.


Changelog:

 * tools/winapi/tests.dat,
   tools/winapi/winapi_test

   Update tests.dat to include the various #include fixes.
   gcc says that sizeof(long double)==12
   Fix the detection of pragma packs to detect #include <...>
   Generate ok("...\n") calls


Index: tools/winapi/tests.dat
===================================================================
RCS file: /home/cvs/wine/tools/winapi/tests.dat,v
retrieving revision 1.9
diff -u -r1.9 tests.dat
--- tools/winapi/tests.dat	12 Nov 2002 01:05:17 -0000	1.9
+++ tools/winapi/tests.dat	18 Oct 2003 22:40:02 -0000
@@ -584,6 +584,7 @@

 %include

+ntstatus.h
 windows.h

 %type
@@ -870,8 +871,11 @@

 stdarg.h
 windef.h
+winbase.h
 wtypes.h
 shellapi.h
+winuser.h
+wingdi.h
 shlobj.h

 %type
@@ -941,8 +945,11 @@

 %include

+stdarg.h
 windef.h
+winbase.h
 wtypes.h
+winreg.h
 shlwapi.h

 %type
@@ -972,7 +979,9 @@

 %include

+stdarg.h
 windef.h
+winbase.h
 urlmon.h

 %type
Index: tools/winapi/winapi_test
===================================================================
RCS file: /home/cvs/wine/tools/winapi/winapi_test,v
retrieving revision 1.11
diff -u -r1.11 winapi_test
--- tools/winapi/winapi_test	30 Sep 2003 00:33:47 -0000	1.11
+++ tools/winapi/winapi_test	18 Oct 2003 22:28:45 -0000
@@ -222,7 +222,7 @@
     } elsif (/^(?:long\s+double)$/) {
 	$align = 4;
 	$kind = "float";
-	$size = 10; # ???
+	$size = 12;
     } elsif (/^H(?:DC|BITMAP|BRUSH|ICON|INSTANCE|MENU|METAFILE|WND)$/) {
 	$align = 4;
 	$kind = "unsigned";
@@ -245,10 +245,10 @@
 	    $output->write("$type_name: can't parse type\n");
 	    $size_parse_reported{$_} = 1;
 	}
-    } elsif (/^\w+\s*\((?:\s*CALLBACK|\s*NTAPI|\s*WINAPI)?\s*\*\s*\)\s*\(.*?\)$/) {
+    } elsif (/^\w+\s*\((?:\s*CALLBACK|\s*NTAPI|\s*WINAPI)?\s*\*\s*\)\s*\(.*?\)$/) {
 	$align = 4;
 	$kind = "pointer";
-	$size = 4;
+	$size = 4;
     }

     my $align2;
@@ -368,11 +368,13 @@
 	my $begin_column = shift;
 	my $preprocessor = shift;

-	local $_ = $preprocessor;
-	if (/^\#\s*include\s+\"pshpack(\d+)\.h\"$/) {
+        #print "found_preprocessor: $begin_line: [$_]\n";
+	if ($preprocessor =~ /^\#\s*include\s+[\"<]pshpack(\d+)\.h[\">]$/) {
 	    push @packs, $1;
-	} elsif(/^\#\s*include\s+\"poppack\.h\"$/) {
+            #print "found pack $1 on line $begin_line\n";
+	} elsif($preprocessor =~ /^\#\s*include\s+[\"<]poppack\.h[\">]$/) {
 	    pop @packs;
+            #print "found poppack on line $begin_line\n";
 	}

 	return 1;
@@ -515,7 +517,7 @@
     print OUT "#ifdef FIELD_ALIGNMENT\n";
     print OUT "# define TEST_FIELD_ALIGNMENT(type, field, align) \\\n";
     print OUT "   ok(FIELD_ALIGNMENT(type, field) == align, \\\n";
-    print OUT "       \"FIELD_ALIGNMENT(\" #type \", \" #field \") == %d (expected \" #align \")\", \\\n";
+    print OUT "       \"FIELD_ALIGNMENT(\" #type \", \" #field \") == %d (expected \" #align \")\\n\", \\\n";
     print OUT "           FIELD_ALIGNMENT(type, field))\n";
     print OUT "#else\n";
     print OUT "# define TEST_FIELD_ALIGNMENT(type, field, align) do { } while (0)\n";
@@ -523,7 +525,7 @@
     print OUT "\n";
     print OUT "#define TEST_FIELD_OFFSET(type, field, offset) \\\n";
     print OUT "    ok(FIELD_OFFSET(type, field) == offset, \\\n";
-    print OUT "        \"FIELD_OFFSET(\" #type \", \" #field \") == %ld (expected \" #offset \")\", \\\n";
+    print OUT "        \"FIELD_OFFSET(\" #type \", \" #field \") == %ld (expected \" #offset \")\\n\", \\\n";
     print OUT "             FIELD_OFFSET(type, field))\n";
     print OUT "\n";
     print OUT "#ifdef _TYPE_ALIGNMENT\n";
@@ -535,13 +537,13 @@
     print OUT "\n";
     print OUT "#ifdef TYPE_ALIGNMENT\n";
     print OUT "#define TEST_TYPE_ALIGNMENT(type, align) \\\n";
-    print OUT "    ok(TYPE_ALIGNMENT(type) == align, \"TYPE_ALIGNMENT(\" #type \") == %d (expected \" #align \")\", TYPE_ALIGNMENT(type))\n";
+    print OUT "    ok(TYPE_ALIGNMENT(type) == align, \"TYPE_ALIGNMENT(\" #type \") == %d (expected \" #align \")\\n\", TYPE_ALIGNMENT(type))\n";
     print OUT "#else\n";
     print OUT "# define TEST_TYPE_ALIGNMENT(type, align) do { } while (0)\n";
     print OUT "#endif\n";
     print OUT "\n";
     print OUT "#define TEST_TYPE_SIZE(type, size) \\\n";
-    print OUT "    ok(sizeof(type) == size, \"sizeof(\" #type \") == %d (expected \" #size \")\", sizeof(type))\n";
+    print OUT "    ok(sizeof(type) == size, \"sizeof(\" #type \") == %d (expected \" #size \")\\n\", sizeof(type))\n";
     print OUT "\n";
     print OUT "/***********************************************************************\n";
     print OUT " * Test macros\n";
@@ -561,10 +563,10 @@
     print OUT "    TEST_TYPE_SIZE(*(type)0, size)\n";
     print OUT "\n";
     print OUT "#define TEST_TYPE_SIGNED(type) \\\n";
-    print OUT "    ok((type) -1 < 0, \"(\" #type \") -1 < 0\");\n";
+    print OUT "    ok((type) -1 < 0, \"(\" #type \") -1 < 0\\n\");\n";
     print OUT "\n";
     print OUT "#define TEST_TYPE_UNSIGNED(type) \\\n";
-    print OUT "     ok((type) -1 > 0, \"(\" #type \") -1 > 0\");\n";
+    print OUT "     ok((type) -1 > 0, \"(\" #type \") -1 > 0\\n\");\n";
     print OUT "\n";
 }

@@ -623,7 +625,7 @@

 	    my @fields = $type->fields;
 	    my $type_name2 =$fields[0]->type_name;
-
+
 	    if ($type_name2 =~ s/\s*\*$//) {
 		my $type2 = $$type_name2type{$type_name2};
 		if (defined($type2)) {
@@ -671,7 +673,7 @@
 	print OUT "    TEST_TYPE_UNSIGNED($type_name);\n";
     }
 }
-
+
 sub output_test_pack_fields {
     local *OUT = shift;



-- 
Francois Gouget         fgouget at free.fr        http://fgouget.free.fr/
Nouvelle version : les anciens bogues ont \xE9t\xE9 remplac\xE9s par de nouveaux.




More information about the wine-patches mailing list