Private Profile Regression Test

Dmitry Timoshkov dmitry at baikal.ru
Tue Jul 2 20:32:08 CDT 2002


"Joshua Thielen" <joshua_thielen at yahoo.com> wrote:

> What do you think about cases 10 and 11 in
> WritePrivateProfileSection where the section name is
> [Strange 2]? If this section name is added twice,
> windows does not replace the section as is expected
> but instead adds a duplicate [Strange 2] section. I
> thought this case was interesting, but I wasn't sure
> if it should be tested in wine.

I think your approach is completely valid. Wine regression
tests should contain as much as possible various wild tests.
You know, Windows applications are very unpredictable beasts :-)
due to missing or misleading API documentation.

> > I also have the following failures under win2k:
> > 
> > Number of bytes read do not match
> > FAIL: c:\result.ini does not match compare1.ini
> > Number of bytes read do not match
> > FAIL: c:\result.ini does not match compare2.ini
> 
> I originally wrote the test in windows, but I'm afraid
> something might have changed when I ported it from
> windows to wine test code. How do you compile and run
> the tests under windows?

Using the attached patch. Since I was working on some other tests,
I borrowed some code snippets from Wine test suite to not depend
on the Wine testing environment and make my tests easily adjustable
for Wine.

What I miss in the current Wine test framework are:
a) tests, expected to fail under some circumstances
b) portable use of structured exception handling to test the cases
which might or should crash.

> If you like, you can comment out the lines with
> DeleteFileA("c:\\result.ini") and then comment out
> either test_WritePrivateProfileString or
> test_WritePrivateProfileSection from the START_TEST
> function to see the result.ini that is supposed to
> match compare1.ini or compare2.ini, respectively.

Yes, I cursory looked at them, but haven't enough time yet to
find the source of problem.

> After looking at the code again (with rested eyes), I
> think that I might be missing some tests that I
> intended to put in and I definitely have a few typos.
> If you see anything else that needs to be added or
> changed, please let me know.

Sure, when I'll find some more time.

-- 
Dmitry.
-------------- next part --------------
--- profile.c	Tue Jul 02 11:37:56 2002
+++ profile.c	Wed Jul 03 01:03:18 2002
@@ -37,10 +37,45 @@
  *
  */
 
+#include "windows.h"
+
 #include <stdio.h>
-#include "wine/test.h"
-#include "winbase.h"
-#include "winerror.h"
+
+static const char *current_file;
+static int current_line;
+static int current_xfail;
+
+#define ok     (winetest_set_ok_location(__FILE__, __LINE__, 0), 0) ? 0 : winetest_ok
+#define xfail  (winetest_set_ok_location(__FILE__, __LINE__, 1), 0) ? 0 : winetest_ok
+#define trace  printf
+
+void winetest_set_ok_location(const char *file, int line, int expected_fail)
+{
+    current_file = file;
+    current_line = line;
+    current_xfail = expected_fail;
+}
+
+int winetest_ok( int condition, const char *msg, ... )
+{
+    va_list valist;
+
+    if (!condition)
+    {
+        fprintf( stderr, "%s:%d: %s", current_file, current_line,
+                 current_xfail ? "XFAIL" : "FAIL" );
+        if (msg && msg[0])
+        {
+            va_start(valist, msg);
+            fprintf( stderr,": ");
+            vfprintf(stderr, msg, valist);
+            va_end(valist);
+        }
+        fputc( '\n', stderr );
+//        if (!current_xfail) exit(-1);
+    }
+    return 1;
+}
 
 char winpath[1024];
 
@@ -210,8 +245,8 @@
      * Special case: NULL lpReturnedString with size > 0
      * This causes an application error in win2k. Let's make wine better :)
      */
-     ok(!GetPrivateProfileSectionA("No Keys", NULL, 1024, "C:\\test.ini"), 
-             "special case not handled properly\n");
+//     ok(!GetPrivateProfileSectionA("No Keys", NULL, 1024, "C:\\test.ini"), 
+//             "special case not handled properly\n");
 }
 
 static void test_GetPrivateProfileSectionNamesA( void )
@@ -293,8 +328,8 @@
      * Special case: NULL lpReturnedString with size > 0
      * This causes an application error in win2k. Let's make wine better :)
      */
-     ok(!GetPrivateProfileSectionNamesA(NULL, 1024, "C:\\test.ini"),
-             "special case not handled");
+//     ok(!GetPrivateProfileSectionNamesA(NULL, 1024, "C:\\test.ini"),
+//             "special case not handled");
 }
 
 static void test_GetPrivateProfileStringA( void )
@@ -695,7 +730,7 @@
     DeleteFileA("C:\\result.ini");
 }
 
-START_TEST(profile)
+void main(void)
 {
 	char testname[1024], filename[1024];
 


More information about the wine-devel mailing list