cannot build tests on windows

Saulius Krasuckas saulius2 at ar.fi.lt
Sat Jun 11 01:24:18 CDT 2005


* On Thu, 9 Jun 2005, Saulius Krasuckas wrote:
> As I have updated my wine tree from cvs and recompiled it, now I load 
> the "shell32_test.dsw" into MSVC 6.0, press F7 and get linking errors:

I have omited, I had run tools/winapi/msvcmake after compiling the tree.

> | Linking...
> | shlfolder.obj : error LNK2001: unresolved external symbol _winetest_ok

It all occurs because the name STANDALONE isn't being defined.  After some 
grep-work I have found that only tools/make_ctests.c can write out this 
define, but not msvcmaker.  Their code diverged since the patch [1].

Then goes my manual syncing of the code:

| --- dlls/shell32/tests/testlist.c     2005-06-10 12:06:02.000000000 +0300
| +++ /mnt/vcd2/wine/dlls/shell32/tests/testlist.c.1    2005-06-11 00:38:52.000000000 +0300
| @@ -5,22 +5,19 @@
|  #include <stdio.h>
|  #include <stdlib.h>
|  #include "windef.h"
|  #include "winbase.h"
| +
| +#define STANDALONE
| +#include "wine/test.h"
|  
|  extern void func_generated(void);
|  extern void func_shelllink(void);
|  extern void func_shellpath(void);
|  extern void func_shlfileop(void);
|  extern void func_shlfolder(void);
|  extern void func_string(void);
|  
| -struct test
| -{
| -    const char *name;
| -    void (*func)(void);
| -};
| -
|  static const struct test winetest_testlist[] =
|  {
|      { "generated", func_generated },
|      { "shelllink", func_shelllink },
| @@ -30,6 +27,4 @@ static const struct test winetest_testli
|      { "string", func_string },
|      { 0, 0 }
|  };
|  
| -#define WINETEST_WANT_MAIN
| -#include "wine/test.h"

in reaction to which MSVC compiler gives:

| Compiling...
  ...
| testlist.c
| ..\..\..\include\wine/test.h(92) : error C2133: 'winetest_testlist' : unknown size
| Generating Code...
| Error executing cl.exe.

I am wondering, how the idea works with make_ctests, which is used for 
generating source for MinGW crosscompiler.  Or am I wrong?

Here I have two ideas.  First one:

| --- dlls/shell32/tests/testlist.c     2005-06-10 12:06:02.000000000 +0300
| +++ /mnt/vcd2/wine/dlls/shell32/tests/testlist.c.2    2005-06-11 01:19:14.000000000 +0300
| @@ -30,6 +30,6 @@ static const struct test winetest_testli
|      { "string", func_string },
|      { 0, 0 }
|  };
|  
| -#define WINETEST_WANT_MAIN
| +#define STANDALONE
|  #include "wine/test.h"

But since it leaves "struct test" definition being generated for every 
dll, I can think of a second solution:

| --- include/wine/test.h       2005-06-10 11:31:42.000000000 +0300
| +++ /mnt/vcd2/wine/include/wine/test.h.3      2005-06-10 19:33:14.000000000 +0300
| @@ -89,7 +89,7 @@ struct test
|      void (*func)(void);
|  };
|  
| -static const struct test winetest_testlist[];
| +#include "testlist.h"
|  
|  /* debug level */
|  int winetest_debug = 1;
| 
| 
| --- /dev/null 2002-08-31 02:31:37.000000000 +0300
| +++ /mnt/vcd2/wine/dlls/shell32/tests/testlist.h.3    2005-06-10 14:34:24.000000000 +0300
| @@ -0,0 +1,17 @@
| +extern void func_generated(void);
| +extern void func_shelllink(void);
| +extern void func_shellpath(void);
| +extern void func_shlfileop(void);
| +extern void func_shlfolder(void);
| +extern void func_string(void);
| +
| +static const struct test winetest_testlist[] =
| +{
| +    { "generated", func_generated },
| +    { "shelllink", func_shelllink },
| +    { "shellpath", func_shellpath },
| +    { "shlfileop", func_shlfileop },
| +    { "shlfolder", func_shlfolder },
| +    { "string", func_string },
| +    { 0, 0 }
| +};
| 
| 
| --- dlls/shell32/tests/testlist.c     2005-06-10 12:06:02.000000000 +0300
| +++ /mnt/vcd2/wine/dlls/shell32/tests/testlist.c.3    2005-06-11 01:26:43.000000000 +0300
| @@ -6,30 +6,7 @@
|  #include <stdlib.h>
|  #include "windef.h"
|  #include "winbase.h"
| +
| +#define STANDALONE
| +#include "wine/test.h"
|  
| -extern void func_generated(void);
| -extern void func_shelllink(void);
| -extern void func_shellpath(void);
| -extern void func_shlfileop(void);
| -extern void func_shlfolder(void);
| -extern void func_string(void);
| -
| -struct test
| -{
| -    const char *name;
| -    void (*func)(void);
| -};
| -
| -static const struct test winetest_testlist[] =
| -{
| -    { "generated", func_generated },
| -    { "shelllink", func_shelllink },
| -    { "shellpath", func_shellpath },
| -    { "shlfileop", func_shlfileop },
| -    { "shlfolder", func_shlfolder },
| -    { "string", func_string },
| -    { 0, 0 }
| -};
| -
| -#define WINETEST_WANT_MAIN
| -#include "wine/test.h"

This would require msvcmaker to write out two files instead of one - 
testlist.c and testlist.h.  I feel this idea will be rejected.

Yet also we can break wine/test.h into a two include-files, so we can put 
minimal ammount of code into a testlist.c.  

But this idea is even more uglier, so I am staying in wait for any changes 
regarding msvcmaker or some corrections.  TIA.


[1] http://www.winehq.org/hypermail/wine-cvs/2005/05/0510.html



More information about the wine-devel mailing list