Is there a tutorial or so for how to create new unit tests in Wine? If not, I'll just go ahead and use those there are for blueprints.
Hi Jakob,
Jakob Eriksson wrote:
Is there a tutorial or so for how to create new unit tests in Wine?
Well, not really. The closest thing is the presentation I gave at WineConf2002: http://www.codeweavers.com/about/news/talks/wineconf2002/regression/
Writing proper documentation for the regression framework is part of the Wine 0.9.0 tasklist: http://wine.codeweavers.com/bugzilla/show_bug.cgi?id=526
If not, I'll just go ahead and use those there are for blueprints.
Combined with a quick walk through my presentation, this should pretty much get you up to speed :-)
#include "winbase.h" #include "winerror.h" #include "wine/test.h"
static void test__hread(void) { LPCSTR lpPathName = "testfile.txt"; HFILE filehandle; filehandle = _lcreat(lpPathName, 0);
ok(filehandle != HFILE_ERROR, "_lcreat failed.");
/* _hwrite();*/ ok(DeleteFileA(lpPathName) != 0, "DeleteFile failed."); }
START_TEST(alloc) { test__hread(); }
this is my, of course very incomplete test for _hread().
But it doesn't even compile and I don't understand why. I get this error: ----------------- ../../programs/winetest/runtest -q -P wine -M kernel32.dll -T ../.. tests/atom.pl && touch tests/atom.ok Could not stat /mnt/fd0 (No such file or directory), ignoring drive A: gcc -c -I. -I. -I../../include -I../../include -g -O2 -Wall -mpreferred-stack-boundary=2 -fPIC -D__WINE__ -D_REEN TRANT -I/usr/X11R6/include -o tests/file.o tests/file.c ld -r ../../programs/winetest/wtmain.o tests/testlist.o tests/alloc.o tests/directory.o tests/path.o tests/process. o tests/thread.o tests/file.o -o tests/kernel32_test.tmp.o tests/file.o: In function `func_alloc': /home/jakov/src/WINE/wine/dlls/kernel/tests/file.c(.text+0x7c): multiple definition of `func_alloc' tests/alloc.o(.text+0xe80):/home/jakov/src/WINE/wine/dlls/kernel/tests/alloc.c: first defined here ld: Warning: size of symbol `func_alloc' changed from 39 to 24 in tests/file.o make: *** [tests/kernel32_test.tmp.o] Error 1 -----------------
What's func_alloc got to do with anything? What is it?
On Wed, 24 Apr 2002, Jakob Eriksson wrote: [...]
START_TEST(alloc)
^^^^^
The above means that your file is called 'alloc.c'. Reciprocally, the above should match the name of the C file in which the test is otherwise you will get the 'func_alloc' error that you had.
-- Francois Gouget fgouget@free.fr http://fgouget.free.fr/ Computers are like airconditioners They stop working properly if you open WINDOWS
If that's the bug, maybe we can come up with a better error message.
On Wednesday 24 April 2002 04:30 pm, Francois Gouget wrote:
On Wed, 24 Apr 2002, Jakob Eriksson wrote: [...]
START_TEST(alloc)
^^^^^
The above means that your file is called 'alloc.c'. Reciprocally, the above should match the name of the C file in which the test is otherwise you will get the 'func_alloc' error that you had.
On Wed, 24 Apr 2002, Michael Cardenas wrote:
If that's the bug, maybe we can come up with a better error message.
Looking a little bit more in detail at the error message:
ld -r ../../programs/winetest/wtmain.o tests/testlist.o tests/alloc.o tests/directory.o tests/path.o tests/process.o tests/thread.o tests/file.o -o tests/kernel32_test.tmp.o tests/file.o: In function `func_alloc': /home/jakov/src/WINE/wine/dlls/kernel/tests/file.c(.text+0x7c): multiple definition of `func_alloc' tests/alloc.o(.text+0xe80):/home/jakov/src/WINE/wine/dlls/kernel/tests/alloc.c: first defined here ld: Warning: size of symbol `func_alloc' changed from 39 to 24 in tests/file.o
It appears that the file.c test file was copied from the alloc.c test file but START_TEST(alloc) was not changed accordingly.
Sure it would be nice to have a better error message. I will let you do the required change in the linker though. Unless you had something else in mind?
-- Francois Gouget fgouget@free.fr http://fgouget.free.fr/ Avoid the Gates of Hell - use Linux.
Ahh, I see now. From your response I had the impression that the only problem wat that the name used in START_TEST(name) was not the same as the file name.
I was thinking that the START_TEST macro could be expanded to check that the name passed to it was the same as the file name, or that the START_TEST macro could just get the name of the file itself.
I see now why the error was there, and no thanks, I'll pass on changing the linker. ;-)
On Wed, Apr 24, 2002 at 05:21:48PM -0700, Francois Gouget wrote:
On Wed, 24 Apr 2002, Michael Cardenas wrote:
If that's the bug, maybe we can come up with a better error message.
Looking a little bit more in detail at the error message:
ld -r ../../programs/winetest/wtmain.o tests/testlist.o tests/alloc.o tests/directory.o tests/path.o tests/process.o tests/thread.o tests/file.o -o tests/kernel32_test.tmp.o tests/file.o: In function `func_alloc': /home/jakov/src/WINE/wine/dlls/kernel/tests/file.c(.text+0x7c): multiple definition of `func_alloc' tests/alloc.o(.text+0xe80):/home/jakov/src/WINE/wine/dlls/kernel/tests/alloc.c: first defined here ld: Warning: size of symbol `func_alloc' changed from 39 to 24 in tests/file.o
It appears that the file.c test file was copied from the alloc.c test file but START_TEST(alloc) was not changed accordingly.
Sure it would be nice to have a better error message. I will let you do the required change in the linker though. Unless you had something else in mind?
-- Francois Gouget fgouget@free.fr http://fgouget.free.fr/ Avoid the Gates of Hell - use Linux.