A new define has been added to allow crosscompilation from linux to windows target. I cite from a comment in the code: Thanks to this define, I can compile all tests for Windows with: i586-mingw32msvc-gcc -o file.exe -DREAL_EXE file.c It would be nice if this could be integrated with configure and automatically be crosscompiled everytime "make tests" is called, but I don't (yet) know how to modify configure. That way all or most unit tests could be compiled for Windows all the time. It would also dampen the need to install Perl or Microsoft Visaul C++ or Microsoft .NET on the Windows target to unit test. Help very much appreciated! /jakob@vmlinux.org -------------------------------------------------------------------- ? HOW.txt ? console/Makefile ? dlls/gdi/gdi.spec.c ? dlls/kernel/patch.diff ? dlls/kernel/tests/profile.c ? dlls/kernel/tests/realfile.c ? dlls/user/user.spec.c ? graphics/enhmetafiledrv/Makefile ? graphics/metafiledrv/Makefile ? graphics/win16drv/Makefile ? graphics/win16drv/prtdrv.glue.c ? windows/x11drv/Makefile ? windows/x11drv/wineclipsrv Index: dlls/kernel/tests/directory.c =================================================================== RCS file: /home/wine/wine/dlls/kernel/tests/directory.c,v retrieving revision 1.2 diff -u -r1.2 directory.c --- dlls/kernel/tests/directory.c 1 Apr 2002 21:00:26 -0000 1.2 +++ dlls/kernel/tests/directory.c 10 May 2002 17:13:19 -0000 @@ -126,3 +126,4 @@ test_GetSystemDirectoryA(); test_GetSystemDirectoryW(); } + Index: dlls/kernel/tests/file.c =================================================================== RCS file: /home/wine/wine/dlls/kernel/tests/file.c,v retrieving revision 1.4 diff -u -r1.4 file.c --- dlls/kernel/tests/file.c 10 May 2002 01:10:04 -0000 1.4 +++ dlls/kernel/tests/file.c 10 May 2002 17:13:19 -0000 @@ -1,8 +1,10 @@ -/* +/* -*- wine-c -*- + * * Unit tests for file functions in Wine * * Copyright (c) 2002 Jakob Eriksson * + * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either @@ -19,10 +21,43 @@ * */ + + +/* + * Thanks to this define, I can compile all tests for Windows with: + * + * + * i586-mingw32msvc-gcc -o file.exe -DREAL_EXE file.c + * + * + * It would be nice if this could be integrated with configure and + * automatically be crosscompiled everytime "make tests" is called, + * but I don't (yet) know how to modify configure. + * That way all or most unit tests could be compiled for Windows + * all the time. It would also dampen the need to install Perl or + * Microsoft Visaul C++ or Microsoft .NET on the Windows target to unit + * test. + * Help very much appreciated! + * /jakob@vmlinux.org + * + * + */ +#ifndef REAL_EXE + #include "winbase.h" #include "winerror.h" #include "wine/test.h" +#else + +#include <windows.h> +#include <stdio.h> +#define ok(val, msg) {if (!(val)) {printf ("%s\n", msg);} } +#define todo_wine +#define START_TEST main + +#endif /* REAL_EXE */ + #include <stdlib.h> #include <time.h> @@ -230,7 +265,8 @@ ok( DeleteFileA( filename ) != 0, "DeleteFileA complains." ); - filehandle = _lcreat( filename, 4 ); + filehandle = _lcreat( filename, 4 ); /* SYSTEM file */ + ok( HFILE_ERROR != filehandle, "couldn't create file. Wrong permissions on directory?" ); ok( HFILE_ERROR != _hwrite( filehandle, sillytext, strlen( sillytext ) ), "_hwrite complains." ); @@ -287,7 +323,7 @@ HFILE filehandle; UINT bytes_read; char buffer[10000]; - + filehandle = _lcreat( filename, 0 ); ok( HFILE_ERROR != filehandle, "couldn't create file. Wrong permissions on directory?" ); ok( HFILE_ERROR != _hwrite( filehandle, sillytext, strlen( sillytext ) ), "_hwrite complains." ); @@ -430,6 +466,7 @@ ok( HFILE_ERROR != _lclose( filehandle ), "_lclose complains." ); ok( DeleteFileA( filename ) != 0, "DeleteFile complains." ); + /* TODO - add tests for the SHARE modes - use two processes to pull this one off */ } Index: files/file.c =================================================================== RCS file: /home/wine/wine/files/file.c,v retrieving revision 1.145 diff -u -r1.145 file.c --- files/file.c 26 Apr 2002 18:31:19 -0000 1.145 +++ files/file.c 10 May 2002 17:13:20 -0000 @@ -1,4 +1,4 @@ -/* +/* -*- wine-c -*- * File handling functions * * Copyright 1993 John Burton